-- file: TexMaincontrolImpl.mesa -- Pascal-to-Mesa translator output, translated at September 27, 1985 10:21:38 am PDT DIRECTORY PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexExtensions, TexSysdepInline; TexMaincontrolImpl: PROGRAM IMPORTS PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexExtensions, TexSysdepInline EXPORTS TexRest = PUBLIC BEGIN OPEN PascalBasic, TexTypes, TexInteraction, TexMemory, TexSymbols, TexScan, TexOps, TexBuildPage, TexMath, TexRest, TexExtensions, TexSysdepInline; --:950----971: BestHeightPlusDepth: Scaled; --:971----980:-- PageTail: Halfword; PageContents: PascalInteger[0..2]; BestPageBreak: Halfword; BestSize: Scaled; --:980----982: PageSoFar: LONG POINTER TO ARRAY PascalInteger[0..7] OF Scaled ← PascalStaticZone.NEW[ARRAY PascalInteger[0..7] OF Scaled]; --:982 --989:-- OutputActive: PascalBoolean; --:989----1074:-- CurBox: Halfword; --:1281----1299: FormatIdent: StrNumber; --:1299----1305:-- FmtFile: WordFile; --:1305----1331: StartLikeInitex: PascalBoolean; --:1331----1342: WriteFile: LONG POINTER TO ARRAY PascalInteger[0..15] OF AlphaFile ← PascalStaticZone.NEW[ARRAY PascalInteger[0..15] OF AlphaFile]; WriteOpen: LONG POINTER TO ARRAY PascalInteger[0..17] OF PascalBoolean ← PascalStaticZone.NEW[ARRAY PascalInteger[0..17] OF PascalBoolean]; --:1342----1345:-- WriteLoc: Halfword; MainControl: PROCEDURE = BEGIN T:PascalInteger; --1032:--L:Quarterword;C:EightBits;F:InternalFontNumber;R:Halfword; P:Halfword;K:PascalInteger[0..FontMemSize];Q:Halfword;I:FourQuarters; J:FourQuarters;S:PascalInteger;LigaturePresent:PascalBoolean;--:1032 IF Eqtb↑[3563].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3563].Hh.Rh,12]; DO {--Label60:--GetXToken[];DO {--Label21:----1031: IF Interrupt#0 THEN IF OkToInterrupt THEN BEGIN BackInput[]; BEGIN IF Interrupt#0 THEN PauseForInstructions[]; END; GOTO Label60; END; IF Panicking THEN CheckMem[FALSE]; IF Eqtb↑[4803].Int>0 THEN ShowCurCmdChr--:1031--[]; {{{SELECT ABS[CurList.ModeField]+CurCmd FROM 112,113,168 => GOTO Label70; 117 =>BEGIN ScanCharNum[];CurChr←CurVal; GOTO Label70; END; 111 =>IF CurList.AuxField=1000 THEN GOTO Label74 ELSE AppSpace[]; 165,265 => GOTO Label74;--1045:--1,101,201,11,211 => NULL;40,140,240 =>BEGIN--406: DO GetXToken[]; IF CurCmd#10--:406-- THEN EXIT; ENDLOOP; GOTO Label21; END; 15 =>IF ItsAllOver [] THEN GOTO Label10;--1048:--23,122,222,70,170,270,--:1048 --1098:--39,--:1098----1111:--45,--:1111----1144:--49,149,--:1144 7,107,207 =>ReportIllegalCase[];--1046: 8,108,9,109,18,118,69,169,51,151,16,116,50,150,53,153,66,166,54,154,55, 155,57,157,56,156,31,131,52,152,29,129,47,147,210,214,215,228,225,234, 237--:1046-- =>InsertDollarSign[];--1056: 37,136,236 =>BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←ScanRuleSpec[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; IF ABS[CurList.ModeField]=1 THEN CurList.AuxField←-65536000 ELSE IF ABS[CurList.ModeField]=101 THEN CurList.AuxField←1000; END;--:1056 --1057:--28,127,227,229 =>AppendGlue[];30,130,230,231 =>AppendKern[];--:1057 --1063:--2,102 =>NewSaveLevel[1];62,162,262 =>NewSaveLevel[14]; 63,163,263 =>IF CurGroup=14 THEN Unsave [] ELSE OffSave[];--:1063----1067: 3,103,203 =>HandleRightBrace[];--:1067----1073:--22,123,223 =>BEGIN T←CurChr; ScanDimen[FALSE,FALSE,FALSE]; IF T=0 THEN SaveStack↑[SavePtr+0].Int←CurVal ELSE SaveStack↑[SavePtr +0].Int←-CurVal;ScanBox[]; END; 32,132,232 =>BEGIN SaveStack↑[SavePtr+0].Int←1073742237+CurChr; ScanBox[]; END;21,121,221 =>BEGIN SaveStack↑[SavePtr+0].Int←0;BeginBox[]; END;--:1073----1090:--44 =>NewGraf[ INT[CurChr]>0]; 12,13,17,68,4,24,36,46,48,27,34,65 =>BEGIN BackInput[];NewGraf[TRUE]; END; --:1090----1092:--144,244 =>IndentInHmode[];--:1092----1094: 14 =>BEGIN NormalParagraph[];IF INT[CurList.ModeField]>0 THEN BuildPage[]; END; 114 =>BEGIN IF AlignState<0 THEN OffSave[];EndGraf[]; IF CurList.ModeField=1 THEN BuildPage[]; END; 115,128,137,125,133 =>HeadForVmode[];--:1094----1097: 38,138,238,139,239 =>BeginInsertOrAdjust[];19,119,219 =>MakeMark[];--:1097 --1102:--43,143,243 =>AppendPenalty[];--:1102----1104:--26,126,226 =>DeleteLast[]; --:1104----1109:--25,124,224 =>Unpackage[];--:1109----1112: 145 =>AppendItalicCorrection[]; 245 =>BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewKern[0]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END;--:1112----1116: 148,248 =>AppendDiscretionary[];--:1116----1122:--146 =>MakeAccent[];--:1122 --1126:--6,106,206,5,105,205 =>AlignError[];35,135,235 =>NoAlignError[]; 64,164,264 =>OmitError[];--:1126----1130:--33,134 =>InitAlign[]; 233 =>IF Privileged [] THEN InitAlign[];10,110 =>DoEndv[];--:1130----1134: 67,167,267 =>CsError[];--:1134----1137:--104 =>InitMath[];--:1137----1140: 249 =>IF Privileged [] THEN StartEqNo[];--:1140----1150: 202 =>BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewNoad[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END;BackInput[]; ScanMath[CurList.TailField+1]; END;--:1150----1154: 212,213,268 =>IF INT[CurChr]<128 THEN SetMathChar[Eqtb↑[ INT[4639]+CurChr].Hh.Rh] ELSE SetMathChar[CurChr];217 =>BEGIN ScanCharNum[];CurChr←CurVal; IF INT[CurChr]<128 THEN SetMathChar[Eqtb↑[ INT[4639]+CurChr].Hh.Rh] ELSE SetMathChar[CurChr]; END;218 =>BEGIN ScanFifteenBitInt[]; SetMathChar[CurVal]; END;269 =>SetMathChar[CurChr]; 216 =>BEGIN ScanTwentySevenBitInt[];SetMathChar[ PascalDIVPower2[CurVal ,12]]; END; --:1154----1158:--251 =>BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewNoad[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B0←CurChr; ScanMath[CurList.TailField+1]; END;252 =>MathLimitSwitch[];--:1158 --1162:--266 =>MathRadical[];--:1162----1164:--246,247 =>MathAc[];--:1164----1167: 257 =>BEGIN ScanSpec[];NewSaveLevel[12];NormalParagraph[];PushNest[]; CurList.ModeField←-1;CurList.AuxField←-65536000; IF Eqtb↑[3562].Hh.Rh#0 THEN BeginTokenList[Eqtb↑[3562].Hh.Rh,11]; END; --:1167----1171: 254 =>BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewStyle[CurChr]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; 256 =>BEGIN BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewGlue[0]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END; Mem[CurList.TailField]↑.Hh.B1←98; END;255 =>AppendChoices[];--:1171----1175: 209,208 =>SubSup[];--:1175----1180:--253 =>MathFraction[];--:1180----1190: 250 =>MathLeftRight[];--:1190----1193: 204 =>IF CurGroup=15 THEN AfterMath [] ELSE OffSave[];--:1193----1210: 71,171,271,72,172,272,73,173,273,74,174,274,75,175,275,76,176,276,77,177 ,277,78,178,278,79,179,279,80,180,280,81,181,281,82,182,282,83,183,283, 84,184,284,85,185,285,86,186,286,87,187,287,88,188,288,89,189,289,90,190 ,290,91,191,291,92,192,292,93,193,293,94,194,294,95,195,295,96,196,296, 97,197,297,98,198,298,99,199,299,100,200,300 =>PrefixedCommand[];--:1210 --1268:--41,141,241 =>BEGIN GetToken[];AfterToken←CurTok; END;--:1268 --1271:--42,142,242 =>BEGIN GetToken[];SaveForAfter[CurTok]; END;--:1271 --1274:--61,161,261 =>OpenOrCloseIn[];--:1274----1276: 59,159,259 =>IssueMessage[];--:1276----1285:--58,158,258 =>ShiftCase[];--:1285 --1290:--20,120,220 =>ShowWhatever[];--:1290----1347:--60,160,260 =>DoExtension[]; --:1347----:1045-- ENDCASE; GOTO Label60;EXITS Label70 => NULL};--1033:--F←Eqtb↑[4078].Hh.Rh;C←CurChr; DO {--Label71:--IF( INT[C]<FontBc↑[F])OR ( INT[C]>FontEc↑[F]) THEN BEGIN CharWarning[F,C]; GOTO Label60; END;DO {--Label72:--Q←CurList.TailField;LigaturePresent←FALSE;L←C;DO {--Label73:----1034: IF INT[C]<128 THEN BEGIN S←Eqtb↑[4511+C].Hh.Rh; IF S=1000 THEN CurList.AuxField←1000 ELSE IF S<1000 THEN BEGIN IF S>0 THEN CurList.AuxField←S; END ELSE IF CurList.AuxField<1000 THEN CurList.AuxField←1000 ELSE CurList.AuxField←S; END ELSE CurList.AuxField←1000--:1034--;--1035: I←FontInfo↑[CharBase↑[F]+L].Qqqq;IF( INT[I.B0]>0) THEN BEGIN BEGIN P←Avail; IF P=0 THEN P←GetAvail [] ELSE BEGIN Avail←Mem[P]↑.Hh.Rh;Mem[P]↑.Hh.Rh←0; DynUsed←DynUsed+1; END; END;Mem[P]↑.Hh.B0←F;Mem[P]↑.Hh.B1←C; Mem[CurList.TailField]↑.Hh.Rh←P;CurList.TailField←P; END ELSE CharWarning[F,L];--1036:--GetNext[]; IF CurCmd=11 THEN R←CurChr ELSE IF CurCmd=12 THEN R←CurChr ELSE IF CurCmd=67 THEN R←CurChr ELSE BEGIN XToken[]; IF(CurCmd=11)OR (CurCmd=12)OR (CurCmd=67) THEN R←CurChr ELSE IF CurCmd=16 THEN BEGIN ScanCharNum[];R←CurVal; END ELSE R←256; END; IF( PascalMODPower2Mask[(I.B2),3])=1 THEN IF R#256 THEN--1037: BEGIN K←LigKernBase↑[F]+I.B3;DO J←FontInfo↑[K].Qqqq; IF J.B1=R THEN IF INT[J.B2]<128 THEN--1040:--BEGIN LigaturePresent←TRUE; L←J.B3;C←R; GOTO Label73; END--:1040-- ELSE--1038:--BEGIN--1039: IF LigaturePresent THEN BEGIN P←NewLigature[F,L,Mem[Q]↑.Hh.Rh]; Mem[Q]↑.Hh.Rh←P;CurList.TailField←P; END; IF C=HyphenChar↑[F] THEN IF CurList.ModeField=101 THEN BEGIN Mem[ CurList.TailField]↑.Hh.Rh←NewDisc[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END--:1039--; BEGIN Mem[CurList.TailField]↑.Hh.Rh←NewKern[FontInfo↑[KernBase↑[F]+J. B3].Int];CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END;C←R; GOTO Label72; END--:1038--;K←K+1; IF INT[J.B0]>=128 THEN EXIT; ENDLOOP; END--:1037--;--1039: IF LigaturePresent THEN BEGIN P←NewLigature[F,L,Mem[Q]↑.Hh.Rh]; Mem[Q]↑.Hh.Rh←P;CurList.TailField←P; END; IF C=HyphenChar↑[F] THEN IF CurList.ModeField=101 THEN BEGIN Mem[ CurList.TailField]↑.Hh.Rh←NewDisc[]; CurList.TailField←Mem[CurList.TailField]↑.Hh.Rh; END--:1039--; IF R=256 THEN GOTO Label21;C←R; GOTO Label71--:1036----:1035----:1033--;EXIT; EXITS Label73 => NULL} ENDLOOP;EXIT; EXITS Label72 => NULL} ENDLOOP;EXIT; EXITS Label71 => NULL} ENDLOOP;EXITS Label74 => NULL};--1041: IF Eqtb↑[3038].Hh.Rh=0 THEN BEGIN--1042: BEGIN P←FontGlue↑[Eqtb↑[4078].Hh.Rh]; IF P=0 THEN BEGIN F←Eqtb↑[4078].Hh.Rh;P←NewSpec[0];K←ParamBase↑[F]+2; Mem[P+1]↑.Int←FontInfo↑[K].Int;Mem[P+2]↑.Int←FontInfo↑[K+1].Int; Mem[P+3]↑.Int←FontInfo↑[K+2].Int;FontGlue↑[F]←P; END; END--:1042--; Q←NewGlue[P]; END ELSE Q←NewParamGlue[12]; Mem[CurList.TailField]↑.Hh.Rh←Q;CurList.TailField←Q; GOTO Label60--:1041--; EXITS Label10 => NULL};EXIT; EXITS Label21 => NULL} ENDLOOP;EXIT; EXITS Label60 => NULL} ENDLOOP; END;--:1030----1284:-- END.