DIRECTORY Rope USING [ROPE], XNS USING [Address, Host, Net, unknownSocket, Socket]; XNSAddressParsing: CEDAR DEFINITIONS ~ { ROPE: TYPE ~ Rope.ROPE; Address: TYPE ~ XNS.Address; Net: TYPE ~ XNS.Net; Host: TYPE ~ XNS.Host; Socket: TYPE ~ XNS.Socket; MyAddress: PROC RETURNS [Address]; MyRope: PROC [format: Format _ productSoftware] RETURNS [ROPE]; AddressFromRope: PROC [rope: ROPE, default: Socket _ XNS.unknownSocket] RETURNS [Address]; NetFromRope: PROC [rope: ROPE] RETURNS [Net]; HostFromRope: PROC [rope: ROPE] RETURNS [Host]; SocketFromRope: PROC [rope: ROPE] RETURNS [Socket]; Format: TYPE ~ { octal, hex, productSoftware }; RopeFromAddress: PROC [address: Address, format: Format _ productSoftware] RETURNS [ROPE]; RopeFromNet: PROC [net: Net, format: Format _ productSoftware] RETURNS [ROPE]; RopeFromHost: PROC [host: Host, format: Format _ productSoftware] RETURNS [ROPE]; RopeFromSocket: PROC [socket: Socket, format: Format _ productSoftware] RETURNS [ROPE]; ErrorCode: TYPE = { syntax, noResponse, errorFromServer, other }; Error: ERROR [code: ErrorCode, text: ROPE]; }. XNSAddressParsing.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Demers, October 16, 1986 10:07:06 am PDT Translations between ROPEs and XNS.Addresses. For Clearinghouse name lookup see XNSClearinghouse.df. Syntax A fully specified address string is of the form .. or ## A number can have one of several forms: 1) Decimal: a sequence of characters in ['0..'9] optionally followed by 'D or 'd. The string may also have '- characters embedded, implying product format. A leading '- is not allowed. 2) Octal: a sequence of characters in ['0..'7] followed by 'B or 'b. 3) Hex: a sequence of characters in {IN['0..'9], IN['A..'F], IN['a..'f]} beginning with a digit and followed by 'H or 'h. The trailing 'H or 'h is optional if at least one character is in {IN['A..'F], IN['a..'f]}. Additional forms are allowed for nostNumber: 4) The special string "ME" (in upper case), which is equivalent to specifing the Processor ID (XNS Host number) of the host where the code is running. 5) The special string "*", which is equivalent to specifing the broadcast XNS Host number. The hostNumber must always be supplied. Both netNumber and socketNumber can be defaulted. The translation routine will translate any string that is well formed and unambiguous. Acceptable examples: 74B#25200000016#2 25200000016B ME * 1-000.ME. 131B.*. #25200000016B#2 Ambiguous (because pair could mean net#host or host#socket): 74#2 Local Address Returns best address for this machine, with socket set to XNS.unknownSocket. XNS.unknownAddress might happen if there are no drivers active. Equivalent to RopeFromAddress[MyAddress[], format]; Rope/Address translation Parses the rope to an address. If rope doesn't specify any socket number, then default will be used. The idea is that a program can have a well-known default socket number, but a wizard can specify a different socket number for debugging. Rope should represent a (single) number, with no '. or '# characters. Thus, for example, HostFromRope["12"] = AddressFromRope["1.12.123"].host Controls the format in which a network address gets expanded by RopeFromAddress. "Octal" and "hex" do the obvious; "productSoftware" converts each field to decimal and inserts a '-' every 3 digits, starting from the right. Returns a ROPE of the form "1.12.123". An unknownSocket is expanded as the null string, e.g. "1.12." (no trailing 0). Errors For now we're not using Clearinghouse, so most of these "can't happen". Κή˜codešœ™Kšœ Οmœ1™