-- file: TangleInit.mesa
-- Pascal-to-Mesa translator output, translated at September 23, 1986 11:39:50 am PDT


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  TanglePrivate;

TangleInit: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, TanglePrivate EXPORTS TanglePrivate = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, TanglePrivate;
--:188----30:
--PROCEDURE DEBUG←HELP;FORWARD;----:30----31:-- Error: PROCEDURE
 = 
BEGIN J:PascalInteger[0..OutBufSize];K, L:PascalInteger[0..BufSize]; IF PhaseOne  THEN--32:
BEGIN IF  INT[Loc]>=Limit  THEN L←Limit  ELSE L←Loc;
IF Changing  THEN {PascalWriteLongString[file: @TermOut, item: ". (change file pos:"]; PascalWriteInteger[file: @TermOut, item: FileGetPos[
@ChangeFile]-(Limit-L)-2, fieldMinLength: 1]; PascalWriteLongString[file: @TermOut, item: ")"]; PascalWriteLn[file: @TermOut]} ELSE {PascalWriteLongString[file: @TermOut, item: ". (pos:"]
; PascalWriteInteger[file: @TermOut, item: FileGetPos[@WebFile]-(Limit-L)-2, fieldMinLength: 1]; PascalWriteLongString[file: @TermOut, item: ")"]; PascalWriteLn[file: @TermOut]};
FOR i:INT    IN [ INT[1 ].. INT[L ]] DO  K ← i; IF Buffer↑[K-1]=9  THEN PascalWriteLongString[file: @TermOut, item: " "] ELSE 
PascalWriteChar[file: @TermOut, item: Xchr↑[Buffer↑[K-1]]] ENDLOOP;PascalWriteLn[file: @TermOut];
FOR i:INT    IN [ INT[1 ].. INT[L ]] DO  K ← i; PascalWriteLongString[file: @TermOut, item: " "] ENDLOOP;
FOR i:INT    IN [ INT[L+1 ].. INT[Limit ]] DO  K ← i; PascalWriteChar[file: @TermOut, item: Xchr↑[Buffer↑[K-1]]] ENDLOOP;
PascalWriteLongString[file: @TermOut, item: " "]; END--:32-- ELSE--33:
BEGIN {PascalWriteLongString[file: @TermOut, item: ". (pos:"]; PascalWriteInteger[file: @TermOut, item: FileGetPos[@PascalFile]+OutPtr, fieldMinLength: 1]
; PascalWriteLongString[file: @TermOut, item: ")"]; PascalWriteLn[file: @TermOut]};FOR i:INT    IN [ INT[1 ].. INT[OutPtr ]] DO  J ← i; PascalWriteChar[file: @TermOut, item: Xchr↑[OutBuf↑[J-1]]] ENDLOOP;
PascalWriteLongString[file: @TermOut, item: "... "]; END--:33--;PascalTextBREAK[file: @TermOut];History←2;--DEBUG←HELP;
 END;--:31----34:-- JumpOut: PROCEDURE = 
BEGIN  ERROR Error9999; END;--:34
 Initialize: PROCEDURE = 
