-- file: TFtoPLMiscImpl.mesa -- Pascal-to-Mesa translator output, translated at September 14, 1985 3:12:44 pm PDT DIRECTORY PascalBasic, PascalWizardFiles, TFtoPLPrivate, TFtoPLExternals, TFtoPLMain; TFtoPLMiscImpl: PROGRAM IMPORTS PascalWizardFiles, TFtoPLExternals, TFtoPLMain EXPORTS TFtoPLPrivate = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, TFtoPLPrivate, TFtoPLExternals, TFtoPLMain; --:89 Initialize: PROCEDURE = BEGIN {PascalWriteLongString[file: @Output, item: "This is TFtoPL 2.4 for Cedar 6.0"]; PascalWriteLn[file: @Output]}; --7:--ByteFileReset[@TfmFile,Alfa['t, 'f, 'm, ' , ' , ' , ' , ' , ' , ' ]];--:7----17: FileRewrite[@PlFile,Alfa['p, 'l, ' , ' , ' , ' , ' , ' , ' , ' ]];--:17----28: Ascii04^_[' , '!, '", '#, '$, '%, '&, '', '(, '), '*, '+, ',, '-, '., '/, '0, '1, '2, '3, '4, '5, '6, '7, '8, '9, ':, ';, '<, '=, '>, '?]; Ascii10^_['@, 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N, 'O, 'P, 'Q, 'R, 'S, 'T, 'U, 'V, 'W, 'X, 'Y, 'Z, '[, '\\, '], '^, '_]; Ascii14^_['`, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, '{, '|, '}, '~, ' ];MblString^_['M, 'B, 'L]; RiString^_['R, 'I, ' ];RceString^_['R, 'C, 'E];--:28----33:--Level_0;--:33----46: CharsOnLine_0;Perfect_TRUE;--:46----64:--LabelPtr_0; LabelTable^[0].Rr_0;--:64-- END;--:2----30:-- OutDigs: PROCEDURE[J: PascalInteger] = BEGIN DO J_J-1;PascalWriteInteger[file: @PlFile, item: Dig^[J], fieldMinLength: 1]; IF J=0 THEN EXIT; ENDLOOP; END; PrintDigs: PROCEDURE[J: PascalInteger] = BEGIN DO J_J-1;PascalWriteInteger[file: @Output, item: Dig^[J], fieldMinLength: 1]; IF J=0 THEN EXIT; ENDLOOP; END;--:30----31:-- PrintOctal: PROCEDURE[C: Byte] = BEGIN J:PascalInteger[0..2]; PascalWriteLongString[file: @Output, item: "'"];FOR i:INT IN [ INT[0 ].. INT[2 ]] DO J _ i; Dig^[J]_ C MOD 8;C_ C /8; ENDLOOP; PrintDigs[3]; END;--:31----34:-- OutLn: PROCEDURE = BEGIN L:PascalInteger[0..5]; PascalWriteLn[file: @PlFile];FOR i:INT IN [ INT[1 ].. INT[Level ]] DO L _ i; PascalWriteLongString[file: @PlFile, item: " "] ENDLOOP; END; Left: PROCEDURE = BEGIN Level_Level+1;PascalWriteLongString[file: @PlFile, item: "("]; END; Right: PROCEDURE = BEGIN Level_Level-1;PascalWriteLongString[file: @PlFile, item: ")"];OutLn[]; END;--:34 --35:-- OutBcpl: PROCEDURE[K: Index] = BEGIN L:PascalInteger[0..39]; PascalWriteLongString[file: @PlFile, item: " "]; L_Tfm^[K];WHILE INT[L]>0 DO BEGIN K_K+1;L_L-1; SELECT Tfm^[K]/32 FROM 1 =>PascalWriteChar[file: @PlFile, item: Ascii04^[1+( Tfm^[K]MOD 32)]]; 2 =>PascalWriteChar[file: @PlFile, item: Ascii10^[1+( Tfm^[K]MOD 32)]]; 3 =>PascalWriteChar[file: @PlFile, item: Ascii14^[1+( Tfm^[K]MOD 32)]]; ENDCASE; END ENDLOOP ; END;--:35----36: OutOctal: PROCEDURE[K,L: Index] = BEGIN A:PascalInteger[0..1023];B:PascalInteger[0..32];J:PascalInteger[0..11]; PascalWriteLongString[file: @PlFile, item: " O "];A_0;B_0;J_0;WHILE INT[L]>0 DO--37:--BEGIN L_L-1; IF Tfm^[K+L]#0 THEN BEGIN WHILE INT[B]>2 DO BEGIN Dig^[J]_ A MOD 8;A_ A /8; B_B-3;J_J+1; END ENDLOOP ;SELECT B FROM 0 =>A_Tfm^[K+L];1 =>A_A+2*Tfm^[K+L]; 2 =>A_A+4*Tfm^[K+L]; ENDCASE; END;B_B+8; END--:37-- ENDLOOP ; WHILE( INT[A]>0)OR (J=0)DO BEGIN Dig^[J]_ A MOD 8;A_ A /8;J_J+1; END ENDLOOP ; OutDigs[J]; END;--:36----38:-- OutChar: PROCEDURE[C: Byte] = BEGIN IF INT[FontType]>0 THEN BEGIN Tfm^[0]_C; OutOctal[0,1]; END ELSE IF( INT[C]>=48)AND ( INT[C]<=57) THEN {PascalWriteLongString[file: @PlFile, item: " C "]; PascalWriteInteger[file: @PlFile, item: C-48 , fieldMinLength: 1]} ELSE IF( INT[C]>=65)AND ( INT[C]<=90) THEN {PascalWriteLongString[file: @PlFile, item: " C "]; PascalWriteChar[file: @PlFile, item: Ascii10^[C-63]]} ELSE IF( INT[C]>=97)AND ( INT[C]<=122) THEN {PascalWriteLongString[file: @PlFile, item: " C "]; PascalWriteChar[file: @PlFile, item: Ascii14^[C-95]]} ELSE BEGIN Tfm^[0]_C;OutOctal[0,1]; END; END;--:38----39:-- OutFace: PROCEDURE[K: Index] = BEGIN S:PascalInteger[0..1];B:PascalInteger[0..8]; IF INT[Tfm^[K]]>=18 THEN OutOctal[K,1] ELSE BEGIN PascalWriteLongString[file: @PlFile, item: " F "]; S_ Tfm^[K]MOD 2;B_ Tfm^[K]/2;PascalWriteChar[file: @PlFile, item: MblString^[1+( B MOD 3)]]; PascalWriteChar[file: @PlFile, item: RiString^[1+S]];PascalWriteChar[file: @PlFile, item: RceString^[1+( B /3)]]; END; END;--:39----40:-- OutFix: PROCEDURE[K: Index] = BEGIN A:PascalInteger[0..4095];F:PascalInteger; J:PascalInteger[0..12];Delta:PascalInteger; PascalWriteLongString[file: @PlFile, item: " R "]; A_(Tfm^[K]*16)+( Tfm^[K+1]/16); F_ INT[(( Tfm^[K+1]MOD 16)*256+Tfm^[K+2])]*256+Tfm^[K+3];IF INT[A]>2047 THEN--43: BEGIN PascalWriteLongString[file: @PlFile, item: "-"];A_4096-A;IF F>0 THEN BEGIN F_1048576-F; A_A-1; END; END--:43--;--41:--BEGIN J_0;DO Dig^[J]_ A MOD 10;A_ A /10; J_J+1; IF A=0 THEN EXIT; ENDLOOP;OutDigs[J]; END--:41--;--42:--BEGIN PascalWriteLongString[file: @PlFile, item: "."]; F_10*F+5;Delta_10; DO IF Delta>1048576 THEN F_F+524288-( Delta /2); PascalWriteInteger[file: @PlFile, item: F /1048576, fieldMinLength: 1];F_10*( F MOD 1048576);Delta_Delta*10; IF F<=Delta THEN EXIT; ENDLOOP; END;--:42-- END;--:40----52:-- CheckBcpl: PROCEDURE[K,L: Index] = BEGIN J:Index;C:Byte; IF INT[Tfm^[K]]>=L THEN BEGIN BEGIN Perfect_FALSE; IF INT[CharsOnLine]>0 THEN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLn[file: @Output]};CharsOnLine_0; {PascalWriteLongString[file: @Output, item: "Bad TFM file: "] ; PascalWriteLongString[file: @Output, item: "String is too long; I've shortened it drastically."]; PascalWriteLn[file: @Output]}; END;Tfm^[K]_1; END;FOR i:INT IN [ INT[K+1 ].. INT[K+Tfm^[K]]] DO J _ i; C_Tfm^[J]; IF(C=40)OR (C=41) THEN BEGIN BEGIN Perfect_FALSE; IF INT[CharsOnLine]>0 THEN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLn[file: @Output]};CharsOnLine_0; {PascalWriteLongString[file: @Output, item: "Bad TFM file: "] ; PascalWriteLongString[file: @Output, item: "Parenthesis in string has been changed to slash."]; PascalWriteLn[file: @Output]}; END;Tfm^[J]_47; END ELSE IF( INT[C]<32)OR ( INT[C]>126) THEN BEGIN BEGIN Perfect_FALSE; IF INT[CharsOnLine]>0 THEN {PascalWriteLongString[file: @Output, item: " "]; PascalWriteLn[file: @Output]};CharsOnLine_0; {PascalWriteLongString[file: @Output, item: "Bad TFM file: "]; PascalWriteLongString[file: @Output, item: "Nonstandard ASCII code has been blotted out."] ; PascalWriteLn[file: @Output]}; END;Tfm^[J]_63; END ELSE IF( INT[C]>=97)AND ( INT[C]<=122) THEN Tfm^[J]_C-32; ENDLOOP; END; END.