-- file: TangleInput.mesa -- Pascal-to-Mesa translator output, translated at September 23, 1986 11:39:50 am PDT DIRECTORY PascalBasic, PascalWizardFiles, TanglePrivate; TangleInput: PROGRAM IMPORTS PascalWizardFiles, TanglePrivate EXPORTS TanglePrivate = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, TanglePrivate; 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;--:127----128: PrimeTheChangeBuffer: PROCEDURE = BEGIN K:PascalInteger[0..BufSize]; --130:-- --131:-- ChangeLimit←0;--129:--{{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 PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Where is the matching @x?"]; Error[]; END; END;EXITS Label22 => NULL}; END ENDLOOP ;EXITS Label30 => NULL};--:129--DO Line←Line+1; IF NOT InputLn[@ChangeFile] THEN BEGIN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Change file ended after @x"];Error[]; END; GOTO Label10; END; IF INT[Limit]>0 THEN EXIT; ENDLOOP;--:130--BEGIN ChangeLimit←Limit; FOR i:INT IN [ INT[0 ].. INT[Limit ]] DO K ← i; ChangeBuffer↑[K]←Buffer↑[K] ENDLOOP; END--:131--;EXITS Label10 => NULL}; END;--:128 --132:-- 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 PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Change file ended before @y"];Error[]; END; ChangeLimit←0;Changing← NOT Changing;TempLine←OtherLine; OtherLine←Line;Line←TempLine; GOTO Label10; END;--133: 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 PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Where is the matching @y?"]; Error[]; END; END ELSE IF Buffer↑[1]=121 THEN BEGIN IF N>0 THEN BEGIN Loc←2; 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; GOTO Label10; END; END--:133--;--131:--BEGIN ChangeLimit←Limit; FOR i:INT IN [ INT[0 ].. INT[Limit ]] DO K ← i; ChangeBuffer↑[K]←Buffer↑[K] ENDLOOP; END--:131--; Changing← NOT Changing;TempLine←OtherLine;OtherLine←Line; Line←TempLine;Line←Line+1; IF NOT InputLn[@WebFile] THEN BEGIN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! WEB file ended during a change"];Error[]; END; InputHasEnded←TRUE; GOTO Label10; END;IF LinesDontMatch [] THEN N←N+1; END ENDLOOP ; EXITS Label10 => NULL}; END;--:132----135:-- GetLine: PROCEDURE = BEGIN DO {--Label20:--IF Changing THEN--137:--BEGIN Line←Line+1; IF NOT InputLn[@ChangeFile] THEN BEGIN BEGIN PascalWriteLn[file: @TermOut]; PascalWriteLongString[file: @TermOut, item: "! Change file ended without @z"];Error[]; 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 PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Where is the matching @z?"]; Error[]; END; END ELSE IF Buffer↑[1]=122 THEN BEGIN PrimeTheChangeBuffer[]; Changing← NOT Changing;TempLine←OtherLine;OtherLine←Line; Line←TempLine; END; END; END--:137--;IF NOT Changing THEN BEGIN--136: 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--:136--;IF Changing THEN GOTO Label20; END;Loc←0; Buffer↑[Limit]←32;EXIT; EXITS Label20 => NULL} ENDLOOP; END;--:135----139: END.