BEGIN--16:--I:PascalInteger[0..255];--:16----41:--Wi:PascalInteger[0..1];--:41----45:
Zi:PascalInteger[0..2];--:45----51:--H:PascalInteger[0..HashSize];--:51----10:--History←0;--:10----14:
Xchr↑[32]←' ;Xchr↑[33]←'!;Xchr↑[34]←'";Xchr↑[35]←'#;Xchr↑[36]←'$;
Xchr↑[37]←'%;Xchr↑[38]←'&;Xchr↑[39]←'';Xchr↑[40]←'(;Xchr↑[41]←');
Xchr↑[42]←'*;Xchr↑[43]←'+;Xchr↑[44]←',;Xchr↑[45]←'-;Xchr↑[46]←'.;
Xchr↑[47]←'/;Xchr↑[48]←'0;Xchr↑[49]←'1;Xchr↑[50]←'2;Xchr↑[51]←'3;
Xchr↑[52]←'4;Xchr↑[53]←'5;Xchr↑[54]←'6;Xchr↑[55]←'7;Xchr↑[56]←'8;
Xchr↑[57]←'9;Xchr↑[58]←':;Xchr↑[59]←';;Xchr↑[60]←'<;Xchr↑[61]←'=;
Xchr↑[62]←'>;Xchr↑[63]←'?;Xchr↑[64]←'@;Xchr↑[65]←'A;Xchr↑[66]←'B;
Xchr↑[67]←'C;Xchr↑[68]←'D;Xchr↑[69]←'E;Xchr↑[70]←'F;Xchr↑[71]←'G;
Xchr↑[72]←'H;Xchr↑[73]←'I;Xchr↑[74]←'J;Xchr↑[75]←'K;Xchr↑[76]←'L;
Xchr↑[77]←'M;Xchr↑[78]←'N;Xchr↑[79]←'O;Xchr↑[80]←'P;Xchr↑[81]←'Q;
Xchr↑[82]←'R;Xchr↑[83]←'S;Xchr↑[84]←'T;Xchr↑[85]←'U;Xchr↑[86]←'V;
Xchr↑[87]←'W;Xchr↑[88]←'X;Xchr↑[89]←'Y;Xchr↑[90]←'Z;Xchr↑[91]←'[;
Xchr↑[92]←'\\;Xchr↑[93]←'];Xchr↑[94]←'↑;Xchr↑[95]←'←;Xchr↑[96]←'`;
Xchr↑[97]←'a;Xchr↑[98]←'b;Xchr↑[99]←'c;Xchr↑[100]←'d;Xchr↑[101]←'e;
Xchr↑[102]←'f;Xchr↑[103]←'g;Xchr↑[104]←'h;Xchr↑[105]←'i;
Xchr↑[106]←'j;Xchr↑[107]←'k;Xchr↑[108]←'l;Xchr↑[109]←'m;
Xchr↑[110]←'n;Xchr↑[111]←'o;Xchr↑[112]←'p;Xchr↑[113]←'q;
Xchr↑[114]←'r;Xchr↑[115]←'s;Xchr↑[116]←'t;Xchr↑[117]←'u;
Xchr↑[118]←'v;Xchr↑[119]←'w;Xchr↑[120]←'x;Xchr↑[121]←'y;
Xchr↑[122]←'z;Xchr↑[123]←'{;Xchr↑[124]←'|;Xchr↑[125]←'};
Xchr↑[126]←'~;Xchr↑[0]←' ;Xchr↑[127]←' ;--:14----17:
FOR i:INT    IN [ INT[1 ].. INT[31 ]] DO  I ← i; Xchr↑[I]←PascalCHR[I] ENDLOOP;--:17----18:
FOR i:INT    IN [ INT[0 ].. INT[255 ]] DO  I ← i; Xord↑[PascalCHR[I]]←32 ENDLOOP;FOR i:INT    IN [ INT[1 ].. INT[126 ]] DO  I ← i; Xord↑[Xchr↑[I]]←I ENDLOOP;
--:18----21:--TtyRewrite[@TermOut];--:21----26:
FileRewrite[@PascalFile,Alfa['p, 'a, 's, ' , ' , ' , ' , ' , ' , ' ]];FileRewrite[@Pool,Alfa['p, 'o, 'o, 'l, ' , ' , ' , ' , ' , ' ]];
--:26----42:--FOR i:INT    IN [ INT[0 ].. INT[1 ]] DO  Wi ← i;  ByteStart↑[Wi]←0;BytePtr↑[Wi]←0; ENDLOOP;
ByteStart↑[2]←0;NamePtr←1;StringPtr←128;PoolCheckSum←271828;
--:42----46:--FOR i:INT    IN [ INT[0 ].. INT[2 ]] DO  Zi ← i;  TokStart↑[Zi]←0;TokPtr↑[Zi]←0; ENDLOOP;
TokStart↑[3]←0;TextPtr←1;Z← 1 MOD 3;--:46----48:--Ilk↑[0]←0;Equiv↑[0]←0;
--:48----52:--FOR i:INT    IN [ INT[0 ].. INT[HashSize-1 ]] DO  H ← i;  Hash↑[H]←0;ChopHash↑[H]←0;
 ENDLOOP;--:52----71:--LastUnnamed←0;TextLink↑[0]←0;--:71----144:
ScanningHex←FALSE;--:144----152:--ModText↑[0]←32;--:152----180:
--TROUBLE←SHOOTING:=TRUE;DEBUG←CYCLE:=1;DEBUG←SKIPPED:=0;
-- TROUBLE←SHOOTING:=FALSE;DEBUG←CYCLE:=99999;RESET(TERM←IN,'TTY:','/I');
--:180-- END;--:2----24:-- OpenInput: PROCEDURE
 = 
BEGIN FileReset[@WebFile,Alfa['w, 'e, 'b, ' , ' , ' , ' , ' , ' , ' ]];
FileReset[@ChangeFile,Alfa['c, 'h, 'a, 'n, 'g, 'e, 's, ' , ' , ' ]]; END;--:24----28:
 InputLn: PROCEDURE[ F: LONG POINTER TO TextFile] RETURNS[InputLnResult: PascalBoolean] = 
BEGIN FinalLimit:PascalInteger[0..BufSize];
 Limit←0;FinalLimit←0;
IF PascalTextEOF[file: @F↑] THEN InputLnResult←FALSE  ELSE BEGIN WHILE  NOT PascalTextEOLN[file: @F↑]DO BEGIN
Buffer↑[Limit]←Xord↑[PascalTextElement[file: @F↑]];PascalTextGET[file: @F↑];Limit←Limit+1;
IF Buffer↑[Limit-1]#32  THEN FinalLimit←Limit;
IF Limit=BufSize  THEN BEGIN WHILE  NOT PascalTextEOLN[file: @F↑]DO PascalTextGET[file: @F↑] ENDLOOP ;Limit←Limit-1;
BEGIN PascalWriteLn[file: @TermOut];PascalWriteLongString[file: @TermOut, item: "! Input line too long"]; END;
Loc←0;Error[]; END; END ENDLOOP ;PascalReadLn[file: @F↑];Limit←FinalLimit;InputLnResult←TRUE; END;
 END;--:28----49:--
END.