Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50325/ccl.bli
There are no other files named ccl.bli in the archive.
! File:   CCL.BLI
!
!    This work was supported by the Advanced Research
!    Projects Agency of the Office of the Secretary of
!    Defense (F44620-73-C-0074) and is monitored by the
!    Air Force Office of Scientific Research.

MODULE CCL(TIMER=EXTERNAL(SIX12))=
BEGIN
EXTERNAL CCLCTL;

REQUIRE IO.BEG;
BEGIN

MACRO CCLBP=BUFDATA[0,BYTEPF]$,	CCLBUF=(CMDBUF+2)$;

MACRO	CCLIN=CCLCTL$,
	CCLREAD=CCLCTL<1,1>$;	%CCL IMAGE IN CORE%

BIND	
	BLI6=SIXBIT '   BL1',

	CCLCHNL=0,		% SOFTWARE CHNL FOR CCL %
	MODE=#17,		% DUMP MODE INPUT %

	CCLR=1,			% TMPCOR READ CODE %
	CCLRD=2;		% TMPCOR READ & DELETE CODE %

MACHOP
	CALLI=#047,
	CLOSE=#70,
	ENTER=#77,
	INPUT=#066,
	LOOKUP=#076,
	OPEN=#50,
	OUTPUT=#67,
	RELEAS=#071,
	RENAME=#055,
	STATO=#61,
	USETI=#74;

