perm filename RECGC[S,AIL]1 blob sn#105664 filedate 1974-06-06 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00008 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	ENQR, ENQRB, ENQRBB
C00005 00003	%PSMRR:	
C00006 00004	RCIMRK -- MARK ALL RECORD ITEMS
C00008 00005	
C00010 00006	$RGCMK & $RGCSW
C00012 00007	HEREFK($RECGC,$RECG.)
C00013 00008	HEREFK($M1FLD,$M1FL.)
C00018 ENDMK
CāŠ—;
;;ENQR, ENQRB, ENQRBB

HEREFK($ENQR,$ENQR.)
	JUMPE	A,CPOPJ			;NULL NEVER
	HRRZ	TEMP,-1(A)		;BE SURE NOT THERE YET
	JUMPE	TEMP,CPOPJ
	HRR	TEMP,RECCHN		;LINK ONTO CHAIN
	HRRM	TEMP,-1(A)
	HRRM	A,RECCHN
	POPJ	P,

ENQRB:	TLNN	C,-1			;C =-COUNT,,ADR
	POPJ	P,			;NULL CALL
	HRRZ	A,(C)
	PUSHJ	P,$ENQR			;PUT ONE ON QUEUE
	AOBJN	C,.-2			;ITERATE
	POPJ	P,

ENQRBB:	MOVE	C,(B)			;B ā†’ā†’ A BLOCK OF -CNT,,ADR WORDS
	JUMPE	C,CPOPJ			;TERMINATED BY A ZERO
	PUSHJ	P,ENQRB
	AOJA	B,ENQRBB		;ITERATE

ENQRBL: HRRZ	D,RBLIST		;ROUTINE THAT HANDLES RBLIST
EQRB.L:	JUMPE	D,CPOPJ
	HRRZI	B,1(D)			;POINT AT THIS BLOCK
	PUSHJ	P,ENQRBB		;MARK EM ALL
	HRRZ	D,(D)			;ITERATE
	JRST	EQRB.L			

PAMRK:  HLRZ	PDA,1(RF)		;HANDLES ONE EACH PROCEDURE ACTIVATION
	CAIN	PDA,SPRPDA		;CAN QUIT ON THIS
	POPJ	P,
	MOVEI	D,-1(RF)		;LAST PARAMETER LOCATION
	HRLI	D,C
	HRRZ	C,PD.NPW(PDA)		;NUMBER OF ARITH PARAMS
	MOVNI	C,(C)			;
	HRRZ	B,PD.DLW(PDA)		;POINT AT PARAMS
MKPRM:	AOJGE	C,PRMSDN		;COUNT UP, QUIT WHEN RUN OUT
	LDB	TEMP,[POINT =12,(B),=12] ;INTERESTED IN VALUE RECORDS
	CAIE	TEMP,RECTYP		;TEST CODE
	AOJA	B,MKPRM			;NO, GO MARK NEXT
	HRRZ	A,@D			;PICK UP PARAMETER
	PUSHJ	P,$ENQR			;HANDLE IT
	AOJA	B,MKPRM
PRMSDN: HRRZ	B,PD,LLW(PDA)		;POINT AT LVI
LVI.DO:	SKIPN	D,(B)			;A ZERO MEANS DONE
	POPJ	P,
	LDB	TEMP,[POINT 4,D,3]
	CAIN	TEMP,RPACOD
	JRST	MRKRPA
	CAIE	TEMP,RPCOD
	AOJA	B,LVI.DO
	HRRZ	A,@D			;GET DESCRIPTOR
	PUSHJ	P,$ENQR
	AOJA	B,LVI.DO
MRKRPA:	SKIPN	C,@D
	AOJA	B,LVI.DO
	MOVN	TEMP,-1(C)		;WORD COUNT
	HRL	C,TEMP
	PUSHJ	P,ENQRB			;DO THEM ALL
	AOJA	B,LVI.DO

%PSMRR:	
	SKIPE	TEMP,RUNNER		;FANCY CASE
	JRST	PSMK.2			;HERE IF PROCESSES IN USE
	PUSH	P,RF			;SAVE RF
	PUSHJ	P,PSMK.1		;
	POP	P,RF
	POPJ	P,

PSMK.1:	PUSHJ	P,PAMRK			;MARK 
	HRRZ	RF,(RF)			;STATIC LINK
	CAIE	RF,-1			;DONE??
	JRST	PSMK.1			;NO
	POPJ	P,			;DONE ALL

