perm filename SEGFND.SAI[S,AIL]1 blob
sn#055566 filedate 1973-07-27 generic text, type T, neo UTF8
COMMENT ⊗ VALID 00005 PAGES
RECORD PAGE DESCRIPTION
00001 00001
00002 00002 BEGIN "SEGFND"
00005 00003 PROCEDURE SEGSCH(INTEGER PPNAME)
00009 00004 PROCEDURE MFDSCH(INTEGER PPN,MSK)
00010 00005 MAIN LOOP
00011 ENDMK
⊗;
BEGIN "SEGFND"
COMMENT GLOBAL DECLARATIONS;
REQUIRE "ABBREV.SAI[S,RHT]" SOURCE_FILE;
REQUIRE "IOPKT.SAI[S,RHT]" SOURCE_FILE;
DEFINE RFETCH=0;
INTEGER DIRCH,EOF,BRCH,MFDSIZE,DIRSIZE;
DEFINE MAXCARE=6; COMMENT MAX SEG NO CARE ABOUT;
PRELOAD_WITH
CVSIX("SAISEG"),
CVSIX("SAISG1"),
CVSIX("SAISG2"),
CVSIX("SAISG3"),
CVSIX("SAISG4"),
CVSIX("SAISG5"),
CVSIX("SAISG6");
INTEGER ARRAY SEGNAME[0:MAXCARE];
DEFINE MAXNEED=512;
DEFINE JOBSA='120;
INTEGER ARRAY LOOKUPBLOCK[0:5];
INTEGER MASK;
STRING PRJ,PRG;
IFC RFETCH THENC
INTEGER ARRAY MAP[0:511];
INTEGER ARRAY CORE[1:4,0:511];
INTEGER ARRAY PGTB[1:4];
INTEGER ARRAY REFT[1:4];
INTEGER TIME;
INTEGER SIMPLE PROCEDURE FETCH(INTEGER ADDR);
BEGIN
INTEGER PG,OFFSET;
INTEGER X,Y,Z;
X←ADDR LAND '777777; COMMENT '74 IS FIRST IN FILE;
IF X<'74 THEN RETURN(0) ELSE X←X-'74;
OFFSET ← X LAND '777;
PG ← X LSH -9;
IF MAP[PG]>0 THEN
BEGIN
REFT[MAP[PG]]←TIME←TIME+1;
RETURN(CORE[MAP[PG],OFFSET]);
END;
USETI(DIRCH,PG LSH 2);
X←TIME←TIME+1;
FOR Z← 1 STEP 1 UNTIL 4 DO
IF REFT[Z]<X THEN BEGIN Y←Z; X←REFT[Z]; END;
MAP[PG]←Y;
PGTB[Y]←PG;
ARRYIN(DIRCH,CORE[Y,0],512);
REFT[Y]←TIME;
RETURN(CORE[Y,OFFSET]);
END;
ELSEC
DEFINE MAXLOOK='600;
DEFINE HILOC='135;
DEFINE FIRLOC='74;
INTEGER ARRAY FILBUF[0:MAXLOOK];
ENDC
PROCEDURE SEGSCH(INTEGER PPNAME);
BEGIN
INTEGER DIRSIZE;
STRING PPSTR;
LOOKUP(DIRCH,(PPSTR←CVXSTR(PPNAME))&".UFD[1,1]",EOF);
IF EOF THEN
BEGIN
IF ASK("CANNOT FIND "&PPSTR&".UFD[1,1]"&CRLF
&"CONTINUE") THEN RETURN
ELSE BEGIN CLOSE(OUCH);CALL(0,"EXIT"); END;
END;
FILEINFO(LOOKUPBLOCK);
START_CODE;
MOVS LOOKUPBLOCK[3];
ASH -2;
MOVNM DIRSIZE;
END;
IF DIRSIZE > 0 THEN
BEGIN
INTEGER ARRAY UFD[1:DIRSIZE,0:3];
INTEGER I;
LABEL RDIR;
RDIR: ARRYIN(DIRCH,UFD[1,0],DIRSIZE*4);
CLOSE(DIRCH);
PPSTR←".DMP["&PPSTR[1 FOR 3]&","&PPSTR[4 TO ∞]&"]";
FOR I←1 STEP 1 UNTIL DIRSIZE DO
IF UFD[I,1] LAND '777777000000 = CVSIX("DMP ") THEN
BEGIN
INTEGER J,K;
STRING FID;
IFC RFETCH THENC
ELSEC
SIMPLE PROCEDURE WRSEG(INTEGER I,SSFG);
WRITE(CVXSTR(I)&TAB&FID
&(IF SSFG THEN "(SSAVED)" ELSE NULL));
ENDC
LOOKUP(DIRCH,FID←CVXSTR(UFD[I,0])&PPSTR,EOF);
IFC RFETCH THENC
TIME←0;
FOR J←1 STEP 1 UNTIL 4 DO
IF REFT[J]>0 THEN
BEGIN
K←PGTB[J];
MAP[K]←REFT[J]←PGTB[J]←0;
END;
TIME←0;
J←FETCH(JOBSA);
J←FETCH(J+2); COMMENT SAILOR;
J←FETCH(FETCH(J+1)); COMMENT JSP .SEG2.;
J←FETCH(FETCH(J+2)); COMMENT SIXBIT;
CLOSE(DIRCH);
FOR K← 0 STEP 1 UNTIL MAXCARE DO
IF J=SEGNAME[K] THEN
WRITE(CVXSTR(J)&TAB&FID);
ELSEC
ARRYIN(DIRCH,FILBUF[0],MAXLOOK);
CLOSE(DIRCH);
START_CODE "INNER"
INTEGER I;
LABEL CHECK,CHECK1,WIN,XIT;
MOVEI 1,FILBUF['200];
HRLI 1,'200-MAXLOOK;
MOVEM 1,I;
MOVEI 2,SEGNAME[0];
HRLI 2,-MAXCARE-1;
CHECK: MOVE 3,(2); COMMENT GET A SEGNAME;
CHECK1: CAMN 3,(1); COMMENT IS IT THIS WORD;
JRST WIN; COMMENT I WIN;
AOBJN 1,CHECK1; COMMENT TRY NEXT WORD;
MOVE 1,I; COMMENT FOR NEXT PASS;
AOBJN 2,CHECK; COMMENT NEXT SEGNAME;
JRST XIT;
WIN: PUSH '17,3; COMMENT THE SEGNAME;
PUSH '17,FILBUF[HILOC-FIRLOC]; COMMENT ≠0 IF SSAVED;
PUSHJ '17,WRSEG; COMMENT WRITE THE SEGN;
XIT: END "INNER";
ENDC
END;
END;
END;
PROCEDURE MFDSCH(INTEGER PPN,MSK);
BEGIN
LOOKUP(DIRCH," 1 1.UFD[1,1]",EOF);
IF EOF THEN
BEGIN
IF ASK("CANNOT LOOKUP MFD -- CONTINUE") THEN RETURN;
CLOSE(OUCH);CALL(0,"EXIT");
END;
FILEINFO(LOOKUPBLOCK);
START_CODE;
MOVS LOOKUPBLOCK[3];
ASH -2;
MOVNM MFDSIZE;
END;
BEGIN COMMENT DYNAMIC BLOCK;
INTEGER ARRAY MFD[1:MFDSIZE,0:3];
INTEGER EN;
ARRYIN(DIRCH,MFD[1,0],MFDSIZE*4);
CLOSE( DIRCH);
FOR EN←1 STEP 1 UNTIL MFDSIZE DO
IF PPN=MFD[EN,0] LAND MSK THEN SEGSCH(MFD[EN,0]);
END;
END;
COMMENT MAIN LOOP;
OPEN(DIRCH,"DSK",'17,0,0,0,0,EOF);
DO
BEGIN
INTEGER PPN;
MASK←-1;
PRJ←REQSTR("PROJECT (* FOR ALL)");
PRG←REQSTR("PROGRAMMER (* FOR ALL)");
IF EQU(PRJ,"*") THEN MASK←'777777;
IF EQU(PRG,"*") THEN MASK ← MASK LAND '777777000000;
PRJ←" "&PRJ;
PRG←" "&PRG;
PRJ←PRJ[∞-2 TO ∞];
PRG←PRG[∞-2 TO ∞];
PPN←CVSIX(PRJ&PRG);
IF MASK=-1 THEN SEGSCH(PPN) ELSE MFDSCH(PPN LAND MASK,MASK);
END UNTIL ¬ASK("DONE THAT REQUEST. MORE?");
CLOSE_OUTPUT;
END "SEGFND"