MACRO
	DATE(X)=CALLI(X,#14)$,		!GETS DATE
	GETPPN(X)=CALLI(X,#24)$,	!GETS PPN
	PJOB(X)=CALLI(X,#30)$,		!GETS JOB NUMBER
	RESET=CALLI(0)$,	% RESETS I/O CHNLS %
	TMPCOR(X)=CALLI(X,#44)$,	% OPERATES ON TMPCOR FILES %

	STATUS=OPENBLOCK[0]$,
	DEVICE=OPENBLOCK[1]$,
	OIBUFF=OPENBLOCK[2]$,

	FILENAME=LOOKUPBLOCK[0]$,
	EXTNAME=LOOKUPBLOCK[1]$,
	PPN=LOOKUPBLOCK[3]$,
	WORDCOUNT=LOOKUPBLOCK[3]<18,18>$,

	DMPLEN=DMPCTL[0]<18,18>$,
	DMPADDR=DMPCTL[0]<0,18>$,
	DMPNEXT=DMPCTL[1]$;

BIND
	STATCHNL=5,		!CHANNEL USED FOR I/O
	STATDEV=SIXBIT 'DSK',	!I/O DEVICE NAME
	STATMODE=#17,		!I/O MODE
	STATFILE=SIXBIT 'B11STA', !STATISTICS FILE NAME
	STATEXT=SIXBIT 'DAT',	!STATISTICS FILE EXTENSION
	STATPPN=#31477266077,	!STATISTICS FILE OWNER
	STATBLKSIZE=8,		!NO. OF WORDS PER STATISTICS RECORD
	ERRBITS=#740000;	!I/O ERROR BITS TO CHECK

FORWARD CCLTMPCOR, CCLFILE;

GLOBAL ROUTINE CCLINIT=
    BEGIN
    IF .CCLIN AND .CCLREAD THEN RETURN;
    IF .CCLIN THEN
	BEGIN
	    IF NOT CCLTMPCOR() THEN
		IF NOT CCLFILE() THEN
		    BEGIN
		    CCLIN_0;
		    RETURN
		    END
    END
END;

ROUTINE CCLFILE=
BEGIN
    REGISTER R;
    LOCAL	S,
	OPENBLOCK[4],
	DMPCTL[2],
	LOOKUPBLOCK[4];

!	TRY TO READ A FILE CALLED ###XXX.TMP
!	WHERE ### IS THE DECIMAL JOB NUMBER
!	AND XXX IS "B11" FOR BLIS11 OR "BLI" FOR BLIS10

    S_FILENAME<36,6>;
    PJOB(R);		% GET JOB NUMBER %
    REPLACEI (S, .R/100+#20);
    R_.R MOD 100;
    REPLACEI(S, .R/10+#20);
    R_.R MOD 10;
    REPLACEI(S, .R+#20);


!	TRY TO GET DEVICE DSK
    DEVICE_SIXBIT 'DSK';
    STATUS_MODE;
    OIBUFF_0;
    IF NOT SKIP(OPEN(CCLCHNL,STATUS)) THEN RETURN 0;

!	TRY TO FIND FILE
    FILENAME<0,18>_BLI6;
    EXTNAME_SIXBIT 'TMP';
    PPN_0;
    IF NOT SKIP(LOOKUP(CCLCHNL,FILENAME)) THEN
	(RELEAS(CCLCHNL); RETURN 0);

!	LOOKUP SUCCEEDED.  THE WORD COUNT OF THE
!	FILE IS A NEGATIVE NUMBER IN "WORDCOUNT"
!
!	NOW SET UP CHANNEL COMMAND LIST OF
!	THE FORM
!		XWD -COUNT,ADDR-1
!		XWD 0,0
    R_(.WORDCOUNT OR -1^18);
    R_CCLBUF;
    DMPADDR_.R-1;
    DMPLEN_.WORDCOUNT;
    DMPNEXT_0;

!	NOW READ THE FILE
    INPUT(CCLCHNL,DMPCTL);
!	DELETE THE FILE
    FILENAME_0;
    RENAME(CCLCHNL,FILENAME);
    RELEAS(CCLCHNL);

!	SET UP CONTROL WORDS IN IO MODULE
    CCLBP_CCLBUF<36,7>;
    CCLREAD_1;
    RETURN 1;
END;


ROUTINE CCLTMPCOR=
BEGIN
    LOCAL CCLPARM[2], SCRATCH;
    REGISTER AC;
    MACRO
	CCLNAME=CCLPARM[0]$,
	CCLBUFLEN=CCLPARM[1]<18,18>$,
	CCLBUFFER=CCLPARM[1]<0,18>$,
	CCLCODE=AC<18,18>$,
	CCLADDR=AC<0,18>$,
	CCLWORD=AC$;

!	MAKE UP THE CONTROL LIST
!
!	CCLWORD			CCLPARM
!	CODE,, .--------------> SIXBIT /XXX/
!				-LENGTH,,BUFFER-1
!
!	WHERE XXX IS B11 FOR BLIS11 OR BLI FOR BLIS10
!
    CCLCODE_CCLR;	% READ NO DELETE %
    CCLADDR_CCLNAME;
    CCLNAME_BLI6^18;
    CCLBUFLEN_-1;	% DUMMY BUFFER LENGTH %
    CCLBUFFER_(SCRATCH-1)<0,0>;	% DUMMY BUFFER %

!	TRY TO READ THE FILE INTO A SHORT BUFFER
!	IF THIS UUO FAILS, WE DON'T HAVE A CCL TMPCOR BUFFER
!	IF IT SUCCEEDS, IT RETURNS THE ACTUAL LENGTH OF THE
!	    FILE IN CCLWORD
    IF NOT SKIP (TMPCOR(CCLWORD)) THEN RETURN 0;
    CCLBUFLEN_-.CCLWORD;
    CCLBUFFER_CCLBUF-1;
!	RESET THE BUFFER SIZE AND CHANGE THE CODE TO
!	READ & DELETE, AND ISSUE THE UUO AGAIN.  IT MUST
!	SUCCEED.
    CCLCODE_CCLRD;
    CCLADDR_CCLNAME;
    SKIP(TMPCOR(CCLWORD));
!	SET UP THE CONTROL INFORMATION IN IO MODULE
    CCLBP_CCLBUF<36,7>;
    CCLREAD_1;

    RETURN 1;
END;


%<
GLOBAL ROUTINE OUTSTAT=
    BEGIN
    LOCAL OPENBLOCK[3],LOOKUPBLOCK[4],DMPCTL[2],DMPBUF[STATBLKSIZE];
    REGISTER R;
    MACRO MAGICFILE=(.(BXA+#16)+#112)$,
	  MAGICEXT= (.(BXA+#16)+#113)$;

    DEVICE_STATDEV;
    STATUS_STATMODE;
    OIBUFF_0;
    IF NOT SKIP(OPEN(STATCHNL,OPENBLOCK)) THEN RETURN 1;

    FILENAME_STATFILE;
    EXTNAME_STATEXT;
    PPN_STATPPN;
    DO BEGIN
	IF NOT SKIP(LOOKUP(STATCHNL,LOOKUPBLOCK))
	    THEN (RELEAS(STATCHNL); RETURN 0);
	PPN_STATPPN;
	END
      UNTIL SKIP(ENTER(STATCHNL,LOOKUPBLOCK));

    USETI(STATCHNL,-1);

    DMPBUF[0]_.MAGICFILE;
    DMPBUF[1]_.MAGICEXT;
    DMPBUF[2]_GETPPN(R);
    DMPBUF[3]_DATE(R);
    DMPBUF[4]_.B11LO;
    DMPBUF[5]_.CODESIZE;
    DMPBUF[6]_.DATASIZE;
    DMPBUF[7]_.RUTIME;

    DMPADDR_DMPBUF-1;
    DMPLEN_-STATBLKSIZE;
    DMPNEXT_0;
    OUTPUT(STATCHNL,DMPCTL);
    IF SKIP(STATO(STATCHNL,ERRBITS)) THEN (RELEAS(STATCHNL); RETURN 1);
    CLOSE(STATCHNL);
    RELEAS(STATCHNL);
    RETURN 0;
    END;

>%
END;
.VREG
END