PSMK.2:	MOVEM	RF,ACF(TEMP)		;SAVE RF IN TABLE
	HRLZI	B,-NPRIS
	HRR	B,GOGTAB
PSCHL:	SKIPN	TEMP,PRILIS(B)
	JRST	NXLS
	PUSH	P,B			;SAVE B
PSCHL2:	
	PUSH	P,TEMP
	MOVE	RF,ACF(TEMP)
	PUSHJ	P,PSMK.1		;MARK THAT STACK
	POP	P,TEMP
	HRRZ	TEMP,PLISTE(TEMP)
	JUMPN	TEMP,PSCHL2
	POP	P,B
NXLS:	AOBJN	B,PSCHL
	MOVE	TEMP,RUNNER
	MOVE	RF,ACF(TEMP)
	POPJ	P,
;;RCIMRK -- MARK ALL RECORD ITEMS

RCIMRK:	MOVE	USER,GOGTAB	
	SKIPE	HASMSK(USER)		;ACTUALLY HAVE LEAP
	SKIPG	C,MAXITM(USER)		;ALL THE ITEMS TO MARK
	POPJ	P,			;NOPE
RI1MK:	LDB	TEMP,INFOTAB(USER)	;GET TYPE
	MOVE	A,@DATAB(USER)		;AND DATUM READY
	CAIN	TEMP,REFTYP		;REFERENCE
	JRST	RFFOL
	CAIN	TEMP,ARYBRK+RECTYP	;RECORD ARRAY??
	JRST	RAIMK			;YES
	CAIN	TEMP,RECTYP		;REGULAR RECORD
	PUSHJ	P,$ENQR			;YES
RIMITR:	SOJG	C,RI1MK			;ITERATE
	POPJ	P,

RFFOL:	PUSHJ	P,$M1FLD		;MARK A FIELD
	JRST	RIMITR

RAIMK:	
	SKIPN	TEMP,@A			;POINT AT RECORD ARRAY
	JRST 	RIMITR			;EMPTY
	PUSH	P,C			;SAVE ITEM NUMBER
	MOVN	C,-1(TEMP)
	HRL	C,TEMP
	MOVS	C,C			;-CNT,,ADR
	PUSHJ	P,ENQRB			;HANDLE EM ALL
	JRST 	RIMITR			;ITERATE

$MKR1R:	PUSHJ	P,$ENQR			;ENQUEUE ONE RECORD
$MRK.1:	HRRZ	A,RECCHN		;GET A RECORD OFF THE CHAIN
	JUMPE	A,CPOPJ			;NONE LEFT
	MOVE	D,-1(A)			;CDR THE QUEUE
	HRRM	D,RECCHN
	MOVEI	D,@(A)			;GET HANDLER ADDRESS
	CAIN	D,$REC$			;STANDARD HANDLER??
	JRST	MFLDS1			;YES
	PUSH	P,[4]			;THE "MARK" OP
	PUSH	P,A			;REC ID
	PUSH	P,[0]			;PLACE HOLDER
	PUSHJ	P,(D)			;CALL ROUTINE
	JRST	$MRK.1

MFLDS1:	PUSH	P,[$MRK.1]
$MFLDS:	JUMPE	A,CPOPJ			;MARK ALL FIELDS OF RCD IN A
	HRRZ	C,(A)			;CLASS ID
	ADDI	A,1			;FIRST DATA FIELD
	SUBI	C,(A)			;CORRECTION FACTOR
	HRLI	C,(<POINT =13,(A),=12>)	;TO GET TYPE BITS
	PUSH	P,(C)			;SAVE IT
G1FLD:	LDB	C,(P)			;GET TYPE
	JUMPE	C,CPOP1J		;ALL DONE
	DPB	C,[POINT =13,A,=12]	;DESCRIPTOR FOR ONE FIELD
	PUSHJ	P,$M1FLD		;MARK ONE FIELD
	AOJA	A,G1FLD			;ITERATE UNTIL DONE
CPOP1J:	SUB	P,X11
CPOPJ:	POPJ	P,

;;$RGCMK & $RGCSW

$RGCMK: PUSH	P,RGCLST		;MARK PHASE
RGCMK1:	POP	P,A			;GET NEXT ENQUEUEING ROUTINE TO CALL
	JUMPE	A,CPOPJ			;NO MORE
	PUSH	P,(A)			;SAVE LINK
	PUSHJ	P,@1(A)			;CALL THIS FELLOW
	PUSHJ	P,$MRK.1		;GO PROCESS THE ONES WE HAVE NOW
	JRST	RGCMK1			;GO GET SOME MORE

