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


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  WeaveProcs,
  WeaveProcArray,
  WeaveVars;

WeaveLow: PROGRAM IMPORTS PascalWizardFiles, WeaveProcArray, WeaveVars EXPORTS WeaveProcs = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, WeaveProcs, WeaveProcArray, WeaveVars;
 FlushBuffer: PROCEDURE[B: EightBits,PerCent: PascalBoolean] = 
BEGIN 
 J, K:PascalInteger[0..LineLength]; J←B;
{IF  NOT PerCent  THEN WHILE TRUE DO BEGIN IF J=0  THEN  GOTO Label30;
IF OutBuf↑[J]#32  THEN  GOTO Label30;J←J-1; END ENDLOOP ;
EXITS Label30 => NULL};FOR i:INT    IN [ INT[1 ].. INT[J ]] DO  K ← i; PascalWriteChar[file: @TexFile, item: Xchr↑[OutBuf↑[K]]] ENDLOOP;
IF PerCent  THEN PascalWriteChar[file: @TexFile, item: Xchr↑[37]];PascalWriteLn[file: @TexFile];
OutLine←OutLine+1;
IF  INT[B]<OutPtr  THEN FOR i:INT    IN [ INT[B+1 ].. INT[OutPtr ]] DO  K ← i; OutBuf↑[K-B]←OutBuf↑[K] ENDLOOP;
OutPtr←OutPtr-B; END;--:123----124:-- FinishLine: PROCEDURE = 
BEGIN 
 K:PascalInteger[0..BufSize];
 {IF  INT[OutPtr]>0  THEN FlushBuffer[OutPtr,FALSE] ELSE BEGIN FOR i:INT    IN [ INT[0
].. INT[Limit ]] DO  K ← i; IF(Buffer↑[K]#32)AND (Buffer↑[K]#9) THEN  GOTO Label10 ENDLOOP;
FlushBuffer[0,FALSE]; END;EXITS Label10 => NULL}; END;--:124----128:-- BreakOut: PROCEDURE
 = 
BEGIN  K:PascalInteger[0..LineLength];D:AsciiCode; K←OutPtr;
{WHILE TRUE DO BEGIN IF K=0  THEN--129:--BEGIN BEGIN PascalWriteLn[file: @TermOut];
{PascalWriteLongString[file: @TermOut, item: "! Line had to be broken (output l."]; PascalWriteInteger[file: @TermOut, item: OutLine, fieldMinLength: 1]}; END;
{PascalWriteLongString[file: @TermOut, item: "):"]; PascalWriteLn[file: @TermOut]};
FOR i:INT    IN [ INT[1 ].. INT[OutPtr-1 ]] DO  K ← i; PascalWriteChar[file: @TermOut, item: Xchr↑[OutBuf↑[K]]] ENDLOOP;
PascalWriteLn[file: @TermOut];IF History=0  THEN History←1;
FlushBuffer[OutPtr-1,TRUE]; GOTO Label10; END--:129--;D←OutBuf↑[K];
IF D=32  THEN BEGIN FlushBuffer[K,FALSE]; GOTO Label10; END;
IF(D=92)AND (OutBuf↑[K-1]#92) THEN BEGIN FlushBuffer[K-1,TRUE]; GOTO Label10;
 END;K←K-1; END ENDLOOP ;EXITS Label10 => NULL}; END;--:128----131:-- OutMod: PROCEDURE[M: PascalInteger]
 = 
BEGIN K:PascalInteger[0..5];A:PascalInteger; K←0;A←M;DO Dig↑[K]← A MOD 10;
A← A /10;K←K+1; IF A=0 THEN EXIT; ENDLOOP;DO K←K-1;
BEGIN IF OutPtr=LineLength  THEN BreakOut[];OutPtr←OutPtr+1;
OutBuf↑[OutPtr]←Dig↑[K]+48; END; IF K=0 THEN EXIT; ENDLOOP;
IF ChangedModule↑[M] THEN BEGIN IF OutPtr=LineLength  THEN BreakOut[];
OutPtr←OutPtr+1;OutBuf↑[OutPtr]←92;
IF OutPtr=LineLength  THEN BreakOut[];OutPtr←OutPtr+1;
OutBuf↑[OutPtr]←42; END; END;--:131----132:
 OutName: PROCEDURE[P: NamePointer] = 
BEGIN K:PascalInteger[0..MaxBytes];W:PascalInteger[0..1];
 BEGIN IF OutPtr=LineLength  THEN BreakOut[];OutPtr←OutPtr+1;
OutBuf↑[OutPtr]←123; END;W← P MOD 2;
FOR i:INT    IN [ INT[ByteStart↑[P]].. INT[ INT[ByteStart↑[P+2]]-1 ]] DO  K ← i;  IF ByteMem[W, K]↑=95
 THEN BEGIN IF OutPtr=LineLength  THEN BreakOut[];OutPtr←OutPtr+1;
OutBuf↑[OutPtr]←92; END;BEGIN IF OutPtr=LineLength  THEN BreakOut[];
OutPtr←OutPtr+1;OutBuf↑[OutPtr]←ByteMem[W, K]↑; END; ENDLOOP;
BEGIN IF OutPtr=LineLength  THEN BreakOut[];OutPtr←OutPtr+1;
OutBuf↑[OutPtr]←125; END; END;--:132----133:--
END.