-- file: WeavePhaseI.mesa
-- Pascal-to-Mesa translator output, translated at September 23, 1986 1:27:38 pm PDT


DIRECTORY
  PascalBasic,
  PascalWizardFiles,
  WeaveProcs,
  WeaveVars;

WeavePhaseI: PROGRAM IMPORTS PascalWizardFiles, WeaveProcs, WeaveVars EXPORTS WeaveProcs = PUBLIC
BEGIN OPEN PascalBasic, PascalWizardFiles, WeaveProcs, WeaveVars;
 PascalXref: PROCEDURE = 
BEGIN  P:NamePointer;
 {WHILE  INT[NextControl]<143 DO BEGIN IF( INT[NextControl]>=130)AND (
 INT[NextControl]<=133) THEN BEGIN P←IdLookup[NextControl-130];NewXref[P];
IF(Ilk↑[P]=17)OR (Ilk↑[P]=22) THEN XrefSwitch←10240; END;
NextControl←GetNext[];
IF(NextControl=124)OR (NextControl=123) THEN  GOTO Label10; END ENDLOOP ;EXITS Label10 => NULL}; END;--:112
--113:-- OuterXref: PROCEDURE = 
BEGIN Bal:EightBits;
 WHILE  INT[NextControl]<143 DO IF NextControl#123  THEN PascalXref
[] ELSE BEGIN Bal←SkipComment[1];NextControl←124;
WHILE  INT[Bal]>0 DO BEGIN PascalXref[];
IF NextControl=124  THEN Bal←SkipComment[Bal] ELSE Bal←0; END ENDLOOP ; END ENDLOOP ; END;
--:113----120:-- ModCheck: PROCEDURE[P: NamePointer]
 = 
BEGIN IF  INT[P]>0  THEN BEGIN ModCheck[Link↑[P]];CurXref←Xref↑[P];
IF  INT[Xmem↑[CurXref].NumField]<10240  THEN BEGIN BEGIN PascalWriteLn[file: @TermOut];
PascalWriteLongString[file: @TermOut, item: "! Never defined: <"]; END;PrintId[P];
PascalWriteLongString[file: @TermOut, item: ">"];IF History=0  THEN History←1; END;
WHILE  INT[Xmem↑[CurXref].NumField]>=10240 DO CurXref←Xmem↑[CurXref].
XlinkField ENDLOOP ;IF CurXref=0  THEN BEGIN BEGIN PascalWriteLn[file: @TermOut];
PascalWriteLongString[file: @TermOut, item: "! Never used: <"]; END;PrintId[P];PascalWriteLongString[file: @TermOut, item: ">"];
IF History=0  THEN History←1; END;ModCheck[Ilk↑[P]]; END; END;--:120----123:
 PhaseI: PROCEDURE = 
BEGIN--110:-- PhaseOne←TRUE;PhaseThree←FALSE;
ResetInput[];ModuleCount←0;SkipLimbo[];ChangeExists←FALSE;
WHILE  NOT InputHasEnded DO--111:--BEGIN ModuleCount←ModuleCount+1;
IF ModuleCount=MaxModules  THEN BEGIN PascalWriteLn[file: @TermOut];
{PascalWriteLongString[file: @TermOut, item: "! Sorry, "]; PascalWriteLongString[file: @TermOut, item: "section number"]; PascalWriteLongString[file: @TermOut, item: " capacity exceeded"]};Error[];
History←3;JumpOut[]; END;ChangedModule↑[ModuleCount]←FALSE;
IF Buffer↑[Loc-1]=42  THEN BEGIN {PascalWriteLongString[file: @TermOut, item: "*"]; PascalWriteInteger[file: @TermOut, item: ModuleCount, fieldMinLength: 1]};
PascalTextBREAK[file: @TermOut]; END;--114:--DO NextControl←SkipTex[];
SELECT NextControl FROM 126 =>XrefSwitch←10240;125 =>XrefSwitch←0;
124 =>PascalXref[];131,132,133,146 =>BEGIN Loc←Loc-2;NextControl←GetNext[];
IF NextControl#146  THEN NewXref[IdLookup[NextControl-130]]; END;
 ENDCASE => NULL; IF  INT[NextControl]>=143--:114-- THEN EXIT; ENDLOOP;--116:
WHILE  INT[NextControl]<=144 DO BEGIN XrefSwitch←10240;
IF NextControl=144  THEN NextControl←GetNext [] ELSE--117:
BEGIN NextControl←GetNext[];
IF NextControl=130  THEN BEGIN Lhs←IdLookup[0];Ilk↑[Lhs]←0;
NewXref[Lhs];NextControl←GetNext[];
IF NextControl=30  THEN BEGIN NextControl←GetNext[];
IF NextControl=130  THEN BEGIN Rhs←IdLookup[0];Ilk↑[Lhs]←Ilk↑[Rhs];
Ilk↑[Rhs]←0;NewXref[Rhs];Ilk↑[Rhs]←Ilk↑[Lhs];NextControl←GetNext[]; END;
 END; END; END--:117--;OuterXref[]; END--:116-- ENDLOOP ;--118:
IF  INT[NextControl]<=146  THEN BEGIN IF NextControl=145  THEN ModXrefSwitch
←0  ELSE ModXrefSwitch←10240;
DO IF NextControl=146  THEN NewModXref[CurModule];
NextControl←GetNext[];OuterXref[]; IF  INT[NextControl]>146 THEN EXIT; ENDLOOP; END--:118--;
IF ChangedModule↑[ModuleCount] THEN ChangeExists←TRUE; END--:111-- ENDLOOP ;
ChangedModule↑[ModuleCount]←ChangeExists;PhaseOne←FALSE;--121:
ModCheck[Ilk↑[0]]--:121--;--:110-- END;
END.