<<>> <> <> <> <<>> DIRECTORY Convert USING [NetFormat, RopeFromXNSHost], ProcessorFace USING [processorID], Rope, ThisMachine USING [], ThisMachineRegistry; MiscRegistryImpl: CEDAR MONITOR IMPORTS Convert, ProcessorFace, Rope EXPORTS ThisMachine, ThisMachineRegistry ~ BEGIN ROPE: TYPE = Rope.ROPE; ThisMachineRef: TYPE = ThisMachineRegistry.ThisMachineRef; registeredTMProcs: LIST OF ThisMachineRef ¬ NIL; <> Name: PUBLIC PROC [which: ATOM] RETURNS [rope: ROPE ¬ NIL] = { thisProcs: ThisMachineRef ¬ FindProcs[which]; IF thisProcs # NIL THEN rope ¬ thisProcs.Name[]; }; <<>> Address: PUBLIC PROC [which: ATOM] RETURNS [rope: ROPE ¬ NIL] = { thisProcs: ThisMachineRef ¬ FindProcs[which]; IF thisProcs # NIL THEN rope ¬ thisProcs.Address[]; }; <<>> ProcessorID: PUBLIC PROC [which: ATOM] RETURNS [rope: ROPE ¬ NIL] ~ { <> <> format: Convert.NetFormat ¬ SELECT which FROM NIL, $Octal => octal, $Decimal, $ProductSoftware => productSoftware, $Hex => hex, ENDCASE => ERROR; rope ¬ Convert.RopeFromXNSHost[LOOPHOLE[ProcessorFace.processorID], format]; IF (format = octal) THEN { <> length: INT ¬ Rope.Length[rope]; IF (length > 0) AND (Rope.Fetch[rope, length-1] = 'B) THEN rope ¬ Rope.Substr[rope, 0, length-1]; }; }; <> <<>> RegisterThisMachineProcs: PUBLIC ENTRY PROC[newProcs: ThisMachineRef] = { ENABLE UNWIND => NULL; registeredTMProcs ¬ CONS[newProcs, registeredTMProcs]; }; GetThisMachineProcs: PUBLIC ENTRY PROC RETURNS[LIST OF ThisMachineRef] = { ENABLE UNWIND => NULL; RETURN[registeredTMProcs] }; <> FindProcs: ENTRY PROC[which: ATOM] RETURNS[ThisMachineRef] = { ENABLE UNWIND => NULL; reallyUse: ATOM ¬ which; this: ThisMachineRef; Try: PROC RETURNS[ThisMachineRef] = { FOR tmL: LIST OF ThisMachineRef ¬ registeredTMProcs, tmL.rest UNTIL tmL=NIL DO IF reallyUse = tmL.first.which THEN RETURN[tmL.first]; ENDLOOP; RETURN[NIL]; }; SELECT which FROM $Pup => reallyUse ¬ $pup; $XNS => reallyUse ¬ $xns; NIL, $Arpa => reallyUse ¬ $ip; ENDCASE => NULL; IF reallyUse = NIL THEN RETURN[NIL]; IF ( this ¬ Try[] ) # NIL THEN RETURN[this]; IF ( which = NIL ) THEN reallyUse ¬ $ip; RETURN[ Try[] ]; }; END. <> <<>> <> <> <> <> <> <> <> < base _ 8;>> < base _ 10;>> < base _ 16;>> < ERROR UnrecognizedFormatOption;>> <> <> <> <> <> <<};>> <<>> <> <> <> <> <> <> <= base THEN { digits[j] _ digits[j] - base; bit _ 1; }>> <> <> <> <<};>> <<>> <> <> <> <> <> <> <> <> <<};>> <<>> <> <> <> <> <> <> <> <> <