Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/main10.b36
There are no other files named main10.b36 in the archive.
MODULE MAIN10 (
		  IDENT = '1',
			MAIN = START
		  ) =
BEGIN


! REMAIN IN DEC.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT
! CORPORATION.
!
! DEC ASSUMES  NO  RESPONSIBLILTY  FOR  THE USE OR  RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
!
!++
! FACILITY:
!	RMCOPY for TOPS-10 only
!
! ABSTRACT:
!	This is the system-dependent startup interface for RMCOPY/TOPS-10
!
! ENVIRONMENT:
!	RMCOPY under TOPS10
!
! AUTHOR: Dave Cornelius, CREATION DATE: Mar 20, 1978
!
! MODIFIED BY:
!     , : VERSION
! 01   -	In the begining ...
! 02	APR 26, 1978 D CORNELIUS MADE TBL LIBRARY THE IPCF LIBRARY
! 03	17-May-78 D Cornelius fixed up Segment table builder to do GETTABs
! 04	14-Aug-78 D Cornelius Change main loop to loop if
!		PROMPT_FLAG (instead of CCLFLG) is lit.
!		(see also IO10.B36 edit 7)
!--
!
! TABLE OF CONTENTS:
!
FORWARD ROUTINE
	START;		!The entry point

!
! INCLUDE FILES:
!
LIBRARY 'IPCF';		!To get CALLI defns
LIBRARY 'RMCOPY';

!
! EQUATED SYMBOLS:
!
FIELD GETSEG_BLK = SET
GS$DEV=[0,0,36,0],
GS$FILE=[1,0,36,0],
GS$EXT=[2,0,36,0],
GS$UNK1=[3,0,36,0],
GS$PPN=[4,0,36,0],
GS$UNK2=[5,0,36,0]
TES;

!
! MACROS:
!
BUILTIN MACHOP;
MACRO RESCAN = MACHOP (%O'051', %O'10',0) %;
MACRO GS_BLOCK=BLOCK[6] FIELD (GETSEG_BLK) %;

!
! OWN STORAGE:
!
GLOBAL
	CCLPTR,		!Points to the rest of the command line, or /LIST
	CCLFLG,		!NEQ 0 means the CCLPTR has good data
	GSTBND:GS_BLOCK,!The NODTBL GETSEG block
	GSTBRM:GS_BLOCK,!The RMCOPY GETSEG block
	G$NOW,		!Holds the universal date-time for the run
	G$DBUG:INITIAL(0);!Anyone can set this non-zero, and get additional
			!Debugging info at various points.

!
! EXTERNAL REFERENCES:
!

EXTERNAL ROUTINE
	RMC_ENTRY_EXIT,		!The first piece of transportable code
	BYPSBL,		!A routine to skip blanks
	FND_PATTERN,	!To match up RUN, START, RMCOPY
	GET_INPUT_STRIN,!To re-read the command line after RESCAN
	RMC_STRIP_STRIN,!To read a word from the command line
	STOP;		!To return to the monitor (in MSCMAC.MAC)

EXTERNAL
	G$ININ,G$INEO,
	RMCRUNTAB;	!The table of legal monitor commands
ROUTINE START (DUMMY1, DUMMY2, DUMMY3, DUMMY4, CCL) =		!

!++
! FUNCTIONAL DESCRIPTION:
!	This routine is the first piece of code executed by RMCOPY
!	It must handle the CCL entry and (future) the program call entry.
!	It may rescan the command line to strip off RUN and START and RMCOPY
!	commands.  It finally calls John's transportable
!	command scanner, indicating whether to prompt the user for input.
!	It also does some GLOBAL initialization of the system dependent
!	portions of the command scanner.
!
! FORMAL PARAMETERS:
!
!	4 dummy args, (sometimes tell what prog it is), and the CCL
!	entry flag (generated by BLISS).
!
! IMPLICIT INPUTS:
!
!	The way the program was started (RUN, START, RMCOPY, etc)
!
! IMPLICIT OUTPUTS:
!
!	The routine sets some own communication flags for GET_INPUT_STRING
!	It may also initialize some system dependent flags and OWNs
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