$RGCSW:	HLRZ	A,RECCHN
	MOVEI	D,0			;NEW RECORD LIST
	JUMPE	A,RGSWPT		;DONE
RGSWPP:	MOVS	TEMP,(A)		;GET NEXT
	TLNN	TEMP,-1			;
	JRST	RGSWP1			;UNMARKED MEANS IT DIES
	HLLZM	D,(A)
	HRLZ	D,A
	HRRZ	A,TEMP			;POINT AT NEXT
	JUMPN	A,RGSWPP
RGSWPT:	MOVEM	D,RECCHN
	POPJ	P,

RGSWP1:	PUSH	P,TEMP			;WILL EVENTUALLY BE RECORD WE LOOK AT
	MOVEM	D,RECCHN	;OUT OF HARMS WAY
	HRRZI	TEMP,@(A)		;LOOK AT HANDLER ROUTINE
	CAIE	TEMP,$REC$		;IS IT STANDARD
	JRST	RGSWP3			;NO DO A REGULAR CALL
	PUSHJ	P,$RKILL		;KILL RECORD
RGSWP2:	MOVE	D,RECCHN
	POP	P,A
	JUMPN	A,RGSWPP
	JRST	RGSWPT

RGSWP3:
	PUSH	P,[5]		;KILL YOURSELF
	PUSH	P,A
	PUSH	P,[0]		;PLACE HOLDER
	PUSHJ	P,(TEMP)
	JRST	RGSWP2
HEREFK($RECGC,$RECG.)

	HLRZ	A,RECCHN	;FIRST VERIFY THAT THE CHAIN IS OK
	JUMPE	A,CPOPJ		;NO RECORDS AT ALL
RGC.1:	MOVE	D,A		;FOR REMEMBERING
	MOVS	A,(A)		;CHECK LINK
	TLNE	A,-1
	JRST	RGCLER		;LINK GLUBBED UP
	JUMPN	A,RGC.1		;GO BACK & CHECK NEXT ONE
RGC.2:	PUSHJ	P,$RGCMK	;MARK THEM ALL
	PUSHJ	P,$RGCSW	;SWEEP THEM ALL
	POPJ	P,		;ALL DONE

RGCLER:	CAI	D,
	ERR	<GLUBBED UP RECORD LINK FOUND BY RECORD GC>,7
	SETZM	(D)		;JUST CUT YOUR LOSSES
	JRST	RGC.2

HEREFK($M1FLD,$M1FL.)
		;CALLED WITH REFITEM TYPE DESCRIPTOR IN A
		;WILL TAKE ALL APPROPTIATE ACTION
		;PRESERVES A BUT ALL OTHERS MAY BE MUNGED

	JUMPE	A,CPOPJ		;NOTHING TO DO IF NULL
	TLNN	A,ITEMB		;NOTHING TO DO IF ITEMISH
	TLNE	A,PROCB		;OR PROCEDURE
	POPJ	P,
	LDB	TEMP,[POINT 6,A,=12] ; SIX BIT TYPE
	CAIN	TEMP,RECTYP	;A RECORD??
	JRST	$ENQR		;YES, ENQUEUE IT
	CAIN	TEMP,REFTYP	;A REFERENCE ITSELF
	JRST	M1REF		;YES
	CAIE	TEMP,RECTYP+ARYBRK; A RECORD ARRAY??
	POPJ	P,		;NOPE
	PUSH	P,A		;SINCE AGREED TO LEAVE ALONE
	PUSH	P,B
	SKIPN	B,(A)		;PICK UP ARRAY DESCRIPTOR
	POPJ	P,		;EMPTY
	MOVN	TEMP,-1(B)	;WORD COUNT
	JUMPE	TEMP,M1AXIT	;NO WORDS
	HRL	B,TEMP
M1ALP:	MOVE	A,(B)		;PICK UP A WORD
	PUSHJ	P,$ENQR		;ENQUEUE IT
	AOBJN	B,M1ALP
M1AXIT:	POP	P,B		;
	POP	P,A
	POPJ	P,

M1REF:	PUSH	P,A
	MOVE	A,@A
	PUSHJ	P,$M1FLD	;MARK THE THING REFERENCED
	POP	P,A
	POPJ	P,