DIRECTORY AtomPrivate, ConvertUnsafe, RegisterRefLiteral, Rope, SafeStorage; RegisterRefLiteralImpl: CEDAR MONITOR IMPORTS AtomPrivate, ConvertUnsafe EXPORTS RegisterRefLiteral ~ BEGIN tab: LIST OF TypeCreator ¬ NIL; TypeCreator: TYPE = RECORD [ type: SafeStorage.Type, proc: RegisterRefLiteral.RegisteredProc ]; UnknownType: PUBLIC ERROR [type: SafeStorage.Type, string: LONG STRING] = CODE; Registrar: TYPE = PROC [p: RegisterRefLiteral.RegisteredProc, type: SafeStorage.Type]; ExternalNames: PROC = TRUSTED MACHINE CODE { "^ExternalNames\n"; "Create XR_GetRefLiteral\n"; "RegisterType XR_RegisterRefLiteralCreator\n"; }; RegisterType: PUBLIC ENTRY Registrar ~ { -- aka XR¬RegisterRefLiteralCreator FOR l: LIST OF TypeCreator ¬ tab, l.rest UNTIL l=NIL DO IF l.first.type = type THEN {l.first.proc ¬ p; RETURN}; ENDLOOP; tab ¬ CONS[[type: type, proc: p], tab]; }; Uninit: RegisterRefLiteral.RegisteredProc ~ { ERROR; }; LookupType: INTERNAL PROC [type: SafeStorage.Type] RETURNS [found: BOOL, p: RegisterRefLiteral.RegisteredProc] ~ { FOR l: LIST OF TypeCreator ¬ tab, l.rest UNTIL l=NIL DO IF l.first.type = type THEN {RETURN[TRUE, l.first.proc]}; ENDLOOP; RETURN[FALSE, Uninit]; }; Creator: TYPE = PROC [type: SafeStorage.Type, string: LONG STRING] RETURNS [REF]; Create: PUBLIC ENTRY Creator ~ { -- aka XR¬GetRefLiteral found: BOOL; p: RegisterRefLiteral.RegisteredProc; [found, p] ¬ LookupType[type]; IF found THEN RETURN p[string] ELSE { RETURN WITH ERROR UnknownType[type, string]; }; }; CreateTEXT: RegisterRefLiteral.RegisteredProc = TRUSTED { RETURN [IF string = NIL THEN NIL ELSE ConvertUnsafe.ToRefText[string]] }; CreateROPE: RegisterRefLiteral.RegisteredProc = TRUSTED { RETURN [IF string = NIL THEN NIL ELSE ConvertUnsafe.ToRope[string]] }; CreateATOM: RegisterRefLiteral.RegisteredProc = TRUSTED { RETURN [AtomPrivate.UnsafeMakeAtomFromString[string]] }; ExternalNames[]; RegisterType[CreateROPE, CODE[Rope.ROPE]]; RegisterType[CreateROPE, CODE[Rope.Text]]; RegisterType[CreateTEXT, CODE[REF TEXT]]; RegisterType[CreateATOM, CODE[ATOM]]; END. δ RegisterRefLiteralImpl.mesa Copyright Σ 1987, 1991 by Xerox Corporation. All rights reserved. Mark Weiser, February 19, 1988 10:46:12 am PST Carl Hauser, March 8, 1988 10:59:43 am PST Chauser, January 3, 1991 11:26 am PST Willie-s, May 30, 1991 11:40 am PDT Doug Wyatt, August 24, 1991 10:33 pm PDT Michael Plass, September 24, 1992 9:38 pm PDT This module registers general procs for making the world safe for ref literals. It also registers the first four procs, for handling the compiler built-in ref literal types of Rope.ROPE, Rope.Text, REF TEXT, and Atom. the global list of all REF-literal types together with their creator procs Registers "p" to be used to create REF literals of type "type" from LONG STRINGs. Note that the REF type, not the referent type, is used to register the procedure. this procedure should never be called. Called by the runtime during installation of each REF literal. It looks up the type, and calls the appropriate registered proc. If there isn't one, it raises an error. Somebody introduced REF literals in CedarCore; that's a no-no but until its fixed we'll press on. IF tab = NIL THEN -- RETURN WITH ERROR UnknownType[type, string] -- TRUSTED {RETURN[LOOPHOLE[string]]}; The most likely cause of this is an interface version mismatch with Rope. But we find out about it here before importing Rope because the compiler generates REF literal registration before imports. Here is the start code. It registers handlers for the first four types. Κ•NewlineDelimiter –(cedarcode) style™code•Mark outsideHeaderšœ™Kšœ Οeœ7™BKšœ.™.K™*K™%K™#K™(K™-K˜KšœΪ™ΪK™K™—šΟk ˜ K˜ K˜K˜K˜Kšœ ˜ —K˜šΟnœžœž˜%Kšžœ˜"Kšžœ˜Kšœž˜—˜šœžœžœžœ˜K™JK™—šœ žœžœ˜Kšœ˜Kšœ'˜'K˜K˜—Kš Ÿ œžœžœ"žœžœžœ˜OK˜šœ žœžœ@˜VK˜—š Ÿ œžœžœžœžœ˜,Kšœ˜KšœŸœžœ˜KšœŸ œžœ˜.Kšœ˜K˜—šŸ œžœžœΟc#˜LK™UKšœžœ@™QK™š žœžœžœžœžœž˜7Kšžœžœžœ˜7Kšžœ˜—Kšœžœ˜'K˜K˜—šŸœ'˜-K™&Kšžœ˜K˜K˜—š Ÿ œžœžœžœ žœ+˜rš žœžœžœžœžœž˜7Kšžœžœžœžœ˜9Kšžœ˜—Kšžœžœ ˜K˜K˜—Kš œ žœžœ"žœžœžœžœ˜QK˜šŸœžœžœ  ˜8K™¨K™Kšœžœ˜ Kšœ%˜%K™cKšžœžœžœ 1œžœžœžœ ™hKšœ˜Kšžœžœžœ ˜šžœ˜K™ΖKšžœž œ˜,Kšœ˜—K˜K˜—šŸ œ#œžœ˜9Kš žœžœ žœžœžœžœ!˜FK˜K˜—šŸ œ&žœ˜9Kš žœžœ žœžœžœžœ˜CK˜K˜—šŸ œ&žœ˜9Kšžœ/˜5K˜K™K™—K™HK™K˜K˜Kšœžœžœ˜*Kšœžœ ˜*Kšœžœžœžœ˜)Kšœžœžœ˜%K˜—Kšžœ˜—…—