<> <> <> <> <<>> DIRECTORY BasicTime USING [ ], FS USING [StreamOpen], IO USING [STREAM, rope, Close, PutF, PutRope], Rope USING [ROPE, Cat], SiroccoPrivate USING [AquireState, CComponent, CType, FileHeader, Handle, Nest, TABLES, UnDoable], SymTab USING [EachPairAction, Pairs]; GenerateAuxInterface: CEDAR PROGRAM IMPORTS FS, IO, Rope, SiroccoPrivate, SymTab EXPORTS SiroccoPrivate ~ { OPEN SiroccoPrivate; ROPE: TYPE ~ Rope.ROPE; Heading: PROC [out: IO.STREAM, programKeyWD: ROPE] ~ { SiroccoPrivate.FileHeader[out, Rope.Cat[programKeyWD, "Aux.Mesa"]]; IO.PutRope[out, Nest["DIRECTORY", 1]]; IO.PutF[out, Nest["%g;", 0], IO.rope[programKeyWD]]; IO.PutRope[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; GenerateInterfaceItem: SymTab.EachPairAction ~ { name: ROPE _ NARROW [key]; entry: CType _ NARROW [val]; item: ROPE; local: BOOL; GenItem: PROC ~ { IO.PutF[aux, "%gExpose%g: PROC [arg: %g, level: NAT] RETURNS [res: ROPE];%g", IO.rope[Nest[NIL, 1]], IO.rope[item], IO.rope[item], IO.rope[Nest[NIL,1]] ]; }; [item, local] _ UnDoable[name, h.programKeyWD]; IF ( local ) THEN { SELECT entry.class FROM array => GenItem[]; bool => GenItem[]; card16 => GenItem[]; card32 => GenItem[]; choice => GenItem[]; enum => GenItem[]; error => NULL; -- always a constant! int16 => GenItem[]; int32 => GenItem[]; proc => NULL; -- always a constant! record => GenItem[]; seq => GenItem[]; sink => NULL; -- can't print meaningfully source => NULL; -- can't print meaningfully string => GenItem[]; unspec => GenItem[]; ENDCASE => ERROR; }; }; h _ SIGNAL AquireState[]; aux _ FS.StreamOpen[Rope.Cat[h.programKeyWD, "Aux.Mesa"], $create]; Heading[aux, h.programKeyWD]; failure _ SymTab.Pairs[h.allTheTables.typeTable, GenerateInterfaceItem]; IO.PutRope[aux, Nest[NIL, 0]]; IO.PutRope[aux, Nest["}...", 0]]; IO.Close[aux]; }; }.