-- file: MFDebugImpl.mesa -- Pascal-to-Mesa translator output, translated at October 31, 1985 4:28:03 pm PST DIRECTORY PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFMemory, MFSymbols, MFOps, MFDebug; MFDebugImpl: PROGRAM IMPORTS PascalBasic, PascalWizardFiles, MFProcArray, MFInteraction, MFMemory, MFSymbols, MFOps EXPORTS MFDebug = PUBLIC BEGIN OPEN PascalBasic, PascalWizardFiles, MFTypes, MFProcArray, MFInteraction, MFMemory, MFSymbols, MFOps, MFDebug; --:166----178: Free: LONG POINTER TO PACKED ARRAY PascalInteger[0..50000] OF PascalBoolean ← PascalStaticZone.NEW[PACKED ARRAY PascalInteger[0..50000] OF PascalBoolean]; WasFree: LONG POINTER TO PACKED ARRAY PascalInteger[0..50000] OF PascalBoolean ← PascalStaticZone.NEW[PACKED ARRAY PascalInteger[0..50000] OF PascalBoolean]; WasMemEnd: Halfword; WasLoMax: Halfword; WasHiMin: Halfword; Panicking: PascalBoolean; --:152----157:-- PrintWord: PROCEDURE[W: MemoryWord] = BEGIN PrintInt[W.Int]; PrintChar[32];PrintScaled[W.Int];PrintChar[32]; PrintScaled[ PascalDIVPower2[W.Int ,12]];PrintLn[];PrintInt[W.Hh.Lh];PrintChar[61]; PrintInt[W.Hh.B0];PrintChar[58];PrintInt[W.Hh.B1];PrintChar[59]; PrintInt[W.Hh.Rh];PrintChar[32];PrintInt[W.Qqqq.B0];PrintChar[58]; PrintInt[W.Qqqq.B1];PrintChar[58];PrintInt[W.Qqqq.B2];PrintChar[58]; PrintInt[W.Qqqq.B3]; END;--:157----162:----217:-- CheckMem: PROCEDURE[PrintLocs: PascalBoolean] = BEGIN P, Q, R:Halfword; Clobbered:PascalBoolean; --182:-- --183:-- FOR i:INT IN [ INT[0 ].. INT[LoMemMax ]] DO P ← i; Free↑[P]←FALSE ENDLOOP; FOR i:INT IN [ INT[HiMemMin ].. INT[MemEnd ]] DO P ← i; Free↑[P]←FALSE ENDLOOP;--181:--P←Avail;Q←0; Clobbered←FALSE; {WHILE P#0 DO BEGIN IF( INT[P]>MemEnd)OR ( INT[P]<HiMemMin) THEN Clobbered←TRUE ELSE IF Free↑[P] THEN Clobbered←TRUE; IF Clobbered THEN BEGIN PrintNl[189];PrintInt[Q]; GOTO Label31; END; Free↑[P]←TRUE;Q←P;P←Mem[Q]↑.Hh.Rh; END ENDLOOP ;EXITS Label31 => NULL};--:181--P←Rover;Q←0; Clobbered←FALSE; {DO IF( INT[P]>=LoMemMax)OR ( INT[P]<0) THEN Clobbered←TRUE ELSE IF( INT[Mem[ INT[P]+1]↑.Hh. Rh]>=LoMemMax)OR ( INT[Mem[ INT[P]+1]↑.Hh.Rh]<0) THEN Clobbered←TRUE ELSE IF NOT ((Mem [P]↑.Hh.Rh=65535))OR ( INT[Mem[P]↑.Hh.Lh]<2)OR ( INT[P]+Mem[P]↑.Hh.Lh>LoMemMax)OR (Mem[ INT[Mem[ INT[P]+1]↑.Hh.Rh]+1]↑.Hh.Lh#P) THEN Clobbered←TRUE; IF Clobbered THEN BEGIN PrintNl[190];PrintInt[Q]; GOTO Label32; END; FOR i:INT IN [ INT[P ].. INT[ INT[P]+Mem[P]↑.Hh.Lh-1 ]] DO Q ← i; IF Free↑[Q] THEN BEGIN PrintNl[191] ;PrintInt[Q]; GOTO Label32; END;Free↑[Q]←TRUE; ENDLOOP;Q←P;P←Mem[ INT[P]+1]↑.Hh.Rh; IF P=Rover THEN EXIT; ENDLOOP;EXITS Label32 => NULL};--:182--P←0; WHILE INT[P]<=LoMemMax DO BEGIN IF(Mem[P]↑.Hh.Rh=65535) THEN BEGIN PrintNl[ 192];PrintInt[P]; END;WHILE ( INT[P]<=LoMemMax)AND NOT Free↑[P]DO P← INT[P]+1 ENDLOOP ; WHILE ( INT[P]<=LoMemMax)AND Free↑[P]DO P← INT[P]+1 ENDLOOP ; END--:183-- ENDLOOP ;--616:--Q←13; P←Mem[Q]↑.Hh.Rh; WHILE P#13 DO BEGIN IF Mem[ INT[P]+1]↑.Hh.Lh#Q THEN BEGIN PrintNl[464]; PrintInt[P]; END;P←Mem[ INT[P]+1]↑.Hh.Rh;R←HiMemMin; DO IF INT[Mem[P]↑.Hh.Lh]>=R THEN BEGIN PrintNl[465];PrintInt[P]; END; R←Mem[P]↑.Hh.Lh;Q←P;P←Mem[Q]↑.Hh.Rh; IF R=0 THEN EXIT; ENDLOOP; END--:616-- ENDLOOP ; IF PrintLocs THEN--184:--BEGIN PrintNl[193]; FOR i:INT IN [ INT[0 ].. INT[LoMemMax ]] DO P ← i; IF NOT Free↑[P]AND ( ( INT[P]>WasLoMax)OR WasFree↑[P] ) THEN BEGIN PrintChar[32];PrintInt[P]; END ENDLOOP; FOR i:INT IN [ INT[HiMemMin ].. INT[MemEnd ]] DO P ← i; IF NOT Free↑[P]AND ( ( INT[P]<WasHiMin)OR ( INT[P]>WasMemEnd)OR WasFree↑[P]) THEN BEGIN PrintChar[32];PrintInt[P]; END ENDLOOP; END--:184--;FOR i:INT IN [ INT[0 ].. INT[LoMemMax ]] DO P ← i; WasFree↑[P]←Free↑[P] ENDLOOP; FOR i:INT IN [ INT[HiMemMin ].. INT[MemEnd ]] DO P ← i; WasFree↑[P]←Free↑[P] ENDLOOP; WasMemEnd←MemEnd;WasLoMax←LoMemMax;WasHiMin←HiMemMin; END; --:180----185:-- SearchMem: PROCEDURE[P: Halfword] = BEGIN Q:PascalInteger; FOR i:INT IN [ INT[0 ].. INT[LoMemMax ]] DO Q ← i; IF Mem[Q]↑.Hh.Rh=P THEN BEGIN PrintNl[194];PrintInt[Q];PrintChar[41]; END; IF Mem[Q]↑.Hh.Lh=P THEN BEGIN PrintNl[195];PrintInt[Q];PrintChar[41]; END; ENDLOOP; FOR i:INT IN [ INT[HiMemMin ].. INT[MemEnd ]] DO Q ← i; IF Mem[Q]↑.Hh.Rh=P THEN BEGIN PrintNl[194];PrintInt[Q];PrintChar[41]; END; IF Mem[Q]↑.Hh.Lh=P THEN BEGIN PrintNl[195];PrintInt[Q];PrintChar[41]; END; ENDLOOP;--209: FOR i:INT IN [ INT[1 ].. INT[2241 ]] DO Q ← i; IF Eqtb↑[Q].Rh=P THEN BEGIN PrintNl[329]; PrintInt[Q];PrintChar[41]; END;--:209-- ENDLOOP; END;--:185----189: DebugHelp: PROCEDURE = BEGIN K, L, M, N:PascalInteger; {WHILE TRUE DO BEGIN PrintNl[935];PascalTextBREAK[file: @TermOut];M←PascalReadInteger[file: @TermIn]; IF M<0 THEN GOTO Label10 ELSE IF M=0 THEN BEGIN { GOTO Label888; EXITS Label888 => NULL};M←0;--'BREAKPOINT' END ELSE BEGIN N←PascalReadInteger[file: @TermIn];SELECT M FROM--1212:--1 =>PrintWord[Mem[N]↑]; 2 =>PrintInt[Mem[N]↑.Hh.Lh];3 =>PrintInt[Mem[N]↑.Hh.Rh]; 4 =>BEGIN PrintInt[Eqtb↑[N].Lh];PrintChar[58];PrintInt[Eqtb↑[N].Rh]; END; 5 =>PrintVariableName[N];6 =>PrintInt[Internal↑[N]]; 7 =>DoShowDependencies[];9 =>ShowTokenList[N,0,100000,0];10 =>Print[N]; 11 =>CheckMem[N>0];12 =>SearchMem[N];13 =>BEGIN L←PascalReadInteger[file: @TermIn]; PrintCmdMod[N,L]; END;14 =>FOR i:INT IN [ INT[0 ].. INT[N ]] DO K ← i; Print[Buffer↑[K]] ENDLOOP; 15 =>Panicking← NOT Panicking;--:1212-- ENDCASE =>Print[63]; END; END ENDLOOP ;EXITS Label10 => NULL}; END; END.