DIRECTORY PDFileFormat, PDFileReader, Commander, IO, Rope; CheckPD: CEDAR PROGRAM IMPORTS PDFileReader, Commander, IO, Rope ~ BEGIN Break: PROC [char: CHAR] RETURNS [IO.CharClass] = { IF char = '_ OR char = '; THEN RETURN [break]; IF char = ' OR char = ' OR char = ', OR char = '\n THEN RETURN [sepr]; RETURN [other]; }; BitTable: TYPE ~ REF BitTableRep; BitTableRep: TYPE ~ ARRAY [0..10000) OF PACKED ARRAY [0..16) OF InitFalseBoolean; InitFalseBoolean: TYPE ~ BOOLEAN _ FALSE; TypePDCommand: Commander.CommandProc ~ { stream: IO.STREAM _ IO.RIS[cmd.commandLine]; name: Rope.ROPE _ stream.GetTokenRope[Break].token; reader: PDFileReader.Handle _ PDFileReader.Open[name]; out: IO.STREAM _ cmd.out; bitTable: BitTable _ NEW[BitTableRep]; AlreadyPrinted: PROC [loadAddress: INT] RETURNS [BOOLEAN] ~ { IF loadAddress < 0 THEN RETURN [TRUE] ELSE { address: LONG CARDINAL _ loadAddress; IF bitTable[address/16][address MOD 16] THEN RETURN [TRUE] ELSE {bitTable[address/16][address MOD 16] _ TRUE; RETURN [FALSE]}; }; }; quiet: BOOLEAN _ Rope.Find[cmd.commandLine, "QUIET"] >= 0; out.Put[IO.refAny[NEW[PDFileFormat.Herald _ reader.herald]]]; out.PutChar['\n]; DO ref: REF _ PDFileReader.Get[reader]; WITH ref SELECT FROM stateChange: PDFileReader.StateChange => { SELECT stateChange.whatChanged FROM imageStart => { out.PutRope["StartImage "]; out.Put[IO.refAny[NEW[PDFileFormat.StartImage _ reader.image]]]; out.PutChar['\n]; }; imageEnd => out.PutRope["EndImage\n"]; priorityChange => out.PutF["Priority %g\n", IO.int[reader.priority]]; colorChange => { out.PutF["Color Change %g addr %g", IO.refAny[NEW[PDFileReader.ColorType _ reader.colorType]], IO.int[reader.colorTileLoadAddress]]; }; bandChange => out.PutRope["New Band\n"]; loadChange => out.PutF["Load %g(%g)\n", IO.int[stateChange.loadChangeStart], IO.int[stateChange.loadChangeLength]]; documentEnd => EXIT; ENDCASE => ERROR; }; maskSamples: PDFileReader.MaskSamples => { out.PutRope[" MaskSamples"]; IF maskSamples.loadAddress # -1 THEN { out.PutF["Ref %g", IO.int[maskSamples.loadAddress]]; }; out.PutF[" [%g, %g, %g, %g]\n", IO.int[maskSamples.samples.fOrigin + maskSamples.samples.sMin], IO.int[maskSamples.samples.fOrigin + maskSamples.samples.fMin], IO.int[maskSamples.samples.sSize], IO.int[maskSamples.samples.fSize] ]; }; maskRunGroup: PDFileReader.MaskRunGroup => TRUSTED { p: LONG POINTER TO PDFileFormat.Run _ maskRunGroup.pointer; out.PutRope[" MaskRunGroup"]; IF maskRunGroup.loadAddress # -1 THEN { out.PutF["Ref %g", IO.int[maskRunGroup.loadAddress]]; }; out.PutF[" [%g, %g, %g, %g] %g runs:\n", IO.int[maskRunGroup.sMin], IO.int[maskRunGroup.fMin], IO.int[maskRunGroup.sSize], IO.int[maskRunGroup.fSize], IO.int[maskRunGroup.runCount] ]; IF quiet OR AlreadyPrinted[maskRunGroup.loadAddress] THEN NULL ELSE { FOR i: INT IN [0..maskRunGroup.runCount) DO out.PutF[" %g(%g)", IO.int[p.fMin], IO.int[p.fSize]]; IF p.lastRun THEN out.PutChar['\n]; p _ p + SIZE[PDFileFormat.Run]; ENDLOOP; }; }; ENDCASE => { out.PutRope[" "]; out.Put[IO.refAny[ref]]; out.PutChar['\n]; }; ENDLOOP; PDFileReader.Close[reader]; cmd.out.PutRope[" Done."]; }; CheckPDCommand: Commander.CommandProc ~ { stream: IO.STREAM _ IO.RIS[cmd.commandLine]; name: Rope.ROPE _ stream.GetTokenRope[Break].token; reader: PDFileReader.Handle _ PDFileReader.Open[name]; out: IO.STREAM _ cmd.out; out.Put[IO.refAny[NEW[PDFileFormat.Herald _ reader.herald]]]; out.PutChar['\n]; DO ref: REF _ PDFileReader.Get[reader]; WITH ref SELECT FROM stateChange: PDFileReader.StateChange => { SELECT stateChange.whatChanged FROM imageStart => { out.PutRope["StartImage "]; out.Put[IO.refAny[NEW[PDFileFormat.StartImage _ reader.image]]]; out.PutChar['\n]; }; documentEnd => EXIT; ENDCASE => NULL; }; ENDCASE => NULL; ENDLOOP; PDFileReader.Close[reader]; cmd.out.PutRope[" Done."]; }; Commander.Register["CheckPD", CheckPDCommand, "Check a PD file"]; Commander.Register["TypePD", TypePDCommand, "Type a PD file"]; END. €CheckPD.mesa Copyright (C) 1983, Xerox Corporation. All rights reserved. Michael Plass, November 8, 1984 3:12:15 pm PST Κ<˜J™ J™šœ˜šœœœ˜+Jšœœœ˜8Jšœ œ˜#Jšœœ˜Jšœ˜—Jšœ˜—Jšœ˜—šœ˜ Jšœ˜Jšœœ˜J˜Jšœ˜——Jšœ˜—Jšœ˜J˜Jšœ˜J˜—šžœ˜)Jš œœœœœ˜,Jšœ œ$˜3Jšœ6˜6Jšœœœ ˜Jšœœœ(˜=J˜š˜Jšœœ˜$šœœ˜šœ*˜*šœ˜#šœ˜J˜Jšœœœ+˜@J˜Jšœ˜—Jšœœ˜Jšœœ˜—Jšœ˜—Jšœœ˜—Jšœ˜—Jšœ˜J˜Jšœ˜J˜—JšœA˜AJšœ>˜>J˜Jšœ˜—…—n*