-- file: TFtoPLOrganizeImpl.mesa
-- Pascal-to-Mesa translator output, translated at September 23, 1986 1:04:35 pm PDT


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  TFtoPLPrivate,
  TFtoPLExternals,
  TFtoPLMain;

TFtoPLOrganizeImpl: PROGRAM IMPORTS PascalWizardFiles, TFtoPLMain EXPORTS TFtoPLPrivate = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, TFtoPLPrivate, TFtoPLExternals, TFtoPLMain;
--:52----85:-- Organize: PROCEDURE RETURNS[OrganizeResult: PascalBoolean] = 
BEGIN  TfmPtr:Index;
--20:--PascalReadLong[file: @TfmFile.baseFile, length: SIZE[PascalInteger[0..255], 2], element: @TfmFile.element, item: @Tfm↑[0]];{{IF  INT[Tfm↑[0]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "The first byte of the input file exceeds 127!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;IF PascalEOF[file: @TfmFile.baseFile] THEN BEGIN {
PascalWriteLongString[file: @Output, item: "The input file is only one byte long!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;PascalReadLong[file: @TfmFile.baseFile, length: SIZE[PascalInteger[0..255], 2], element: @TfmFile.element, item: @Tfm↑[1]];Lf←Tfm↑[0]*256+Tfm↑[1];
IF Lf=0  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "The file claims to have length zero, but that's impossible!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;IF  INT[4]*Lf-1>TfmSize  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "The file is bigger than I can handle!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;
FOR i:INT    IN [ INT[2 ].. INT[ INT[4]*Lf-1 ]] DO  TfmPtr ← i;  IF PascalEOF[file: @TfmFile.baseFile] THEN BEGIN {
PascalWriteLongString[file: @Output, item: "The file has fewer bytes than it claims!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;PascalReadLong[file: @TfmFile.baseFile, length: SIZE[PascalInteger[0..255], 2], element: @TfmFile.element, item: @Tfm↑[TfmPtr]]; ENDLOOP;
IF  NOT PascalEOF[file: @TfmFile.baseFile] THEN BEGIN {
PascalWriteLongString[file: @Output, item: "There's some extra junk at the end of the TFM file,"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "but I'll proceed as if it weren't there."]; PascalWriteLn[file: @Output]}; END--:20--;--21:
BEGIN            TfmPtr←2;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Lh←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Bc←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Ec←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Nw←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Nh←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Nd←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Ni←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Nl←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Nk←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Ne←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;BEGIN IF  INT[Tfm↑[TfmPtr]]>127  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "One of the subfile sizes is negative!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;Np←Tfm↑[TfmPtr]*256+Tfm↑[TfmPtr+1];TfmPtr←TfmPtr+2;
 END;IF Lf#6+Lh+( INT[Ec-Bc]+1)+Nw+Nh+Nd+Ni+Nl+Nk+Ne+Np  THEN BEGIN {
PascalWriteLongString[file: @Output, item: "Subfile sizes don't add up to the stated total!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;IF(Nw=0)OR (Nh=0)OR (Nd=0)OR (Ni=0) THEN BEGIN {
PascalWriteLongString[file: @Output, item: "Incomplete subfiles for character dimensions!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;
IF( INT[Bc]>Ec+1)OR ( INT[Ec]>255) THEN BEGIN {PascalWriteLongString[file: @Output, item: "The character code range "]; PascalWriteInteger[file: @Output, item: Bc, fieldMinLength: 1
]; PascalWriteLongString[file: @Output, item: ".."]; PascalWriteInteger[file: @Output, item: Ec, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: "is illegal!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END;
IF  INT[Ne]>256  THEN BEGIN {PascalWriteLongString[file: @Output, item: "There are "]; PascalWriteInteger[file: @Output, item: Ne, fieldMinLength: 1]; PascalWriteLongString[file: @Output, item: " extensible recipes!"]; PascalWriteLn[file: @Output]};
{PascalWriteLongString[file: @Output, item: "Sorry, but I can't go on; are you sure this is a TFM?"]; PascalWriteLn[file: @Output]};
 GOTO Label9999; END; END--:21--;--23:--BEGIN CharBase← INT[6+Lh]-Bc;
WidthBase←CharBase+Ec+1;HeightBase←WidthBase+Nw;
DepthBase←HeightBase+Nh;ItalicBase←DepthBase+Nd;
LigKernBase←ItalicBase+Ni;KernBase←LigKernBase+Nl;
ExtenBase←KernBase+Nk;ParamBase←ExtenBase+Ne-1; END--:23--;
OrganizeResult←TRUE; GOTO Label30;EXITS Label9999 => NULL};OrganizeResult←FALSE;EXITS Label30 => NULL}; END;--:85----86:

END.