DIRECTORY BasicTime USING [], FS USING [StreamOpen], HashTable USING [EachPairAction, Pairs, Value], IO USING [STREAM, int, rope, Close, PutF, PutFR], Rope USING [ROPE, Cat], SiroccoPrivate USING [AquireState, CComponent, CType, FileHeader, Handle, Nest, TABLES, UnDoable]; GenerateAuxInterface: CEDAR PROGRAM IMPORTS FS, HashTable, IO, Rope, SiroccoPrivate EXPORTS SiroccoPrivate ~ { OPEN SiroccoPrivate; ROPE: TYPE ~ Rope.ROPE; Value: TYPE ~ HashTable.Value; Heading: PROC [out: IO.STREAM, programKeyWD: ROPE] ~ { SiroccoPrivate.FileHeader[out, Rope.Cat[programKeyWD, "Aux.Mesa"]]; IO.PutF[out, Nest["DIRECTORY", 1]]; IO.PutF[out, Nest["%g;", 0], IO.rope[programKeyWD]]; IO.PutF[out, Nest["", 0]]; IO.PutF[out, Nest["%gAux: CEDAR DEFINITIONS ~ {", 1], IO.rope[programKeyWD]]; IO.PutF[out, Nest["OPEN %g;", 1], IO.rope[programKeyWD]]; }; GenAuxDefs: PUBLIC PROC ~ { aux: IO.STREAM; failure: BOOLEAN; h: Handle; programKeyWD: ROPE; GenerateInterfaceItem: HashTable.EachPairAction ~ { name: ROPE _ NARROW [key]; entry: CType _ NARROW [value]; item: ROPE; local: BOOLEAN; [item, local] _ UnDoable[name, programKeyWD]; IF (local) THEN { SELECT entry.class FROM boolean, cardinal, integer, longCardinal, longInteger, string, unspecified => { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [p: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; array => { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [a: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; choice => { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [c: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; enumeration => { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [e: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; record => { fieldList: CComponent _ entry.children; IF (fieldList = NIL) THEN { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [--r: %g,-- level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; RETURN; }; IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [r: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; sequence => { IO.PutF[aux, Nest["", 1]]; IO.PutF[aux, "Expose%g: PROC [s: %g, level: NAT] RETURNS [x: ROPE];", IO.rope[item], IO.rope[item] ]; IO.PutF[aux, Nest["", 1]]; }; error => { NULL }; -- always a constant! procedure => { NULL }; -- always a constant! ENDCASE => { ERROR; }; }; }; h _ SIGNAL AquireState[]; programKeyWD _ IO.PutFR["%gP%gV%g", IO.rope[h.programName], IO.int[h.programNo], IO.int[h.versionNo] ]; aux _ FS.StreamOpen[Rope.Cat[programKeyWD, "Aux.Mesa"], $create]; Heading[aux, programKeyWD]; failure _ HashTable.Pairs[h.allTheTables.typeTable, GenerateInterfaceItem]; IO.PutF[aux, Nest["", 0]]; IO.PutF[aux, Nest["}...", 0]]; IO.Close[aux]; }; }. φGenerateAuxInterface.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Bill Jackson (bj) September 25, 1986 3:15:00 am PDT Copied Types Procs Handle Empty Record as a special case because of compiler bug GenAuxDefs MAIN Κι˜šœ™Icodešœ Οmœ1™