-- file: GFTypeImpl2.mesa -- Pascal-to-Mesa translator output, translated at October 18, 1985 11:15:21 am PDT DIRECTORY PascalBasic, PascalWizardFiles, GFTypePrivate; GFTypeImpl2: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, GFTypePrivate EXPORTS GFTypePrivate = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, GFTypePrivate; OpenGfFile: PROCEDURE = BEGIN ByteFileReset[@GfFile,Alfa['g, 'f, ' , ' , ' , ' , ' , ' , ' , ' ]];CurLoc←0; END;--:22----24: GetByte: PROCEDURE RETURNS[GetByteResult: PascalInteger] = BEGIN B:EightBits; IF PascalEOF[file: @GfFile.baseFile] THEN GetByteResult←0 ELSE BEGIN PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @B]; CurLoc←CurLoc+1;GetByteResult←B; END; END; GetTwoBytes: PROCEDURE RETURNS[GetTwoBytesResult: PascalInteger] = BEGIN A, B:EightBits; PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @A];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @B]; CurLoc←CurLoc+2;GetTwoBytesResult←A*256+B; END; GetThreeBytes: PROCEDURE RETURNS[GetThreeBytesResult: PascalInteger] = BEGIN A, B, C:EightBits; PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @A];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @B];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @C]; CurLoc←CurLoc+3;GetThreeBytesResult← INT[(A*256+B)]*256+C; END; SignedQuad: PROCEDURE RETURNS[SignedQuadResult: PascalInteger] = BEGIN A, B, C, D:EightBits; PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @A];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @B];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @C];PascalReadLong[file: @GfFile.baseFile, length: SIZE[EightBits, 2], element: @GfFile.element, item: @D]; CurLoc←CurLoc+4; IF INT[A]<128 THEN SignedQuadResult←( INT[(A*256+B)]*256+C)*256+D ELSE SignedQuadResult←(( INT[( A-256)]*256+B)*256+C)*256+D; END;--:24----29:-- DoChar: PROCEDURE RETURNS[DoCharResult: PascalBoolean] = BEGIN O:EightBits;P, Q:PascalInteger;Aok:PascalBoolean; Aok←TRUE; {{WHILE TRUE DO--50:--BEGIN A←CurLoc;O←GetByte[];P←FirstPar[O]; IF PascalEOF[file: @GfFile.baseFile] THEN BEGIN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLongString[file: @Output, item: "Bad GF file: "] ; PascalWriteLongString[file: @Output, item: "the file ended prematurely"]; PascalWriteLongString[file: @Output, item: "!"]};JumpOut[]; END;--51:--IF INT[O]<=67 THEN--56: BEGIN IF WantsMnemonics THEN PascalWriteLongString[file: @Output, item: " paint "];DO--57: IF WantsMnemonics THEN IF PaintSwitch=0 THEN {PascalWriteLongString[file: @Output, item: "("]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ")"]} ELSE PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1];M←M+P;IF M>MaxMObserved THEN MaxMObserved←M-1; IF WantsPixels THEN--58: IF PaintSwitch=1 THEN IF N<=MaxSubrow THEN BEGIN L←M-P;R←M-1; IF R>MaxSubcol THEN R←MaxSubcol;M←L; WHILE M<=R DO BEGIN ImageArray↑[M][N]←1;M←M+1; END ENDLOOP ;M←L+P; END--:58--; PaintSwitch←1-PaintSwitch--:57--;A←CurLoc;O←GetByte[]; P←FirstPar[O];IF PascalEOF[file: @GfFile.baseFile] THEN BEGIN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLongString[file: @Output, item: "Bad GF file: "] ; PascalWriteLongString[file: @Output, item: "the file ended prematurely"]; PascalWriteLongString[file: @Output, item: "!"]};JumpOut[]; END; IF INT[O]>67 THEN EXIT; ENDLOOP; END--:56--; SELECT O FROM 70,71,72,73 =>--60:--BEGIN IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output]; {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "skip"] ; PascalWriteInteger[file: @Output, item: PascalMODPower2Mask[(O-70),3], fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " "]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]}; END;N←N+P+1;M←0; PaintSwitch←0; IF WantsMnemonics THEN {PascalWriteLongString[file: @Output, item: " (n="]; PascalWriteInteger[file: @Output, item: MaxNStated-N, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ")"]}; END--:60--; 74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97, 98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115, 116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133, 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151, 152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169, 170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187, 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205, 206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238 =>--59: BEGIN IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output]; {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "newrow "]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]}; END;N←N+1;M←P;PaintSwitch←1; IF WantsMnemonics THEN {PascalWriteLongString[file: @Output, item: " (n="]; PascalWriteInteger[file: @Output, item: MaxNStated-N, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ")"]}; END--:59--; --52:--244 =>IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output];{PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "no op"]}; END;247 =>BEGIN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "preamble command within a character!"]};PascalWriteLn[file: @Output]; END; GOTO Label9998; END; 248,249 =>BEGIN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "postamble command within a character!"]};PascalWriteLn[file: @Output]; END; GOTO Label9998; END; 67,68 =>BEGIN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "boc occurred before eoc!"]}; PascalWriteLn[file: @Output]; END; GOTO Label9998; END; 69 =>BEGIN IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output];{PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "eoc"]}; END;PascalWriteLn[file: @Output]; GOTO Label9999; END;--:52--239,240,241,242 =>--53: BEGIN IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output];{PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "xxx '"]}; END;BadChar←FALSE;B←16;IF P<0 THEN BEGIN PascalWriteLn[file: @Output]; {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "string of negative length!"]};PascalWriteLn[file: @Output]; END; WHILE P>0 DO BEGIN Q←GetByte[];IF(Q<32)OR (Q>126) THEN BadChar←TRUE; IF WantsMnemonics THEN BEGIN PascalWriteChar[file: @Output, item: Xchr↑[Q]]; IF B<LineLength THEN B←B+1 ELSE BEGIN PascalWriteLn[file: @Output];B←2; END; END;P←P-1; END ENDLOOP ; IF WantsMnemonics THEN PascalWriteLongString[file: @Output, item: "'"];IF BadChar THEN BEGIN PascalWriteLn[file: @Output]; {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "non-ASCII character in xxx command!"]};PascalWriteLn[file: @Output]; END; END--:53--;243 =>--55:--BEGIN IF WantsMnemonics THEN BEGIN PascalWriteLn[file: @Output]; {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "yyy "]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]}; END; IF WantsMnemonics THEN BEGIN PrintScaled[P];PascalWriteLongString[file: @Output, item: ")"]; END; END--:55--; ENDCASE =>BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "undefined command "]; PascalWriteInteger[file: @Output, item: O, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END --:51--; END--:50-- ENDLOOP ;EXITS Label9998 => NULL};{PascalWriteLongString[file: @Output, item: "!"]; PascalWriteLn[file: @Output]};Aok←FALSE;EXITS Label9999 => NULL};DoCharResult←Aok; END;--:49----61:-- ReadPostamble: PROCEDURE = BEGIN K:PascalInteger; P, Q, M, U, V, W, C:PascalInteger; --64: PostLoc←CurLoc-1; {PascalWriteLongString[file: @Output, item: "Postamble starts at byte "]; PascalWriteInteger[file: @Output, item: PostLoc, fieldMinLength: 1]}; IF PostLoc=GfPrevPtr THEN {PascalWriteLongString[file: @Output, item: "."]; PascalWriteLn[file: @Output]} ELSE { PascalWriteLongString[file: @Output, item: ", after special info at byte "]; PascalWriteInteger[file: @Output, item: GfPrevPtr, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "."]; PascalWriteLn[file: @Output]};P←SignedQuad[]; IF P#GfPrevPtr THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "backpointer in byte "] ; PascalWriteInteger[file: @Output, item: CurLoc-4, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " should be "]; PascalWriteInteger[file: @Output, item: GfPrevPtr, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " not "]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END; DesignSize←SignedQuad[];CheckSum←SignedQuad[]; {PascalWriteLongString[file: @Output, item: "design size = "]; PascalWriteInteger[file: @Output, item: DesignSize, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]}; PrintScaled[ PascalDIVPower2[DesignSize ,4]];{PascalWriteLongString[file: @Output, item: "pt)"]; PascalWriteLn[file: @Output]}; {PascalWriteLongString[file: @Output, item: "check sum = "]; PascalWriteInteger[file: @Output, item: CheckSum, fieldMinLength: 1]; PascalWriteLn[file: @Output]};Hppp←SignedQuad[];Vppp←SignedQuad[]; {PascalWriteLongString[file: @Output, item: "hppp = "]; PascalWriteInteger[file: @Output, item: Hppp, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]};PrintScaled[Hppp];{PascalWriteLongString[file: @Output, item: ")"]; PascalWriteLn[file: @Output]}; {PascalWriteLongString[file: @Output, item: "vppp = "]; PascalWriteInteger[file: @Output, item: Vppp, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]};PrintScaled[Vppp];{PascalWriteLongString[file: @Output, item: ")"]; PascalWriteLn[file: @Output]}; PixRatio←(PascalFLOAT[DesignSize]/PascalFLOAT[1048576])*(PascalFLOAT[Hppp]/PascalFLOAT[1048576]); MinMStated←SignedQuad[];MaxMStated←SignedQuad[]; MinNStated←SignedQuad[];MaxNStated←SignedQuad[]; {PascalWriteLongString[file: @Output, item: "min m = "]; PascalWriteInteger[file: @Output, item: MinMStated, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ", max m = "]; PascalWriteInteger[file: @Output, item: MaxMStated, fieldMinLength: 1]; PascalWriteLn[file: @Output]}; IF MinMStated>MinMOverall THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "min m should be <="]; PascalWriteInteger[file: @Output, item: MinMOverall, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END; IF MaxMStated<MaxMOverall THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "max m should be >="]; PascalWriteInteger[file: @Output, item: MaxMOverall, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END; {PascalWriteLongString[file: @Output, item: "min n = "]; PascalWriteInteger[file: @Output, item: MinNStated, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ", max n = "]; PascalWriteInteger[file: @Output, item: MaxNStated, fieldMinLength: 1]; PascalWriteLn[file: @Output]}; IF MinNStated>MinNOverall THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "min n should be <="]; PascalWriteInteger[file: @Output, item: MinNOverall, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END; IF MaxNStated<MaxNOverall THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "max n should be >="]; PascalWriteInteger[file: @Output, item: MaxNOverall, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END;--65: DO A←CurLoc;K←GetByte[]; IF(K=245)OR (K=246) THEN BEGIN C←FirstPar[K]; IF K=245 THEN BEGIN U←SignedQuad[];V←SignedQuad[]; END ELSE BEGIN U←GetByte[]*65536;V←0; END;W←SignedQuad[];P←SignedQuad[]; {PascalWriteLongString[file: @Output, item: "Character "]; PascalWriteInteger[file: @Output, item: C, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": dx "]; PascalWriteInteger[file: @Output, item: U, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]};PrintScaled[U]; IF V#0 THEN BEGIN {PascalWriteLongString[file: @Output, item: "), dy "]; PascalWriteInteger[file: @Output, item: V, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]};PrintScaled[V]; END; {PascalWriteLongString[file: @Output, item: "), width "]; PascalWriteInteger[file: @Output, item: W, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " ("]};W←PascalROUND[PascalFLOAT[W]*PixRatio];PrintScaled[W]; {PascalWriteLongString[file: @Output, item: "), loc "]; PascalWriteInteger[file: @Output, item: P, fieldMinLength: 1]; PascalWriteLn[file: @Output]};IF P#CharPtr↑[C] THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "character location should be "]; PascalWriteInteger[file: @Output, item: CharPtr↑[C], fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "!"]};PascalWriteLn[file: @Output]; END;K←244; END; IF K#244 THEN EXIT; ENDLOOP;--:65--IF K#249 THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "]; PascalWriteLongString[file: @Output, item: "should be postpost!"]};PascalWriteLn[file: @Output]; END;Q←SignedQuad[];IF Q#PostLoc THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "postamble pointer should be "]; PascalWriteInteger[file: @Output, item: PostLoc, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " not "]; PascalWriteInteger[file: @Output, item: Q, fieldMinLength: 1]};PascalWriteLn[file: @Output]; END; M←GetByte[];IF M#131 THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "identification byte should be "]; PascalWriteInteger[file: @Output, item: 131, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ", not "]; PascalWriteInteger[file: @Output, item: M, fieldMinLength: 1]};PascalWriteLn[file: @Output]; END; K←CurLoc;M←223;WHILE (M=223)AND NOT PascalEOF[file: @GfFile.baseFile]DO M←GetByte[] ENDLOOP ; IF NOT PascalEOF[file: @GfFile.baseFile] THEN BEGIN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLongString[file: @Output, item: "Bad GF file: "] ; PascalWriteLongString[file: @Output, item: "signature in byte "]; PascalWriteInteger[file: @Output, item: CurLoc-1, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " should be 223"]; PascalWriteLongString[file: @Output, item: "!"]};JumpOut[]; END ELSE IF CurLoc<K+4 THEN BEGIN {PascalWriteInteger[file: @Output, item: A, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: ": "]; PascalWriteLongString[file: @Output, item: "! "] ; PascalWriteLongString[file: @Output, item: "not enough signature bytes at end of file!"]};PascalWriteLn[file: @Output]; END;--:64-- END; END.