BEGIN
	LITERAL MAXCHARS = 128;		!Max chars on a monitor command line
	LITERAL GETTAB = %O'041';
	LITERAL GETPPN = %O'024';
	LITERAL RESET = %O'000';
	REGISTER AC;			!For the GETTAB and GETPPN CALLIs
	LOCAL
		NUMCHRS,		!The number of chars on the command line
		CMDCOD,			!The code for match on START, RUN, or RMCOPY
		PROMPT_FLAG,		!Tell RMC_ENTRY_EXIT whether to prompt
		ERRCOD,			!The value returned by RMC_ENTRY_EXIT
		T_PTR,			!A temporary, one use pointer
		LST_BUF:BLOCK[CH$ALLOCATION(6)],!A lowseg holding place for /LIST
		IN_PTR,			!The main, advancing text pointer
		IN_BUF:BLOCK[CH$ALLOCATION(MAXCHARS+2)];	!Space for chars + a LF + a null

	AC<LH> = -1;			!Aim at ourselves
	AC<RH> = %O'135';		!Table .GTRDV (Device of program)
	GSTBRM [GS$DEV] = (IF CALLI (AC, GETTAB) THEN .AC ELSE %SIXBIT 'DSK   ');
	AC<RH> = %O'137';		!Table .GTRFN (Filename for program)
	AC<LH> = -1;			!Aim at ourselves
	GSTBRM [GS$FILE] = (IF CALLI (AC, GETTAB) THEN .AC ELSE %SIXBIT 'RMCOPY');
	GSTBRM [GS$EXT] = 0;		!No low extension
	AC<LH> = -1;			!Aim at ourselves
	AC<RH> = %O'136';		!Table .GTRDI (Directory of program)
	GSTBRM [GS$PPN] = (IF CALLI (AC, GETTAB) THEN .AC
			ELSE (CALLI (AC, GETPPN); .AC));
	GSTBRM [GS$UNK1] = GSTBRM [GS$UNK2] = 0;	!Clear out the unknowns

	GSTBND [GS$DEV] = %SIXBIT 'SYS';
	GSTBND [GS$FILE] = %SIXBIT 'NODTBL';
	GSTBND [GS$EXT] = 0;
	GSTBND [GS$PPN] = 0;
	GSTBND [GS$UNK1] = GSTBND [GS$UNK2] = 0;
	
!	IF .CCL THEN read CCL command file
!	ELSE
!	BEGIN
	RESCAN;			!Take another look at the input
		IN_PTR = CH$PTR (IN_BUF); !Aim at the buffer
		NUMCHRS = GET_INPUT_STRIN (G_I_S$CHTTY, IN_PTR, MAXCHARS);
		CH$WCHAR (%O'0', .IN_PTR); !Make it ASCIZ
		IN_PTR = CH$PTR (IN_BUF);
		BYPSBL (IN_PTR);	!Skip the blanks
		T_PTR = .IN_PTR;		!Copy into a temp that mon't move
		CMDCOD = FND_PATTERN (.T_PTR, RMC_STRIP_STRIN (IN_PTR), RMCRUNTAB);
		BYPSBL (IN_PTR);	!Move to next interesting char
		CH$MOVE (6, CH$PTR (UPLIT (%ASCIZ '/LIST')), CH$PTR (LST_BUF));
		CCLPTR = CH$PTR (LST_BUF); !Assume default for CCL
		PROMPT_FLAG = NOT (CCLFLG = MAIN$NOPROMPT);	!Assume prompting is neccessary
		IF .CMDCOD EQL RMCOPY$SWITCH THEN
		BEGIN
			PROMPT_FLAG = NOT (CCLFLG = MAIN$PROMPT);
			IF CH$RCHAR (.IN_PTR) NEQ %O'0' THEN CCLPTR = .IN_PTR
		END;
		!Then replace the terminating null with a LF
		CH$WCHAR (%O'12', CH$FIND_CH (MAXCHARS, .CCLPTR, %O'0'));
!	END
!	Here is the place to do ONCE only initializations
!	Now... enter the loop for prompting
	DO BEGIN
		!For each prompting cycle, do some more initialization
		CALLI (AC,RESET);
		G$ININ = G$INEO = 0;
		AC <RH> = %O'11';	!Table 11, configuration table
		AC <LH> = %O'53';	!Item 53, universal date time
		CALLI (AC,GETTAB);	!..what time is it???
		G$NOW = .AC;		!So early???
		!Then do the commands
		ERRCOD = RMC_ENTRY_EXIT (.PROMPT_FLAG);
	END WHILE (.ERRCOD EQL 0) AND (.PROMPT_FLAG EQL MAIN$PROMPT);
	CALLI (AC,RESET);		!Leave things clean on way out
	STOP();			!Out the monitor
	.ERRCOD		!The value of the program
END;
END ELUDOM