-- file: WeaveInput.mesa -- Pascal-to-Mesa translator output, translated at September 23, 1986 1:27:38 pm PDT DIRECTORY PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars; WeaveInput: PROGRAM IMPORTS PascalWizardFiles, WeaveProcs, WeaveVars EXPORTS WeaveProcs = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars; --:70----75:-- LinesDontMatch: PROCEDURE RETURNS[LinesDontMatchResult: PascalBoolean] = BEGIN K:PascalInteger[0..BufSize]; LinesDontMatchResult←TRUE;{IF ChangeLimit#Limit THEN GOTO Label10; IF INT[Limit]>0 THEN FOR i:INT IN [ INT[0 ].. INT[Limit-1 ]] DO K ← i; IF ChangeBuffer↑[K]#Buffer↑[K] THEN GOTO Label10 ENDLOOP;LinesDontMatchResult←FALSE;EXITS Label10 => NULL}; END;--:75----76: PrimeTheChangeBuffer: PROCEDURE = BEGIN K:PascalInteger[0..BufSize]; --78:-- --79:-- ChangeLimit←0;--77:--{{WHILE TRUE DO BEGIN Line←Line+1; IF NOT InputLn[@ChangeFile] THEN GOTO Label10;{IF INT[Limit]<2 THEN GOTO Label22; IF Buffer↑[0]#64 THEN GOTO Label22; IF( INT[Buffer↑[1]]>=88)AND ( INT[Buffer↑[1]]<=90) THEN Buffer↑[1]←Buffer↑[1]+32; IF Buffer↑[1]=120 THEN GOTO Label30; IF(Buffer↑[1]=121)OR (Buffer↑[1]=122) THEN BEGIN Loc←2; BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Where is the matching @x?"];Error[]; END; END; END;EXITS Label22 => NULL}; END ENDLOOP ; EXITS Label30 => NULL};--:77--DO Line←Line+1; IF NOT InputLn[@ChangeFile] THEN BEGIN BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Change file ended after @x"];Error[]; END; END; GOTO Label10; END; IF INT[Limit]>0 THEN EXIT; ENDLOOP;--:78--BEGIN ChangeLimit←Limit; FOR i:INT IN [ INT[0 ].. INT[Limit ]] DO K ← i; ChangeBuffer↑[K]←Buffer↑[K] ENDLOOP; END--:79--;EXITS Label10 => NULL}; END;--:76 --80:-- CheckChange: PROCEDURE = BEGIN N:PascalInteger;K:PascalInteger[0..BufSize]; {IF LinesDontMatch [] THEN GOTO Label10;N←0; WHILE TRUE DO BEGIN Changing← NOT Changing;TempLine←OtherLine; OtherLine←Line;Line←TempLine;Line←Line+1; IF NOT InputLn[@ChangeFile] THEN BEGIN BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Change file ended before @y"];Error[]; END; END;ChangeLimit←0;Changing← NOT Changing;TempLine←OtherLine; OtherLine←Line;Line←TempLine; GOTO Label10; END;--81: IF INT[Limit]>1 THEN IF Buffer↑[0]=64 THEN BEGIN IF( INT[Buffer↑[1]]>=88)AND ( INT[Buffer↑[1 ]]<=90) THEN Buffer↑[1]←Buffer↑[1]+32; IF(Buffer↑[1]=120)OR (Buffer↑[1]=122) THEN BEGIN Loc←2; BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Where is the matching @y?"];Error[]; END; END; END ELSE IF Buffer↑[1]=121 THEN BEGIN IF N>0 THEN BEGIN Loc←2; BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut]; {PascalWriteLongString[file: @TermOut, item: "! Hmm... "]; PascalWriteInteger[file: @TermOut, item: N, fieldMinLength: 1] ; PascalWriteLongString[file: @TermOut, item: " of the preceding lines failed to match"]};Error[]; END; END; END; GOTO Label10; END; END--:81--;--79:--BEGIN ChangeLimit←Limit; FOR i:INT IN [ INT[0 ].. INT[Limit ]] DO K ← i; ChangeBuffer↑[K]←Buffer↑[K] ENDLOOP; END--:79--; Changing← NOT Changing;TempLine←OtherLine;OtherLine←Line; Line←TempLine;Line←Line+1; IF NOT InputLn[@WebFile] THEN BEGIN BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! WEB file ended during a change"]; Error[]; END; END;InputHasEnded←TRUE; GOTO Label10; END; IF LinesDontMatch [] THEN N←N+1; END ENDLOOP ;EXITS Label10 => NULL}; END;--:80----82: ResetInput: PROCEDURE = BEGIN OpenInput[];Line←0;OtherLine←0; Changing←TRUE;PrimeTheChangeBuffer[];Changing← NOT Changing; TempLine←OtherLine;OtherLine←Line;Line←TempLine;Limit←0;Loc←1; Buffer↑[0]←32;InputHasEnded←FALSE; END;--:82----83:-- GetLine: PROCEDURE = BEGIN DO {--Label20:--IF Changing THEN ChangedModule↑[ModuleCount]←TRUE ELSE--84: BEGIN Line←Line+1; IF NOT InputLn[@WebFile] THEN InputHasEnded←TRUE ELSE IF Limit=ChangeLimit THEN IF Buffer↑[0]=ChangeBuffer↑[0] THEN IF INT[ChangeLimit]>0 THEN CheckChange[]; END--:84--;IF Changing THEN BEGIN--85: BEGIN Line←Line+1; IF NOT InputLn[@ChangeFile] THEN BEGIN BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Change file ended without @z"]; Error[]; END; END;Buffer↑[0]←64;Buffer↑[1]←122;Limit←2; END; IF INT[Limit]>1 THEN IF Buffer↑[0]=64 THEN BEGIN IF( INT[Buffer↑[1]]>=88)AND ( INT[Buffer↑[1 ]]<=90) THEN Buffer↑[1]←Buffer↑[1]+32; IF(Buffer↑[1]=120)OR (Buffer↑[1]=121) THEN BEGIN Loc←2; BEGIN IF NOT PhaseOne THEN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Where is the matching @z?"];Error[]; END; END; END ELSE IF Buffer↑[1]=122 THEN BEGIN PrimeTheChangeBuffer[]; Changing← NOT Changing;TempLine←OtherLine;OtherLine←Line; Line←TempLine; END; END; END--:85--; IF NOT Changing THEN BEGIN ChangedModule↑[ModuleCount]←TRUE; GOTO Label20; END; END;Loc←0;Buffer↑[Limit]←32;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:83----88: END.