-- file: WeaveInit.mesa
-- Pascal-to-Mesa translator output, translated at September 15, 1985 4:11:16 pm PDT


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  WeaveProcs,
  WeaveVars;

WeaveInit: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars EXPORTS WeaveProcs = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars;
--:265----30:
--PROCEDURE DEBUG←HELP;FORWARD;----:30----31:-- Error: PROCEDURE
 = 
BEGIN K, L:PascalInteger[0..LongBufSize];--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;
IF Buffer↑[Limit]=124  THEN PascalWriteChar[file: @TermOut, item: Xchr↑[124]];PascalWriteLongString[file: @TermOut, item: " "];
 END--:32--;PascalTextBREAK[file: @TermOut];History←2;--DEBUG←SKIPPED:=DEBUG←CYCLE;
-- DEBUG←HELP;-- END;--:31----33:-- JumpOut: PROCEDURE = 
BEGIN  ERROR Error9999; END;--:33
 Initialize: PROCEDURE = 
BEGIN--16:--I:PascalInteger[0..255];--:16----40:--Wi:PascalInteger[0..1];--:40----57:
H:PascalInteger[0..HashSize];--:57----248:--C:AsciiCode;--:248----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[@TexFile,Alfa['t, 'e, 'x, ' , ' , ' , ' , ' , ' , ' ]];--:26----41:
FOR i:INT    IN [ INT[0 ].. INT[1 ]] DO  Wi ← i;  ByteStart↑[Wi]←0;BytePtr↑[Wi]←0; ENDLOOP;
ByteStart↑[2]←0;NamePtr←1;--:41----43:--Ilk↑[0]←0;--:43----50:--XrefPtr←0;
XrefSwitch←0;ModXrefSwitch←0;Xmem↑[0].NumField←0;Xref↑[0]←0;--:50
--55:--TokPtr←1;TextPtr←1;TokStart↑[0]←1;TokStart↑[1]←1;
--MAX←TOK←PTR:=1;MAX←TXT←PTR:=1;----:55----58:
FOR i:INT    IN [ INT[0 ].. INT[HashSize-1 ]] DO  H ← i; Hash↑[H]←0 ENDLOOP;--:58----95:--ScanningHex←FALSE;
--:95----103:--ModText↑[0]←32;--:103----125:--OutPtr←1;OutLine←1;
OutBuf↑[1]←99;PascalWriteLongString[file: @TexFile, item: "\\input webma"];--:125----127:
OutBuf↑[0]←92;--:127----146:--ScrapBase←1;ScrapPtr←0;--MAX←SCR←PTR:=0;
--:146----204:----MAX←STACK←PTR:=0;----:204----246:----MAX←SORT←PTR:=0;----:246
--249:--Collate↑[0]←0;Collate↑[1]←32;FOR i:INT    IN [ INT[1 ].. INT[31 ]] DO  C ← i; Collate↑[C+1]←C ENDLOOP;
FOR i:INT    IN [ INT[33 ].. INT[47 ]] DO  C ← i; Collate↑[C]←C ENDLOOP;FOR i:INT    IN [ INT[58 ].. INT[64 ]] DO  C ← i; Collate↑[C-10]←C ENDLOOP;
FOR i:INT    IN [ INT[91 ].. INT[94 ]] DO  C ← i; Collate↑[C-36]←C ENDLOOP;Collate↑[59]←96;
FOR i:INT    IN [ INT[123 ].. INT[126 ]] DO  C ← i; Collate↑[C-63]←C ENDLOOP;Collate↑[64]←95;
FOR i:INT    IN [ INT[97 ].. INT[122 ]] DO  C ← i; Collate↑[C-32]←C ENDLOOP;
FOR i:INT    IN [ INT[48 ].. INT[57 ]] DO  C ← i; Collate↑[C+43]←C ENDLOOP;--:249----260:----TROUBLE←SHOOTING:=TRUE;
-- DEBUG←CYCLE:=1;DEBUG←SKIPPED:=0;TRACING:=0;TROUBLE←SHOOTING:=FALSE;
-- DEBUG←CYCLE:=99999;RESET(TERM←IN,'TTY:','/I');----:260-- 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----44:--
END.