-- file: TexInitImpl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:36 am PDT DIRECTORY PascalBasic, PascalWizardFiles, TexTypes, TexInit, TexSysdep, TexSysdepInline, TexInteraction, TexMemory, TexSymbols, TexScan, TexDvi, TexOps, TexParagraph, TexBuildPage, TexRest; TexInitImpl: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, TexTypes, TexSysdep, TexSysdepInline, TexInteraction, TexMemory, TexSymbols, TexDvi, TexOps, TexParagraph, TexBuildPage, TexRest EXPORTS TexInit = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, TexTypes, TexInit, TexSysdep, TexSysdepInline, TexInteraction, TexMemory, TexSymbols, TexScan, TexDvi, TexOps, TexParagraph, TexBuildPage, TexRest; --:1399----13:-- Bad: PascalInteger; --:1400-- Initialize: PROCEDURE = BEGIN--19:--I:PascalInteger[0..255];--:19----163:--K:PascalInteger;--:163----927:--Z:HyphPointer;--:927 --8:----21:--Xchr↑[32]←' ;Xchr↑[33]←'!;Xchr↑[34]←'";Xchr↑[35]←'#; Xchr↑[36]←'$;Xchr↑[37]←'%;Xchr↑[38]←'&;Xchr↑[39]←'';Xchr↑[40]←'(; Xchr↑[41]←');Xchr↑[42]←'*;Xchr↑[43]←'+;Xchr↑[44]←',;Xchr↑[45]←'-; Xchr↑[46]←'.;Xchr↑[47]←'/;Xchr↑[48]←'0;Xchr↑[49]←'1;Xchr↑[50]←'2; Xchr↑[51]←'3;Xchr↑[52]←'4;Xchr↑[53]←'5;Xchr↑[54]←'6;Xchr↑[55]←'7; Xchr↑[56]←'8;Xchr↑[57]←'9;Xchr↑[58]←':;Xchr↑[59]←';;Xchr↑[60]←'<; Xchr↑[61]←'=;Xchr↑[62]←'>;Xchr↑[63]←'?;Xchr↑[64]←'@;Xchr↑[65]←'A; Xchr↑[66]←'B;Xchr↑[67]←'C;Xchr↑[68]←'D;Xchr↑[69]←'E;Xchr↑[70]←'F; Xchr↑[71]←'G;Xchr↑[72]←'H;Xchr↑[73]←'I;Xchr↑[74]←'J;Xchr↑[75]←'K; Xchr↑[76]←'L;Xchr↑[77]←'M;Xchr↑[78]←'N;Xchr↑[79]←'O;Xchr↑[80]←'P; Xchr↑[81]←'Q;Xchr↑[82]←'R;Xchr↑[83]←'S;Xchr↑[84]←'T;Xchr↑[85]←'U; Xchr↑[86]←'V;Xchr↑[87]←'W;Xchr↑[88]←'X;Xchr↑[89]←'Y;Xchr↑[90]←'Z; Xchr↑[91]←'[;Xchr↑[92]←'\\;Xchr↑[93]←'];Xchr↑[94]←'↑;Xchr↑[95]←'←; Xchr↑[96]←'`;Xchr↑[97]←'a;Xchr↑[98]←'b;Xchr↑[99]←'c;Xchr↑[100]←'d; Xchr↑[101]←'e;Xchr↑[102]←'f;Xchr↑[103]←'g;Xchr↑[104]←'h; Xchr↑[105]←'i;Xchr↑[106]←'j;Xchr↑[107]←'k;Xchr↑[108]←'l; Xchr↑[109]←'m;Xchr↑[110]←'n;Xchr↑[111]←'o;Xchr↑[112]←'p; Xchr↑[113]←'q;Xchr↑[114]←'r;Xchr↑[115]←'s;Xchr↑[116]←'t; Xchr↑[117]←'u;Xchr↑[118]←'v;Xchr↑[119]←'w;Xchr↑[120]←'x; Xchr↑[121]←'y;Xchr↑[122]←'z;Xchr↑[123]←'{;Xchr↑[124]←'|; Xchr↑[125]←'};Xchr↑[126]←'~;Xchr↑[0]←' ;Xchr↑[127]←' ;--:21----23: FOR i:INT IN [ INT[1 ].. INT[31 ]] DO I ← i; Xchr↑[I]←PascalCHR[I] ENDLOOP;--:23----24: FOR i:INT IN [ INT[0 ].. INT[255 ]] DO I ← i; Xord↑[PascalCHR[I]]←127 ENDLOOP; FOR i:INT IN [ INT[1 ].. INT[126 ]] DO I ← i; Xord↑[Xchr↑[I]]←I ENDLOOP;--:24----74:--Interaction←3;--:74----77: DeletionsAllowed←TRUE;ErrorCount←0;--:77----80:--HelpPtr←0; UseErrHelp←FALSE;--:80----97:--Interrupt←0;OkToInterrupt←TRUE;--:97 --166:--WasMemEnd←MemMin;WasLoMax←MemMin;WasHiMin←MemMax; Panicking←FALSE;--:166----215:--NestPtr←0;MaxNestStack←0; CurList.ModeField←1;CurList.HeadField←64999; CurList.TailField←64999;CurList.AuxField←-65536000; CurList.MlField←0;CurList.PgField←0;ShownMode←0;--991: PageContents←0;PageTail←64998;Mem[64998]↑.Hh.Rh←0;LastGlue←65515; LastPenalty←0;LastKern←0;PageSoFar↑[7]←0;PageMaxDepth←0--:991--; --:215----254:--FOR i:INT IN [ INT[4767 ].. INT[5476 ]] DO K ← i; XeqLevel↑[K]←1 ENDLOOP;--:254----257: NoNewControlSequence←TRUE;Hash↑[258].Lh←0;Hash↑[258].Rh←0; FOR i:INT IN [ INT[259 ].. INT[3024 ]] DO K ← i; Hash↑[K]←Hash↑[258] ENDLOOP;--:257----272:--SavePtr←0; CurLevel←1;CurGroup←0;CurBoundary←0;MaxSaveStack←0;--:272----287: MagSet←0;--:287----383:--CurMark↑[0]←0;CurMark↑[1]←0;CurMark↑[2]←0; CurMark↑[3]←0;CurMark↑[4]←0;--:383----439:--CurVal←0;CurValLevel←0; Radix←0;--:439----481:--FOR i:INT IN [ INT[0 ].. INT[16 ]] DO K ← i; ReadOpen↑[K]←2 ENDLOOP;--:481----490: CondPtr←0;IfLimit←0;CurIf←0;IfLine←0;--:490----551: FOR i:INT IN [ INT[0 ].. INT[FontMax ]] DO K ← i; FontUsed↑[K]←FALSE ENDLOOP;--:551----556: NullCharacter.B0←0;NullCharacter.B1←0;NullCharacter.B2←0; NullCharacter.B3←0;--:556----593:--TotalPages←0;MaxV←0;MaxH←0; MaxPush←0;LastBop←-1;DoingLeaders←FALSE;DeadCycles←0;--:593 --596:--HalfBuf← PascalDIVPower2[DviBufSize ,1];DviLimit←DviBufSize;DviPtr←0; DviOffset←0;DviGone←0;--:596----606:--DownPtr←0;RightPtr←0;--:606 --648:--AdjustTail←0;--:648----662:--PackBeginLine←0;--:662----685: EmptyField.Rh←0;EmptyField.Lh←0;NullDelimiter.B0←0; NullDelimiter.B1←0;NullDelimiter.B2←0;NullDelimiter.B3←0;--:685 --771:--AlignPtr←0;CurAlign←0;CurSpan←0;CurLoop←0;CurHead←0; CurTail←0;--:771----928:--FOR i:INT IN [ INT[0 ].. INT[307 ]] DO Z ← i; HyphWord↑[Z]←0; HyphList↑[Z]←0; ENDLOOP;HyphCount←0;--:928----990:--OutputActive←FALSE; InsertPenalties←0;--:990----1267:--AfterToken←0;--:1267----1282: LongHelpSeen←FALSE;--:1282----1300:--FormatIdent←0;--:1300----1343: FOR i:INT IN [ INT[0 ].. INT[17 ]] DO K ← i; WriteOpen↑[K]←FALSE ENDLOOP;--:1343 IF StartLikeInitex THEN BEGIN--164:-- FOR i:INT IN [ INT[1 ].. INT[19 ]] DO K ← i; Mem[K]↑.Int←0 ENDLOOP; K←0;WHILE K<=19 DO BEGIN Mem[K]↑.Hh.Rh←1;Mem[K]↑.Hh.B0←0; Mem[K]↑.Hh.B1←0;K←K+4; END ENDLOOP ;Mem[6]↑.Int←65536;Mem[4]↑.Hh.B0←1; Mem[10]↑.Int←65536;Mem[8]↑.Hh.B0←2;Mem[14]↑.Int←65536;Mem[12]↑.Hh.B0←1; Mem[15]↑.Int←65536;Mem[12]↑.Hh.B1←1;Mem[18]↑.Int←-65536; Mem[16]↑.Hh.B0←1;Rover←20;Mem[Rover]↑.Hh.Rh←65515; Mem[Rover]↑.Hh.Lh←1000;Mem[Rover+1]↑.Hh.Lh←Rover; Mem[Rover+1]↑.Hh.Rh←Rover;LoMemMax← INT[Rover]+1000; Mem[LoMemMax]↑.Hh.Rh←0;Mem[LoMemMax]↑.Hh.Lh←0; FOR i:INT IN [ INT[64987 ].. INT[65000 ]] DO K ← i; Mem[K]↑←Mem[LoMemMax]↑ ENDLOOP;--790: Mem[64990]↑.Hh.Lh←6859;--:790----797:--Mem[64991]↑.Hh.Rh←256; Mem[64991]↑.Hh.Lh←0;--:797----820:--Mem[64994]↑.Hh.B0←1; Mem[64995]↑.Hh.Lh←65515;Mem[64994]↑.Hh.B1←0;--:820----981: Mem[65000]↑.Hh.B1←255;Mem[65000]↑.Hh.B0←1;Mem[65000]↑.Hh.Rh←65000;--:981 --988:--Mem[64998]↑.Hh.B0←10;Mem[64998]↑.Hh.B1←0;--:988--Avail←0; MemEnd←65000;HiMemMin←64987;VarUsed←20;DynUsed←-12;--:164----222: Eqtb↑[3025].Hh.B0←100;Eqtb↑[3025].Hh.Rh←0;Eqtb↑[3025].Hh.B1←0; FOR i:INT IN [ INT[1 ].. INT[3024 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[3025] ENDLOOP;--:222----228:--Eqtb↑[3026].Hh.Rh←0; Eqtb↑[3026].Hh.B1←1;Eqtb↑[3026].Hh.B0←116; FOR i:INT IN [ INT[3027 ].. INT[3555 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[3026] ENDLOOP; Mem[0]↑.Hh.Rh← INT[Mem[0]↑.Hh.Rh]+530;--:228----232:--Eqtb↑[3556].Hh.Rh←0; Eqtb↑[3556].Hh.B0←117;Eqtb↑[3556].Hh.B1←1; FOR i:INT IN [ INT[3557 ].. INT[3821 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[3025] ENDLOOP;Eqtb↑[3822].Hh.Rh←0; Eqtb↑[3822].Hh.B0←118;Eqtb↑[3822].Hh.B1←1; FOR i:INT IN [ INT[3823 ].. INT[4077 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[3822] ENDLOOP;Eqtb↑[4078].Hh.Rh←0; Eqtb↑[4078].Hh.B0←119;Eqtb↑[4078].Hh.B1←1; FOR i:INT IN [ INT[4079 ].. INT[4126 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[4078] ENDLOOP;Eqtb↑[4127].Hh.Rh←0; Eqtb↑[4127].Hh.B0←119;Eqtb↑[4127].Hh.B1←1; FOR i:INT IN [ INT[4128 ].. INT[4766 ]] DO K ← i; Eqtb↑[K]←Eqtb↑[4127] ENDLOOP; FOR i:INT IN [ INT[0 ].. INT[127 ]] DO K ← i; Eqtb↑[4127+K].Hh.Rh←12;Eqtb↑[4639+K].Hh.Rh←K; Eqtb↑[4511+K].Hh.Rh←1000; ENDLOOP;Eqtb↑[4140].Hh.Rh←5;Eqtb↑[4159].Hh.Rh←10; Eqtb↑[4219].Hh.Rh←0;Eqtb↑[4164].Hh.Rh←14;Eqtb↑[4254].Hh.Rh←15; Eqtb↑[4127].Hh.Rh←9;FOR i:INT IN [ INT[48 ].. INT[57 ]] DO K ← i; Eqtb↑[4639+K].Hh.Rh←K+28672 ENDLOOP; FOR i:INT IN [ INT[65 ].. INT[90 ]] DO K ← i; Eqtb↑[4127+K].Hh.Rh←11; Eqtb↑[4127+K+32].Hh.Rh←11;Eqtb↑[4639+K].Hh.Rh←K+28928; Eqtb↑[4639+K+32].Hh.Rh←K+28960;Eqtb↑[4255+K].Hh.Rh←K+32; Eqtb↑[4255+K+32].Hh.Rh←K+32;Eqtb↑[4383+K].Hh.Rh←K; Eqtb↑[4383+K+32].Hh.Rh←K;Eqtb↑[4511+K].Hh.Rh←999; ENDLOOP;--:232----240: FOR i:INT IN [ INT[4767 ].. INT[5072 ]] DO K ← i; Eqtb↑[K].Int←0 ENDLOOP;Eqtb↑[4784].Int←1000; Eqtb↑[4768].Int←10000;Eqtb↑[4808].Int←1;Eqtb↑[4807].Int←25; Eqtb↑[4812].Int←92;Eqtb↑[4815].Int←13; FOR i:INT IN [ INT[0 ].. INT[127 ]] DO K ← i; Eqtb↑[5073+K].Int←-1 ENDLOOP;Eqtb↑[5119].Int←0;--:240----250: FOR i:INT IN [ INT[5201 ].. INT[5476 ]] DO K ← i; Eqtb↑[K].Int←0 ENDLOOP;--:250----258:--HashUsed←2758; CsCount←0;Eqtb↑[2767].Hh.B0←115;Hash↑[2767].Rh←364;--:258----552: FontPtr←0;FmemPtr←7;FontName↑[0]←658;FontArea↑[0]←210; HyphenChar↑[0]←45;SkewChar↑[0]←-1;FontBc↑[0]←1;FontEc↑[0]←0; FontSize↑[0]←0;FontDsize↑[0]←0;CharBase↑[0]←0;WidthBase↑[0]←0; HeightBase↑[0]←0;DepthBase↑[0]←0;ItalicBase↑[0]←0; LigKernBase↑[0]←0;KernBase↑[0]←0;ExtenBase↑[0]←0;FontGlue↑[0]←0; FontParams↑[0]←7;ParamBase↑[0]←-1; FOR i:INT IN [ INT[0 ].. INT[6 ]] DO K ← i; FontInfo↑[K].Int←0 ENDLOOP;--:552----952:--TrieOpPtr←0; Trie↑[0].Rh←0;Trie↑[0].B1←0;Trie↑[0].B0←0; FOR i:INT IN [ INT[1 ].. INT[127 ]] DO K ← i; Trie↑[K]←Trie↑[0] ENDLOOP;TrieMax←127;--:952----1216: Hash↑[2758].Rh←1043;--:1216----1301:--FormatIdent←1108;--:1301----1369: Hash↑[2766].Rh←1143;Eqtb↑[2766].Hh.B1←1;Eqtb↑[2766].Hh.B0←112; Eqtb↑[2766].Hh.Rh←0;--:1369-- END;--:8-- END;--57:-- InitTerminal: PROCEDURE RETURNS[InitTerminalResult: PascalBoolean] = BEGIN CmdBlank: PascalInteger =0;CmdOk: PascalInteger =1;CmdOverflow: PascalInteger =-1; CmdStatus:PascalInteger; ResetTermIn[@TermIn]; CmdStatus←StuffOnCmdLine[]; IF CmdStatus=CmdOverflow THEN Overflow[128,BufSize]; {IF CmdStatus=CmdOk THEN BEGIN InitTerminalResult←TRUE; GOTO Label10 ; END; WHILE TRUE DO BEGIN PascalWriteLongString[file: @TermOut, item: "**"];PascalTextBREAK[file: @TermOut]; IF NOT InputLn[@TermIn,TRUE] THEN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! End of file on the terminal... why?"]; InitTerminalResult←FALSE; GOTO Label10; END;CurInput.LocField←First; WHILE( INT[CurInput.LocField]<Last)AND (Buffer↑[CurInput.LocField]=32)DO CurInput.LocField←CurInput.LocField+1 ENDLOOP ; IF INT[CurInput.LocField]<Last THEN BEGIN InitTerminalResult←TRUE; GOTO Label10; END; {PascalWriteLongString[file: @TermOut, item: "Please type the name of your input file."]; PascalWriteLn[file: @TermOut]}; END ENDLOOP ;EXITS Label10 => NULL}; END; GetStringsStarted: PROCEDURE RETURNS[GetStringsStartedResult: PascalBoolean] = BEGIN K, L:PascalInteger[0..127]; M, N:PascalChar;G:StrNumber;A:PascalInteger;C:PascalBoolean; PoolPtr←0;StrPtr←0; StrStart↑[0]←0;--48:--FOR i:INT IN [ INT[0 ].. INT[127 ]] DO K ← i; IF(--49: ( INT[K]<32)OR ( INT[K]>126)--:49--) THEN BEGIN BEGIN StrPool↑[PoolPtr]←94; PoolPtr←PoolPtr+1; END;BEGIN StrPool↑[PoolPtr]←94; PoolPtr←PoolPtr+1; END;IF INT[K]<64 THEN BEGIN StrPool↑[PoolPtr]←K+64; PoolPtr←PoolPtr+1; END ELSE BEGIN StrPool↑[PoolPtr]←K-64; PoolPtr←PoolPtr+1; END; END ELSE BEGIN StrPool↑[PoolPtr]←K; PoolPtr←PoolPtr+1; END;G←MakeString[];--:48-- ENDLOOP;--51:--SetPoolName[]; {IF AOpenIn[@PoolFile] THEN BEGIN C←FALSE;DO--52: BEGIN IF PascalTextEOF[file: @PoolFile] THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "! TEX.POOL has no check sum."]; PascalWriteLn[file: @TermOut]};AClose[@PoolFile]; GetStringsStartedResult←FALSE; GOTO Label10; END;{M←PascalReadChar[file: @PoolFile]; N←PascalReadChar[file: @PoolFile]}; IF M='* THEN--53:--BEGIN A←0;K←1; {WHILE TRUE DO BEGIN IF( INT[Xord↑[N]]<48)OR ( INT[Xord↑[N]]>57) THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "! TEX.POOL check sum doesn't have nine digits."]; PascalWriteLn[file: @TermOut]}; AClose[@PoolFile];GetStringsStartedResult←FALSE; GOTO Label10; END; A←10*A+Xord↑[N]-48;IF K=9 THEN GOTO Label30;K←K+1;N←PascalReadChar[file: @PoolFile]; END ENDLOOP ; EXITS Label30 => NULL};IF A#94919885 THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "! TEX.POOL doesn't match; TANGLE me again."]; PascalWriteLn[file: @TermOut]}; AClose[@PoolFile];GetStringsStartedResult←FALSE; GOTO Label10; END;C←TRUE; END--:53 ELSE BEGIN IF( INT[Xord↑[M]]<48)OR ( INT[Xord↑[M]]>57)OR ( INT[Xord↑[N]]<48)OR ( INT[Xord↑[N]]>57) THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "! TEX.POOL line doesn't begin with two digits."]; PascalWriteLn[file: @TermOut]}; AClose[@PoolFile];GetStringsStartedResult←FALSE; GOTO Label10; END; L←Xord↑[M]*10+Xord↑[N]-48*11; IF INT[PoolPtr+L+StringVacancies]>PoolSize THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "! You have to increase POOLSIZE."]; PascalWriteLn[file: @TermOut]};AClose[@PoolFile]; GetStringsStartedResult←FALSE; GOTO Label10; END; FOR i:INT IN [ INT[1 ].. INT[L ]] DO K ← i; IF PascalTextEOLN[file: @PoolFile] THEN M←' ELSE M←PascalReadChar[file: @PoolFile];BEGIN StrPool↑[PoolPtr]←Xord↑[M];PoolPtr←PoolPtr+1; END; ENDLOOP; PascalReadLn[file: @PoolFile];G←MakeString[]; END; END--:52--; IF C THEN EXIT; ENDLOOP; AClose[@PoolFile];GetStringsStartedResult←TRUE; END ELSE BEGIN {PascalWriteLongString[file: @TermOut, item: "! I can't read TEX.POOL."]; PascalWriteLn[file: @TermOut]};AClose[@PoolFile]; GetStringsStartedResult←FALSE; GOTO Label10; END--:51--;EXITS Label10 => NULL}; END;--:47----66: InitPatternMemory: PROCEDURE = BEGIN H:PascalInteger[0..510];P:TriePointer; FOR i:INT IN [ INT[0 ].. INT[510 ]] DO H ← i; TrieOpHash↑[H]←0 ENDLOOP;TrieOpPtr←0;TrieL↑[0]←0; TrieC↑[0]←0;TriePtr←0;FOR i:INT IN [ INT[0 ].. INT[TrieSize ]] DO P ← i; TrieHash↑[P]←0 ENDLOOP; END; END.