DIRECTORY BasicTime, Rope, DecomposerRegistry; DecomposerRegistryImpl: CEDAR MONITOR EXPORTS DecomposerRegistry = BEGIN OPEN DecomposerRegistry; RegistryList: TYPE = LIST OF DecomposerData; registry: RegistryList _ NIL; Register: PUBLIC ENTRY PROC [data: DecomposerData] = { IF data # NIL THEN { FOR each: RegistryList _ registry, each.rest WHILE each # NIL DO first: DecomposerData = each.first; IF first.key = data.key THEN {each.first _ data; RETURN}; ENDLOOP; registry _ CONS[data, registry]; }; }; UnRegister: PUBLIC ENTRY PROC [data: DecomposerData] = { IF data # NIL THEN { lag: RegistryList _ NIL; FOR each: RegistryList _ registry, each.rest WHILE each # NIL DO first: DecomposerData = each.first; IF each.first = data THEN { IF lag = NIL THEN registry _ each.rest ELSE lag.rest _ each.rest; RETURN; }; lag _ each; ENDLOOP; }; }; Lookup: PUBLIC ENTRY PROC [key: ATOM] RETURNS [DecomposerData] = { FOR each: RegistryList _ registry, each.rest WHILE each # NIL DO first: DecomposerData = each.first; IF first.key = key THEN RETURN [first]; ENDLOOP; RETURN [NIL]; }; Enumerate: PUBLIC ENTRY PROC RETURNS [LIST OF DecomposerData] = { head: RegistryList _ NIL; tail: RegistryList _ NIL; FOR each: RegistryList _ registry, each.rest WHILE each # NIL DO new: RegistryList _ LIST[each.first]; IF tail = NIL THEN head _ new ELSE tail.rest _ new; tail _ new; ENDLOOP; RETURN [head]; }; MakeBoolVal: PUBLIC PROC [b: BOOL] RETURNS [Value] = { RETURN [NEW[ValueRep.boolean _ [boolean[b]]]]; }; MakeCardVal: PUBLIC PROC [c: CARD32] RETURNS [Value] = { RETURN [NEW[ValueRep.cardinal _ [cardinal[c]]]]; }; MakeIntVal: PUBLIC PROC [i: INT32] RETURNS [Value] = { RETURN [NEW[ValueRep.integer _ [integer[i]]]]; }; MakeTimeVal: PUBLIC PROC [gmt: BasicTime.GMT] RETURNS [Value] = { RETURN [NEW[ValueRep.time _ [time[gmt]]]]; }; MakeTextVal: PUBLIC PROC [rope: Rope.ROPE] RETURNS [Value] = { RETURN [NEW[ValueRep.text _ [text[rope]]]]; }; MakeSeqVal1: PUBLIC PROC [val: Value] RETURNS [Value] = { seq: ValueSeq = NEW[ValueSeqRep[1]]; seq[0] _ val; RETURN [NEW[ValueRep.sequence _ [sequence[seq]]]]; }; MakeSeqVal2: PUBLIC PROC [val1, val2: Value] RETURNS [Value] = { seq: ValueSeq = NEW[ValueSeqRep[2]]; seq[0] _ val1; seq[1] _ val2; RETURN [NEW[ValueRep.sequence _ [sequence[seq]]]]; }; MakeSeqValList: PUBLIC PROC [list: LIST OF Value] RETURNS [Value] = { seq: ValueSeq _ NIL; n: NAT _ 0; FOR each: LIST OF Value _ list, each.rest WHILE each # NIL DO n _ n + 1; ENDLOOP; seq _ NEW[ValueSeqRep[n]]; n _ 0; FOR each: LIST OF Value _ list, each.rest WHILE each # NIL DO seq[n] _ each.first; n _ n + 1; ENDLOOP; RETURN [NEW[ValueRep.sequence _ [sequence[seq]]]]; }; END. j DecomposerRegistryImpl.mesa Copyright Σ 1991 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) April 10, 1992 6:30 pm PDT Michael Plass, March 3, 1992 1:10 pm PST Registers a decomposer under data.key. Any previous registration for the given key is lost. Some anticipated keys are: $IP Interpress $PS PostScript $PCL HP PCL Removes the registration (if any) for the given data. Looks up a registered decomposer under a given key. NIL is returned when there is no registration. Returns a list of the current registered decomposers. The order is not important. No element in the list is NIL. ΚΒ•NewlineDelimiter ™headšœ™Icode™Lšœœ ˜+L˜L˜—šž œœœœ ˜9Lšœœ˜$L˜ Lšœœ'˜2L˜L˜—šž œœœœ ˜@Lšœœ˜$L˜L˜Lšœœ'˜2L˜L˜—š žœœœœœœ ˜ELšœœ˜Lšœœ˜ š œœœœœ˜=L˜ Lšœ˜—Lšœœ˜L˜š œœœœœ˜=L˜L˜ Lšœ˜—Lšœœ'˜2L˜L˜—Kšœ˜J˜—…— nš