DIRECTORY Arpa, ArpaName, Atom, Identification, IO, XlAccess, Rope, ThisMachine, UserProfile; XlAccessAndNameTranslationlPrincOps: CEDAR PROGRAM IMPORTS ArpaName, Atom, IO, Rope, ThisMachine, UserProfile EXPORTS XlAccess, Identification ~ BEGIN Self: PUBLIC PROC [a: ATOM ฌ NIL] RETURNS [Rope.ROPE] = { SELECT a FROM NIL => RETURN [ThisMachine.Name[]]; ENDCASE => RETURN [ThisMachine.Name[]]; }; ServerNameFromProperties: PROC [for: ATOM] RETURNS [name: Rope.ROPE ฌ NIL] = { IF for=NIL THEN for ฌ $X11; WITH Atom.GetProp[atom: for, $DISPLAY] SELECT FROM r: Rope.ROPE => name ฌ r; ENDCASE => {}; }; DefaultServer: PUBLIC PROC [for: ATOM ฌ NIL] RETURNS [serverName: Rope.ROPE] = { serverKey: Rope.ROPE; IF for#$UserProfile THEN { serverName ฌ ServerNameFromProperties[for]; IF Rope.IsEmpty[serverName] AND for#NIL THEN serverName ฌ ServerNameFromProperties[NIL] }; IF Rope.IsEmpty[serverName] THEN { IF for=NIL THEN serverKey ฌ "X11.ServerName" ELSE serverKey ฌ Rope.Concat["X11.ServerName.", Atom.GetPName[for]]; serverName ฌ UserProfile.Token[serverKey]; IF Rope.IsEmpty[serverName] AND for#NIL THEN serverName ฌ UserProfile.Token["X11.ServerName"]; }; }; AddressFromNameFailed: PUBLIC ERROR [msg: Rope.ROPE] = CODE; StatusToRope: PROC [status: ArpaName.ReplyStatus] RETURNS [msg: Rope.ROPE] = { msg ฌ SELECT status FROM ok => "ArpaName: ok", bogus => "ArpaName: Invalid name/address", other => "ArpaName: Entry is of other type. Try a different type of query", down => "ArpaName: Servers for address are not responding properly. Try again later", ENDCASE => "ArpaName: other" }; NameToAddress: PUBLIC PROC [name: Rope.ROPE] RETURNS [address: Rope.ROPE] = { a: Arpa.Address; status: ArpaName.ReplyStatus; [addr~a, status~status] ฌ ArpaName.NameToAddress[name]; IF status#ok THEN AddressFromNameFailed[StatusToRope[status]]; IF a=Arpa.nullAddress THEN AddressFromNameFailed["null address"]; address ฌ IO.PutFR["%g.%g.%g.%g", IO.int[a.a], IO.int[a.b], IO.int[a.c], IO.int[a.d]] }; END. ไ XlAccessImplPrincOps.mesa Copyright ำ 1988, 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, May 11, 1988 Christian Jacobi, February 22, 1990 Christian Jacobi, October 9, 1992 0:40 am PDT ส๊•NewlineDelimiter –(cedarcode) style™code™Kšœ ฯeœC™NKšœ™Kšœ#™#K™-K™—šฯk œ˜ K˜SK˜—šฯn#œžœž˜2Kšžœ3˜:Kšžœ˜ —Kšœž˜K˜šŸœžœžœžœžœžœžœ˜9šžœž˜ Kšžœžœ˜#Kšžœžœ˜'—K˜K™—š Ÿœžœžœžœ žœžœ˜NKšžœžœžœ ˜šžœ#žœž˜2Kšœžœ ˜Kšžœ˜—K˜K˜—šŸ œžœžœžœžœžœžœ˜PKšœžœ˜šžœžœ˜Kšœ+˜+šžœžœžœžœ˜-Kšœ&žœ˜*—K˜—šžœžœ˜"šžœžœ˜ Kšžœ˜"KšžœA˜E—Kšœ*˜*šžœžœžœžœ˜-Kšœ1˜1—K˜—K˜—K˜Kš Ÿœžœžœ žœžœ˜Kšžœžœ'˜AKšœ žœI˜UKšœ˜—K˜Kšžœ˜K˜—…—า