<> <> <> DIRECTORY Commander: TYPE USING [Handle, Register], CommandUtil: TYPE USING [PairList, Echo, Failed, Parse], Cursors: TYPE USING [CursorType, NewCursor], IO: TYPE USING [char, CR, Put, PutChar, PutRope, time], PGSConDefs: TYPE USING [], PGSOps: TYPE USING [PGSPhase, Generate, LockedSource, NoSource, BadSemantics], Rope: TYPE USING [ROPE], Runtime USING [GetBcdTime], UnsafeStorage: TYPE USING [NewUZone, FreeUZone], WindowManager: TYPE USING [WaitCursor, UnWaitCursor]; PGSInterface: PROGRAM IMPORTS Commander, CommandUtil, Cursors, IO, PGSOps, Runtime, UnsafeStorage, WindowManager EXPORTS PGSConDefs = { <> zone: PUBLIC UNCOUNTED ZONE _ NIL; <> preCursor: Cursors.CursorType _ Cursors.NewCursor[ [0, 0, 0, 0, 76b, 146b, 300b, 4300b, 76336b, 4304b, 314b, 164b, 0, 0, 0, 0]]; pgsCursor: Cursors.CursorType _ Cursors.NewCursor[ [37000b, 63000b, 140000b, 140010b, 157174b, 142010b, 146000b, 72000b, 0b, 177777b, 111111b, 177777b, 111111b, 177777b, 111111b, 177777b]]; StartPhase: PROC [phase: PGSOps.PGSPhase] RETURNS [goOn: BOOL _ TRUE] = { SELECT phase FROM $format => WindowManager.WaitCursor[preCursor]; $lalr => WindowManager.WaitCursor[pgsCursor]; ENDCASE}; <<* * * * * * HERE IT BEGINS * * * * * *>> Main: SAFE PROC [cmd: Commander.Handle] = TRUSTED { source: Rope.ROPE; ok, warnings: BOOL; switches: Rope.ROPE; args, results: CommandUtil.PairList; zone _ UnsafeStorage.NewUZone[]; cmd.out.PutRope["Cedar 3.3 PGS of "]; cmd.out.Put[IO.time[Runtime.GetBcdTime[]], IO.char[IO.CR]]; <> BEGIN cmd.out.PutRope["\nCommand: "]; [source, args, results, switches] _ CommandUtil.Parse[s: cmd.in ! CommandUtil.Failed => GO TO badSyntax]; CommandUtil.Echo[cmd.out, source, args, results, switches]; IF source = NIL THEN GO TO noOp; [ok, warnings] _ PGSOps.Generate[source, args, results, switches, StartPhase, TRUE ! PGSOps.NoSource => GO TO noSource; PGSOps.LockedSource => GO TO lockedSource; PGSOps.BadSemantics => GO TO badSemantics]; cmd.out.PutRope["\n "]; cmd.out.PutRope[SELECT TRUE FROM ~ok => "Errors logged, bad output", warnings => "Warnings logged", ENDCASE => "Completed successfully"]; EXITS noOp => NULL; noSource => cmd.out.PutRope[" -- Cannot be opened"]; lockedSource => cmd.out.PutRope[" -- Cannot be modified"]; badSyntax => cmd.out.PutRope[" -- Unparsable command"]; badSemantics => cmd.out.PutRope[" -- Illegal command"]; END; UnsafeStorage.FreeUZone[zone]; zone _ NIL; cmd.out.PutChar[IO.CR]; cmd.out.PutChar[IO.CR]; WindowManager.UnWaitCursor[]; WindowManager.UnWaitCursor[]}; Commander.Register["PGS", Main, "Parser generator system."]; }.