-- file: MFFinalizeImpl.mesa -- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:03 pm PST DIRECTORY PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFExternals, MFInteraction, MFMath, MFMemory, MFSymbols, MFInput, MFFileNames, MFOps, MFTFM, MFGF, MFRest, MFOctants; MFFinalizeImpl: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, MFProcArray, MFExternals, MFInteraction, MFMath, MFMemory, MFSymbols, MFInput, MFFileNames, MFOps, MFTFM, MFGF, MFRest, MFOctants EXPORTS MFRest = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFExternals, MFInteraction, MFMath, MFMemory, MFSymbols, MFInput, MFFileNames, MFOps, MFTFM, MFGF, MFRest, MFOctants; CloseFilesAndTerminate: PROCEDURE = BEGIN K:PascalInteger;Lh:PascalInteger;P:Halfword; X:Scaled; TfmFinishUpTheFile: PROCEDURE = BEGIN--1133: IF JobName=0 THEN OpenLogFile[];PackJobName[902]; WHILE NOT BOpenOut[@TfmFile]DO PromptFileName[903,902] ENDLOOP ; MetricFileName←BMakeNameString[@TfmFile];--1134:--K←HeaderSize; WHILE INT[HeaderByte↑[K]]<0 DO K←K-1 ENDLOOP ;Lh← PascalDIVPower2[(K+3),2];IF INT[Bc]>Ec THEN Bc←1; TfmTwo[6+Lh+(Ec-Bc+1)+Nw+Nh+Nd+Ni+Nl+Nk+Ne+Np];TfmTwo[Lh];TfmTwo[Bc]; TfmTwo[Ec];TfmTwo[Nw];TfmTwo[Nh];TfmTwo[Nd];TfmTwo[Ni];TfmTwo[Nl]; TfmTwo[Nk];TfmTwo[Ne];TfmTwo[Np]; FOR i:INT IN [ INT[1 ].. INT[4*Lh ]] DO K ← i; IF INT[HeaderByte↑[K]]<0 THEN HeaderByte↑[K]←0; {grossExprHack:EightBits ← HeaderByte↑[K]; PascalWriteLong[file: @TfmFile.baseFile, length: SIZE[EightBits, 2], element: @TfmFile.element, item: @grossExprHack]};--:1134-- ENDLOOP;--1136: FOR i:INT IN [ INT[Bc ].. INT[Ec ]] DO K ← i; IF NOT CharExists↑[K] THEN TfmFour[0] ELSE BEGIN {grossExprHack:EightBits ← Mem[TfmWidth↑[K]]↑.Hh.Lh; PascalWriteLong[file: @TfmFile.baseFile, length: SIZE[EightBits, 2], element: @TfmFile.element, item: @grossExprHack]}; {grossExprHack:EightBits ← INT[(Mem[TfmHeight↑[K]]↑.Hh.Lh)]*16+Mem[TfmDepth↑[K]]↑.Hh.Lh; PascalWriteLong[file: @TfmFile.baseFile, length: SIZE[EightBits, 2], element: @TfmFile.element, item: @grossExprHack]}; {grossExprHack:EightBits ← INT[(Mem[TfmItalCorr↑[K]]↑.Hh.Lh)]*4+CharTag↑[K]; PascalWriteLong[file: @TfmFile.baseFile, length: SIZE[EightBits, 2], element: @TfmFile.element, item: @grossExprHack]}; {grossExprHack:EightBits ← CharRemainder↑[K]; PascalWriteLong[file: @TfmFile.baseFile, length: SIZE[EightBits, 2], element: @TfmFile.element, item: @grossExprHack]}; END--:1136-- ENDLOOP;--1137:--TfmChanged←0; FOR i:INT IN [ INT[1 ].. INT[4 ]] DO K ← i; TfmFour[0];P←DimenHead↑[K]; WHILE P#19 DO BEGIN TfmFour[DimenOut[Mem[ INT[P]+1]↑.Int]];P←Mem[P]↑.Hh.Rh; END ENDLOOP ;--:1137-- ENDLOOP;--1138:--FOR i:INT IN [ INT[0 ].. INT[Nl-1 ]] DO K ← i; TfmQqqq[LigKern↑[K]] ENDLOOP; FOR i:INT IN [ INT[0 ].. INT[Nk-1 ]] DO K ← i; TfmFour[DimenOut[Kern↑[K]]]--:1138-- ENDLOOP;--1139: FOR i:INT IN [ INT[0 ].. INT[Ne-1 ]] DO K ← i; TfmQqqq[Exten↑[K]]--:1139-- ENDLOOP;--1140: FOR i:INT IN [ INT[1 ].. INT[Np ]] DO K ← i; IF K=1 THEN IF ABS[Param↑[1]]<134217728 THEN TfmFour[ Param↑[1]*16] ELSE BEGIN TfmChanged←TfmChanged+1; IF Param↑[1]>0 THEN TfmFour[2147483647] ELSE TfmFour[-2147483647]; END ELSE TfmFour[DimenOut[Param↑[K]]] ENDLOOP; IF TfmChanged>0 THEN BEGIN IF TfmChanged=1 THEN PrintNl[905] ELSE BEGIN PrintNl[40];PrintInt[TfmChanged];Print[906]; END;Print[907]; END--:1140--;IF Internal↑[12]>0 THEN--1135:--BEGIN {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: "(You used "]; PascalWriteInteger[file: @LogFile, item: Nw, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "w,"]; PascalWriteInteger[file: @LogFile, item: Nh, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "h,"]; PascalWriteInteger[file: @LogFile, item: Nd, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "d,"]; PascalWriteInteger[file: @LogFile, item: Ni, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "i,"]; PascalWriteInteger[file: @LogFile, item: Nl , fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "l,"]; PascalWriteInteger[file: @LogFile, item: Nk, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "k,"]; PascalWriteInteger[file: @LogFile, item: Ne, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "e,"]; PascalWriteInteger[file: @LogFile, item: Np, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "p metric file positions"]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " out of "]; PascalWriteLongString[file: @LogFile, item: "256w,16h,16d,64i,"]; PascalWriteInteger[file: @LogFile, item: LigTableSize, fieldMinLength: 1] ; PascalWriteLongString[file: @LogFile, item: "l,256k,256e,"]; PascalWriteInteger[file: @LogFile, item: MaxFontDimen, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "p)"]; PascalWriteLn[file: @LogFile]}; END--:1135--;PrintNl[904]; Print[MetricFileName];BClose[@TfmFile]--:1133--; END; GfFinishUpTheFile: PROCEDURE = BEGIN--1181: BEGIN BEGIN GfBuf↑[GfPtr]←248;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;GfFour[GfPrevPtr]; GfPrevPtr←GfOffset+GfPtr-5;GfFour[Internal↑[26]*16]; FOR i:INT IN [ INT[1 ].. INT[4 ]] DO K ← i; GfBuf↑[GfPtr]←HeaderByte↑[K];GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; ENDLOOP;GfFour[Internal↑[27]]; GfFour[Internal↑[28]];GfFour[GfMinM];GfFour[GfMaxM]; GfFour[GfMinN];GfFour[GfMaxN]; FOR i:INT IN [ INT[0 ].. INT[255 ]] DO K ← i; IF CharExists↑[K] THEN BEGIN X← PascalDIVPower2[GfDx↑[K],16]; IF(GfDy↑[K]=0)AND (X>=0)AND (X<256)AND (GfDx↑[K]=X*65536) THEN BEGIN BEGIN GfBuf↑[GfPtr]←246;GfPtr←GfPtr+1;IF GfPtr=GfLimit THEN GfSwap[]; END;BEGIN GfBuf↑[GfPtr]←K;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;BEGIN GfBuf↑[GfPtr]←X; GfPtr←GfPtr+1;IF GfPtr=GfLimit THEN GfSwap[]; END; END ELSE BEGIN BEGIN GfBuf↑[GfPtr]←245;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;BEGIN GfBuf↑[GfPtr]←K; GfPtr←GfPtr+1;IF GfPtr=GfLimit THEN GfSwap[]; END;GfFour[GfDx↑[K]]; GfFour[GfDy↑[K]]; END;X←Mem[TfmWidth↑[K]+1]↑.Int; IF ABS[X]>MaxTfmDimen THEN IF X>0 THEN X←16777215 ELSE X←-16777215 ELSE X←MakeScaled[X*16,Internal↑[26]];GfFour[X];GfFour[CharPtr↑[K]]; END ENDLOOP;BEGIN GfBuf↑[GfPtr]←249;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;GfFour[GfPrevPtr]; BEGIN GfBuf↑[GfPtr]←131;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;K←4+( PascalMODPower2Mask[(GfBufSize-GfPtr),3]); WHILE K>0 DO BEGIN BEGIN GfBuf↑[GfPtr]←223;GfPtr←GfPtr+1; IF GfPtr=GfLimit THEN GfSwap[]; END;K←K-1; END ENDLOOP ;--1155: IF GfLimit=HalfBuf THEN WriteGf[HalfBuf,GfBufSize-1]; IF INT[GfPtr]>0 THEN WriteGf[0,GfPtr-1]--:1155--;PrintNl[918]; Print[OutputFileName];Print[426];PrintInt[TotalChars];Print[919]; IF TotalChars#1 THEN PrintChar[115];Print[920]; PrintInt[GfOffset+GfPtr];Print[921];BClose[@GfFile]; END--:1181--; END; --1205: IF Internal↑[12]>0 THEN--1207: IF INT[JobName]>0 THEN BEGIN {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: "Here is how much of METAFONT's memory"]; PascalWriteLongString[file: @LogFile, item: " you used:"]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteInteger[file: @LogFile, item: MaxStrPtr-InitStrPtr, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: " string"]}; IF MaxStrPtr#InitStrPtr+1 THEN PascalWriteLongString[file: @LogFile, item: "s"]; {PascalWriteLongString[file: @LogFile, item: " out of "]; PascalWriteInteger[file: @LogFile, item: MaxStrings-InitStrPtr, fieldMinLength: 1]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteInteger[file: @LogFile, item: MaxPoolPtr-InitPoolPtr, fieldMinLength: 1] ; PascalWriteLongString[file: @LogFile, item: " string characters out of "]; PascalWriteInteger[file: @LogFile, item: PoolSize-InitPoolPtr, fieldMinLength: 1]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteInteger[file: @LogFile, item: INT[LoMemMax+0]+MemEnd-HiMemMin+2, fieldMinLength: 1] ; PascalWriteLongString[file: @LogFile, item: " words of memory out of "]; PascalWriteInteger[file: @LogFile, item: INT[MemEnd]+1, fieldMinLength: 1]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteInteger[file: @LogFile, item: StCount, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: " symbolic tokens out of "]; PascalWriteInteger[file: @LogFile, item: 2100, fieldMinLength: 1]; PascalWriteLn[file: @LogFile]}; {PascalWriteLongString[file: @LogFile, item: " "]; PascalWriteInteger[file: @LogFile, item: MaxInStack, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "i,"]; PascalWriteInteger[file: @LogFile, item: IntPtr, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "n,"]; PascalWriteInteger[file: @LogFile, item: MaxRoundingPtr , fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "r,"]; PascalWriteInteger[file: @LogFile, item: MaxParamStack, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "p,"]; PascalWriteInteger[file: @LogFile, item: MaxBufStack+1, fieldMinLength: 1] ; PascalWriteLongString[file: @LogFile, item: "b stack positions out of "]; PascalWriteInteger[file: @LogFile, item: StackSize, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "i,"]; PascalWriteInteger[file: @LogFile, item: MaxInternal, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "n,"] ; PascalWriteInteger[file: @LogFile, item: MaxWiggle, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "r,"]; PascalWriteInteger[file: @LogFile, item: 150, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "p,"]; PascalWriteInteger[file: @LogFile, item: BufSize, fieldMinLength: 1]; PascalWriteLongString[file: @LogFile, item: "b"]; PascalWriteLn[file: @LogFile]}; END--:1207--;IF(GfPrevPtr>0)OR (Internal↑[33]>0) THEN BEGIN--1206:--Rover←23; Mem[Rover]↑.Hh.Rh←65535;LoMemMax← INT[HiMemMin]-1; IF INT[LoMemMax]-Rover>65535 THEN LoMemMax← INT[65535]+Rover; Mem[Rover]↑.Hh.Lh← INT[LoMemMax]-Rover;Mem[ INT[Rover]+1]↑.Hh.Lh←Rover; Mem[ INT[Rover]+1]↑.Hh.Rh←Rover;Mem[LoMemMax]↑.Hh.Rh←0; Mem[LoMemMax]↑.Hh.Lh←0--:1206--;--1123:--Mem[49999]↑.Hh.Rh←19; FOR i:INT IN [ INT[Bc ].. INT[Ec ]] DO K ← i; IF CharExists↑[K] THEN TfmWidth↑[K]←SortIn[TfmWidth ↑[K]] ENDLOOP;Nw←Skimp[255]+1;DimenHead↑[1]←Mem[49999]↑.Hh.Rh; IF Perturbation>=4096 THEN TfmWarning[20]--:1123--;FixDesignSize[]; FixCheckSum[];IF Internal↑[33]>0 THEN BEGIN--1125:--Mem[49999]↑.Hh.Rh←19; FOR i:INT IN [ INT[Bc ].. INT[Ec ]] DO K ← i; IF CharExists↑[K] THEN IF TfmHeight↑[K]=0 THEN TfmHeight↑[K]←15 ELSE TfmHeight↑[K]←SortIn[TfmHeight↑[K]] ENDLOOP; Nh←Skimp[15]+1;DimenHead↑[2]←Mem[49999]↑.Hh.Rh; IF Perturbation>=4096 THEN TfmWarning[21];Mem[49999]↑.Hh.Rh←19; FOR i:INT IN [ INT[Bc ].. INT[Ec ]] DO K ← i; IF CharExists↑[K] THEN IF TfmDepth↑[K]=0 THEN TfmDepth↑[K]←15 ELSE TfmDepth↑[K]←SortIn[TfmDepth↑[K]] ENDLOOP; Nd←Skimp[15]+1;DimenHead↑[3]←Mem[49999]↑.Hh.Rh; IF Perturbation>=4096 THEN TfmWarning[22];Mem[49999]↑.Hh.Rh←19; FOR i:INT IN [ INT[Bc ].. INT[Ec ]] DO K ← i; IF CharExists↑[K] THEN IF TfmItalCorr↑[K]=0 THEN TfmItalCorr↑[K]←15 ELSE TfmItalCorr↑[K]←SortIn[TfmItalCorr↑[K]] ENDLOOP; Ni←Skimp[63]+1;DimenHead↑[4]←Mem[49999]↑.Hh.Rh; IF Perturbation>=4096 THEN TfmWarning[23]--:1125--; TfmFinishUpTheFile[]; END;IF GfPrevPtr>0 THEN GfFinishUpTheFile[]; END--:1205--;IF INT[JobName]>0 THEN BEGIN PascalWriteLn[file: @LogFile];AClose[@LogFile]; Selector←Selector-2;IF Selector=1 THEN BEGIN PrintNl[930]; Print[LogName];PrintChar[46];PrintLn[]; END; END; END;--:1204----1208: FinalCleanup: PROCEDURE = BEGIN C:SmallNumber; C←CurMod; IF JobName=0 THEN OpenLogFile[]; WHILE CondPtr#0 DO BEGIN PrintNl[931];PrintCmdMod[2,CurIf]; IF IfLine#0 THEN BEGIN Print[137];PrintInt[IfLine]; END;Print[932]; IfLine←Mem[ INT[CondPtr]+1]↑.Int;CurIf←Mem[CondPtr]↑.Hh.B1; CondPtr←Mem[CondPtr]↑.Hh.Rh; END ENDLOOP ; IF History#0 THEN IF((History=1)OR ( INT[Interaction]<3)) THEN IF Selector=3 THEN BEGIN Selector←1;PrintNl[933];Selector←3; END; {IF C=1 THEN BEGIN IF StartLikeInimf THEN BEGIN StoreBaseFile[]; GOTO Label10; END ELSE BEGIN PrintNl[934]; GOTO Label10; END; END;EXITS Label10 => NULL}; END;--:1208 END.