-- file: TexScan3Impl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:37 am PDT DIRECTORY PascalBasic, PascalWizardFiles, TexSysdep, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexRest, TexSysdepInline; TexScan3Impl: PROGRAM IMPORTS PascalWizardFiles, TexSysdep, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexRest, TexSysdepInline EXPORTS TexScan = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, TexSysdep, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexRest, TexSysdepInline; --518:-- PrintFileName: PROCEDURE[N,A,E: PascalInteger] = BEGIN Print[A];Print[N]; Print[E]; END;--:518----699:-- NormalizeSelector: PROCEDURE = BEGIN IF INT[JobName]>0 THEN Selector←19 ELSE Selector←17; IF Interaction=0 THEN Selector←Selector-1; IF JobName=0 THEN OpenLogFile[]; END;--:92----98: ScanFontIdent: PROCEDURE = BEGIN F:InternalFontNumber;M:Halfword; --406:--DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP; IF CurCmd=87 THEN F←Eqtb↑[4078].Hh.Rh ELSE IF CurCmd=86 THEN F← CurChr ELSE IF CurCmd=85 THEN BEGIN M←CurChr;ScanFourBitInt[]; F←Eqtb↑[M+CurVal].Hh.Rh; END ELSE BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[674]; END;BEGIN HelpPtr←2;HelpLine↑[1]←675; HelpLine↑[0]←676; END;BackError[];F←0; END;CurVal←F; END;--:577----578: FindFontDimen: PROCEDURE[Writing: PascalBoolean] = BEGIN F:InternalFontNumber; N:PascalInteger; ScanInt[];N←CurVal;ScanFontIdent[];F←CurVal; IF N<=0 THEN CurVal←FmemPtr ELSE BEGIN IF Writing AND (N<=4)AND (N>=2) AND (FontGlue↑[F]#0) THEN BEGIN DeleteGlueRef[FontGlue↑[F]]; FontGlue↑[F]←0; END; IF N>FontParams↑[F] THEN IF INT[F]<FontPtr THEN CurVal←FmemPtr ELSE--580: BEGIN DO IF FmemPtr=FontMemSize THEN Overflow[681,FontMemSize]; FontInfo↑[FmemPtr].Int←0;FmemPtr←FmemPtr+1; FontParams↑[F]←FontParams↑[F]+1; IF N=FontParams↑[F] THEN EXIT; ENDLOOP; CurVal←FmemPtr-1; END--:580-- ELSE CurVal←N+ParamBase↑[F]; END;--579: IF CurVal=FmemPtr THEN BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[659]; END;PrintEsc[Hash↑[2768+F].Rh];Print[677]; PrintInt[FontParams↑[F]];Print[678];BEGIN HelpPtr←2; HelpLine↑[1]←679;HelpLine↑[0]←680; END;Error[]; END--:579--; END;--:578----:409 MoreName: PROCEDURE[C: AsciiCode] RETURNS[MoreNameResult: PascalBoolean] = BEGIN IF C=32 THEN MoreNameResult←FALSE ELSE BEGIN IF(C=62)OR (C=47)OR (C=93) THEN AreaDelimiter←PoolPtr ELSE IF(C=46) THEN ExtDelimiter←PoolPtr; BEGIN IF INT[PoolPtr+1]>PoolSize THEN Overflow[129,PoolSize-InitPoolPtr] ; END;BEGIN StrPool↑[PoolPtr]←C;PoolPtr←PoolPtr+1; END; MoreNameResult←TRUE; END; END;--:516----517:-- EndName: PROCEDURE = BEGIN IF INT[StrPtr+3]>MaxStrings THEN Overflow[130, MaxStrings-InitStrPtr]; IF AreaDelimiter=0 THEN CurArea←210 ELSE BEGIN CurArea←StrPtr; StrPtr←StrPtr+1;StrStart↑[StrPtr]←AreaDelimiter+1; END; IF ExtDelimiter=0 THEN BEGIN CurExt←210;CurName←MakeString[]; END ELSE BEGIN CurName←StrPtr;StrPtr←StrPtr+1; StrStart↑[StrPtr]←ExtDelimiter;CurExt←MakeString[]; END; END;--:517 --519:-- PackFileName: PROCEDURE[N,A,E: StrNumber] = BEGIN K:PascalInteger; C:AsciiCode;J:PoolPointer; K←0; FOR i:INT IN [ INT[StrStart↑[A]].. INT[ INT[StrStart↑[A+1]]-1 ]] DO J ← i; C←StrPool↑[J];K←K+1; IF K<=FileNameSize THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP; FOR i:INT IN [ INT[StrStart↑[N]].. INT[ INT[StrStart↑[N+1]]-1 ]] DO J ← i; C←StrPool↑[J];K←K+1; IF K<=FileNameSize THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP; FOR i:INT IN [ INT[StrStart↑[E]].. INT[ INT[StrStart↑[E+1]]-1 ]] DO J ← i; C←StrPool↑[J];K←K+1; IF K<=FileNameSize THEN NameOfFile↑[K]←Xchr↑[C]; ENDLOOP; IF K<=FileNameSize THEN NameLength←K ELSE NameLength← FileNameSize; FOR i:INT IN [ INT[NameLength+1 ].. INT[FileNameSize ]] DO K ← i; NameOfFile↑[K]←' ENDLOOP; END; --:523----525: MakeNameString: PROCEDURE RETURNS[MakeNameStringResult: StrNumber] = BEGIN K:PascalInteger[1..FileNameSize]; BEGIN IF INT[PoolPtr+NameLength]>PoolSize THEN Overflow[129, PoolSize-InitPoolPtr]; END; FOR i:INT IN [ INT[1 ].. INT[NameLength ]] DO K ← i; StrPool↑[PoolPtr]←Xord↑[NameOfFile↑[K ]];PoolPtr←PoolPtr+1; ENDLOOP;MakeNameStringResult←MakeString[]; END; --:525----526: ScanFileName: PROCEDURE = BEGIN NameInProgress←TRUE; BeginName[];--406:--DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP; {WHILE TRUE DO BEGIN IF( INT[CurCmd]>12)OR ( INT[CurChr]>127) THEN BEGIN BackInput[]; GOTO Label30; END;IF NOT MoreName[CurChr] THEN GOTO Label30;GetXToken[]; END ENDLOOP ; EXITS Label30 => NULL};EndName[];NameInProgress←FALSE; END;--:526----529: PackJobName: PROCEDURE[S: StrNumber] = BEGIN CurArea←210;CurExt←S; CurName←JobName;PackFileName[CurName,CurArea,CurExt]; END;--:529 --530:-- PromptFileName: PROCEDURE[S,E: StrNumber] = BEGIN K:PascalInteger[0..BufSize]; IF Interaction=2 THEN NULL; IF S=643 THEN BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[644]; END ELSE BEGIN IF Interaction=3 THEN NULL;PrintNl[134];Print[645]; END; PrintFileName[CurName,CurArea,CurExt];Print[646]; IF E=647 THEN ShowContext[];PrintNl[648];Print[S]; IF INT[Interaction]<2 THEN FatalError[649];BEGIN Print[430];TermInput[]; END; --531:--BEGIN BeginName[];K←First;WHILE(Buffer↑[K]=32)AND ( INT[K]<Last)DO K←K+1 ENDLOOP ; {WHILE TRUE DO BEGIN IF K=Last THEN GOTO Label30; IF NOT MoreName[Buffer↑[K]] THEN GOTO Label30;K←K+1; END ENDLOOP ;EXITS Label30 => NULL};EndName[]; END--:531 ;IF CurExt=210 THEN CurExt←E; PackFileName[CurName,CurArea,CurExt]; END;--:530----534: OpenLogFile: PROCEDURE = BEGIN OldSetting:PascalInteger[0..21];K:PascalInteger[0..BufSize]; L:PascalInteger[0..BufSize];Months: PACKED ARRAY PascalInteger[1..36] OF PascalChar; OldSetting←Selector;IF JobName=0 THEN JobName←653; PackJobName[654];WHILE NOT AOpenOut[@LogFile]DO--535: BEGIN IF INT[Interaction]<2 THEN BEGIN BEGIN IF Interaction=3 THEN NULL; PrintNl[134];Print[645]; END;PrintFileName[CurName,CurArea,CurExt]; Print[646];JobName←0;History←3;JumpOut[]; END; PromptFileName[656,654]; END--:535-- ENDLOOP ; LogName←AMakeNameString[@LogFile];Selector←18;--536: BEGIN PascalWriteLongString[file: @LogFile, item: "This is TeX 1.3 for Cedar 6.0"]; Print[FormatIdent];Print[657];PrintInt[Eqtb↑[4788].Int];PrintChar[32]; Months←['J, 'A, 'N, 'F, 'E, 'B, 'M, 'A, 'R, 'A, 'P, 'R, 'M, 'A, 'Y, 'J, 'U, 'N, 'J, 'U, 'L, 'A, 'U, 'G, 'S, 'E, 'P, 'O, 'C, 'T, 'N, 'O, 'V, 'D, 'E, 'C]; FOR i:INT IN [ INT[3*Eqtb↑[4789].Int-2 ].. INT[3*Eqtb↑[4789].Int ]] DO K ← i; PascalWriteChar[file: @LogFile, item: Months[K ]] ENDLOOP;PrintChar[32];PrintInt[Eqtb↑[4790].Int];PrintChar[32]; PrintTwo[ Eqtb↑[4787].Int /60];PrintChar[58]; PrintTwo[ Eqtb↑[4787].Int MOD 60]; END--:536--; InputStack↑[InputPtr]←CurInput;PrintNl[655]; L←InputStack↑[0].LimitField;IF Buffer↑[L]=Eqtb↑[4815].Int THEN L←L-1; FOR i:INT IN [ INT[1 ].. INT[L ]] DO K ← i; Print[Buffer↑[K]] ENDLOOP;PrintLn[];Selector←OldSetting+2; END; --:534----537:-- StartInput: PROCEDURE = BEGIN ScanFileName[]; IF CurExt=210 THEN CurExt←647; PackFileName[CurName,CurArea,CurExt]; {WHILE TRUE DO BEGIN BeginFileReading[]; IF AOpenIn[@InputFile↑[CurInput.IndexField]] THEN GOTO Label30; PackFileName[CurName,TexArea,CurExt]; IF AOpenIn[@InputFile↑[CurInput.IndexField]] THEN GOTO Label30; EndFileReading[];PromptFileName[643,647]; END ENDLOOP ; EXITS Label30 => NULL};CurInput.NameField←AMakeNameString[@InputFile↑[CurInput. IndexField]];IF JobName=0 THEN BEGIN JobName←CurName;OpenLogFile[]; END; IF TermOffset+( INT[StrStart↑[CurInput.NameField+1]]-StrStart↑[CurInput. NameField])>MaxPrintLine-2 THEN PrintLn [] ELSE IF( INT[TermOffset]>0)OR ( INT[FileOffset]>0) THEN PrintChar[32];PrintChar[40]; Print[CurInput.NameField];PascalTextBREAK[file: @TermOut];CurInput.StateField←33; IF CurInput.NameField=StrPtr-1 THEN BEGIN BEGIN StrPtr←StrPtr-1; PoolPtr←StrStart↑[StrPtr]; END;CurInput.NameField←CurName; END; --538: BEGIN IF NOT InputLn[@InputFile↑[CurInput.IndexField],FALSE] THEN NULL; FirmUpTheLine[]; IF(Eqtb↑[4815].Int<0)OR (Eqtb↑[4815].Int>127) THEN CurInput.LimitField← INT[CurInput.LimitField]-1 ELSE Buffer↑[CurInput.LimitField]←Eqtb↑[4815]. Int;First←CurInput.LimitField+1; CurInput.LocField←CurInput.StartField;Line←1; END--:538--; END;--:537 CharWarning: PROCEDURE[F: InternalFontNumber,C: EightBits] = BEGIN IF Eqtb↑[4802].Int>0 THEN BEGIN BeginDiagnostic[];PrintNl[682]; PrintAscii[C];Print[683];Print[FontName↑[F]];PrintChar[33]; EndDiagnostic[FALSE]; END; END;--:581----582: NewCharacter: PROCEDURE[F: InternalFontNumber,C: EightBits] RETURNS[NewCharacterResult: Halfword] = BEGIN P:Halfword; {IF( INT[FontBc↑[F]]<=C)AND ( INT[FontEc↑[F]]>=C) THEN IF( INT[FontInfo↑[ CharBase↑[F]+C].Qqqq.B0]>0) THEN BEGIN P←GetAvail[];Mem[P]↑.Hh.B0←F;Mem[P]↑.Hh.B1←C; NewCharacterResult←P; GOTO Label10; END;CharWarning[F,C];NewCharacterResult←0;EXITS Label10 => NULL}; END; OpenFmtFile: PROCEDURE RETURNS[OpenFmtFileResult: PascalBoolean] = BEGIN J:PascalInteger[0..BufSize]; {{IF Buffer↑[CurInput.LocField]=38 THEN BEGIN CurInput.LocField← CurInput.LocField+1;J←CurInput.LocField;Buffer↑[Last]←32; WHILE Buffer↑[J]#32 DO J←J+1 ENDLOOP ; PackBufferedName[CurInput.LocField,J-1]; IF WOpenIn[@FmtFile] THEN BEGIN CurInput.LocField←J; GOTO Label40; END; PackDefaultArea[CurInput.LocField,J-1]; IF WOpenIn[@FmtFile] THEN BEGIN CurInput.LocField←J; GOTO Label40; END;{PascalWriteLongString[file: @TermOut, item: "Sorry, I can't find that format;"] ; PascalWriteLongString[file: @TermOut, item: " will try your default."]; PascalWriteLn[file: @TermOut]}; END;PackAllDefault[]; IF NOT WOpenIn[@FmtFile] THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "I can't find your default format file!"]; PascalWriteLn[file: @TermOut]}; OpenFmtFileResult←FALSE; GOTO Label10; END;EXITS Label40 => NULL};OpenFmtFileResult←TRUE;EXITS Label10 => NULL}; END;--:524 END.