Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/rmcsca.bli
There are no other files named rmcsca.bli in the archive.
MODULE RMSCAN(!RMCOPY SYNTAX CHK SWITCH OPTION ANALYSIS TEST AND INPUT REQUEST ROUTINES
		  IDENT = '10'
		  ) =
BEGIN


! COPYRIGHT (C) 1978
! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS 01754
!
! THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE
! COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY WITH  THE INCLUSION OF THE
! ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE, OR ANY OTHER COPISE THEREOF,
! MAY NOT BE PROVIDED OR  OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
! EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE
! TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES
! 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 TRANSPORTABLE CODE
!
! ABSTRACT:
!	This module DOES the INPUT COMD REQUEST, BASIC SYNTAX TESTING AND 
!	OPTION SWITCH DETECTIION AND LEGALLY CHKING.
!	indirect command file REQUESTS,CMD STRING AND node name 
!	checking ARE ALSO DONE IN THIS MODULE.
!
! ENVIRONMENT:
!	TRANSPORTABLE
!
! AUTHOR: JOHN DEROSE, CREATION DATE: FEB 1978
!
! MODIFIED BY:
!
!--
!
!
! CONDITIONAL COMPILATION:
!
!	NONE

! TABLE OF CONTENTS:
!
FORWARD ROUTINE
	RMC_CMD_STRING,	!GET A COMPLETE CMD STRING FROM INPUT SOURCE ROUTINE
	RMC_SCAN,	!CONTROL ROUTINE FOR SYNTAX/SWITCH CHECK
	RMC_INPUT,	!REQUEST CMD STRING SEGMENT ROUTINE
	RMC_NOD,	!CHK NODE FROM COMMAND STRING ROUTINE
	RMC_FILE_SPEC,	!START/BUILD FILE SPEC ROUTINE
	RMC_TERM_SPEC;	!TERMINATE FILE SPEC ROUTINE
!
! DEFINITION LIBRARY FILES:
!
LIBRARY 'RMCOPY';	!The interface to the system-independent portion
!
! MACROS:
!
!
! EQUATED SYMBOLS:
!
!
! OWN STORAGE:
!
!
! EXTERNAL REFERENCES:
!
EXTERNAL ROUTINE 
	MSGERR,				!MESSAGE/ERROR ROUTINE
	RMC_STRIPSTRING,		!RMC STRIP A STRING OUT OF A TEXT STRING ROUTINE
	CMD_DEFAULT,			!INDIRECT CMD FILE DEFAULT ROUTINE
	RMC_SWITCH,			!RMC SWITCH PATTERN CHK ROUTINE
	RMC_SOPTION,			!RMC SWITCH OPTION CHK ROUTINE
	MORE_CHK,			!MORE AND '-' CHK ROUTINE
	CHK_NODEID,			!CHECK NODE ID ROUTINE(NODE TABLE INFORMATION)
	CHK_NEXT_CHAR,			!CHECK NEXT CHAR ROUTINE
	GETVRS,				!GET VERSION ROUTINE
	RMC_MSG,			!RMC MSG TTY-OUTPUT ROUTINE
	FND_PATTERN,			!FIND PATTERN ROUTINE
	RMC_FPARSE,			!RMC FILE PARSER ROUTINE
	INIT_INDIRECT,			!INIT INDIRECT FILE ROUTINE
	GET_INPUT_STRIN;		!GET INPUT TEXT STRING ROUTINE



EXTERNAL
	RMCOPTTAB,			!RMC OPTION TABLE
	RMCVRS,				!RMCOPY VERSION TEXT STRING
	TOTALCHARCOUNT,			!TOTAL COMMAND CHARACTER COUNT INDEX
	LNSTRG:CH$SEQUENCE[MAX$NODESIZE],!LOCAL NODE TEXT STRING STORAGE
	STRG_1 :CH$SEQUENCE[MAX$CMDSIZE],!INPUT CMD STRING STORAGE
	EVALBLK: VECTOR[EVAL$SIZE],	!EVALUATION PTR/STATUS BLOCK
	SDRMCBLK: VECTOR[SD$SIZE];	!SEND RMC BLOCK
!
!
!





GLOBAL ROUTINE RMC_CMD_STRING=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!	THIS ROUTINE IS USED TO OBTAIN A FULL CMD TEXT STRING
!	FROM AN EXTERNAL INPUT(SYSTEM INPUT).   THE ROUTINE 
!	SIGNALS INDIRECT FILE INPUTS AND ELIMINATES /MORE AND -
!	SWITCHES.   INDIRECT CMD FILE COMMENTS ARE THROWN AWAY 
!	IN THIS ROUTINE.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	SINCE THE INITIAL CMD STRING IS ALWAYS KEPT IN STRG_1
!	,  STRG_1 IS WHERE DATA WILL BE PUT.
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
!	ROUTINE RETURNS
!		>0	THE CHAR. CNT OF THE CMD STRING
!		=0	NO INPUT STRING FOUND
!		<0	ERROR EXIT VALUE EQUALS ERROR NUMBER
!
! SIDE EFFECTS:
!
!--
LABEL LOOP1,LOOP2;

LOCAL	EVALPTR: REF EVAL_BLK,
	SDBKPTR: REF SD_RMCBLK;
LOCAL	PASTPTR,		!PAST PTR INTO COMMAND STRING
	PRESENTPTR,		!PRESENT PTR INTO COMMAND STRING
	PTR;			!WORKING PTR INTO COMMAND STRING
LOCAL CONTEXTCC,CSTRCHARCOUNT,ERRORWORD;

EVALPTR=EVALBLK;
SDBKPTR=SDRMCBLK;

CSTRCHARCOUNT=TOTALCHARCOUNT=0;	!INIT CHARACTER COUNTERS
PRESENTPTR=PTR=CH$PTR(STRG_1);	!SET UP COMMAND STRING TEXT POINTER


	IF.EVALPTR[EVAL$S_INDCOMPL]
	THEN BEGIN
		RMC_MSG(RMCIFI,S$COMMENT)
	     END;


LOOP1: BEGIN
WHILE 1 DO 
BEGIN

	CH$FILL(%O'0',MAX$CMDSIZE-.TOTALCHARCOUNT,.PTR);	!ZERO OUT COMMAND STRING STORAGE SPACE FIRST

	IF (CSTRCHARCOUNT=RMC_INPUT(.PTR)) LSS 0
	THEN	RETURN .CSTRCHARCOUNT
	ELSE IF .CSTRCHARCOUNT EQL 0
	     THEN RETURN  .TOTALCHARCOUNT;




	!SCAN THE PRESENT COMMAND STRING UNTIL COMMAND STRING DELIMITER
LOOP2: BEGIN
	WHILE 1 DO
	BEGIN
	!
PASTPTR=.PTR;		!REMEMBER OLD POINTER
CONTEXTCC=RMC_STRIPSTRING(PTR);
PRESENTPTR=.PTR;
	SELECTONE CH$RCHAR_A(PTR) OF 
	SET


	[%C'-']:BEGIN
			!COMMAND STRING CONTINUATION SWITCH DETECTED
			!REQUEST FOR MORE OF THE COMMAND STRING
			TOTALCHARCOUNT=.TOTALCHARCOUNT-1;
			IF CHK_NEXT_CHAR(.PTR) NEQ C_N_C$NULL
			THEN 
			ELSE BEGIN
				IF NOT .EVALPTR[EVAL$S_INDCOMPL]
				THEN RMC_MSG(RMCMOR,S$CRLFMSG)
				ELSE;
				PTR=.PRESENTPTR;
				LEAVE LOOP2
			    END
		END;


	[%C'/']:BEGIN
			!THE BEGINNING OF A SWITCH OPTION
			ERRORWORD=MORE_CHK(.PTR);
			BEGIN
			  SELECTONE .ERRORWORD OF 
			  SET
				[M_CHK$MORE]:	BEGIN
						  PTR=.PRESENTPTR;
						IF NOT .EVALPTR[EVAL$S_INDCOMPL]
						THEN RMC_MSG(RMCMOR,S$CRLFMSG);
						  LEAVE LOOP2
						END;
				[OTHERWISE]:	BEGIN
						END;
			  TES
			END;
		END;

	[%C';']:BEGIN
		!BEGINNING OF A COMMENT HAS BEEN DETECTED
		!TERMINATE INPUT COMMAND STRING
		MSGERR(.PRESENTPTR,S$CRLFMSGCRLF);
		  TOTALCHARCOUNT=CH$DIFF(.PTR,CH$PTR(STRG_1))-1;
		  CH$WCHAR(%O'0',.PRESENTPTR);
		  PTR=.PRESENTPTR;
		  IF .TOTALCHARCOUNT EQL 0
		  THEN LEAVE LOOP2

		END;

	[%O'0']:BEGIN
			IF .EVALPTR[EVAL$S_INDCOMPL]
			THEN BEGIN
				IF .TOTALCHARCOUNT GTR 0
				THEN BEGIN
					MSGERR(CH$PTR(STRG_1),S$CRLFMSGCRLF);
					RETURN .TOTALCHARCOUNT
				     END
			    END
			ELSE BEGIN
				IF .TOTALCHARCOUNT GTR 0
				THEN RETURN .TOTALCHARCOUNT;
			     END;
		END;
	[OTHERWISE]:
		BEGIN
		END
	TES;
	END;
      END;
    END;
  END;
END;


GLOBAL ROUTINE RMC_SCAN=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--

LABEL LOOP1,LOOP2;

LOCAL	EVALPTR: REF EVAL_BLK,
	SDBKPTR: REF SD_RMCBLK;
LOCAL	PASTPTR,		!PAST PTR INTO COMMAND STRING
	PRESENTPTR,		!PRESENT PTR INTO COMMAND STRING
	PTR;			!WORKING PTR INTO COMMAND STRING
LOCAL CONTEXTCC,ERRORWORD;
LOCAL DUMMY5;

EVALPTR=EVALBLK;
SDBKPTR=SDRMCBLK;



LOOP2: BEGIN
	WHILE 1 DO 
BEGIN
CONTEXTCC=0;			!INIT CHARACTER COUNTERS
PASTPTR=PTR=CH$PTR(STRG_1);	!SET UP COMMAND STRING TEXT POINTER
EVALPTR[EVAL$FILESPECCC]=0;	!INITIALIZE FILE SPEC CHAR. COUNT

IF .EVALPTR[EVAL$S_MORE]
THEN  SELECTONE  (CONTEXTCC=RMC_CMD_STRING()) OF 
	SET
	[ZERO]:BEGIN
!		EVALPTR[EVAL$S_QUEUEREQ]=1;
		EVALPTR[EVAL$S_LIST]=1;
		!SET THE QUEUEREQUEST FLAG AS TO REPROMPT INPUT
		RETURN.CONTEXTCC
		END;
	[(1^%BPVAL)-1 TO -1]:RETURN .CONTEXTCC;
	[OTHERWISE]:EVALPTR[EVAL$S_MORE]=0
	TES;



LOOP1: BEGIN
WHILE 1 DO 
BEGIN


	!SCAN THE PRESENT COMMAND STRING UNTIL COMMAND STRING DELIMITER
	!
PASTPTR=.PTR;		!REMEMBER OLD POINTER
!SET ERRORWORD TO CNT TO CLEAR AND RESERVE
ERRORWORD=CONTEXTCC=RMC_STRIPSTRING(PTR);
PRESENTPTR=.PTR;
	SELECTONE CH$RCHAR_A(PTR) OF 
	SET

	[%C':']:BEGIN
			!LOOK FOR THE BEGINNING OF A FILESPEC OR A SWITCH OPTION ENTRY
			!OR THE END OF AN NETWORK NODE DESCRIPTOR
			IF CH$RCHAR(.PTR) EQL %C':'
			THEN BEGIN
				ERRORWORD=RMC_NOD(.PASTPTR,.CONTEXTCC);
				CH$WCHAR(%O'0',.PRESENTPTR);
				CH$RCHAR_A(PTR)
			     END
			ELSE IF .EVALPTR[EVAL$S_SWITCH]
			     THEN !A OPTION SWITCH HAD BEEN DETECTED AND NOW THE SWITCH
				BEGIN
				!TEXT STRING IS POINTED TO BY CONTEXT
				ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC);
				IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0
				THEN ERRORWORD=RMC_FILE_SPEC(.PRESENTPTR,ZERO)
				END
			     ELSE  !A FILESPEC HAS BEEN STARTED(I.E. DSK STRUCTURE FIRST)
				IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0 AND .CONTEXTCC EQL 0
				THEN ERRORWORD=RMC_FILE_SPEC(.PRESENTPTR,.CONTEXTCC)
				ELSE ERRORWORD=RMC_FILE_SPEC(.PASTPTR,.CONTEXTCC);

			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
		END;

	[%C'_']:BEGIN
			!THE OLD NODE DELIMITER "_" HAS BEEN DETECTED
			!THIS SHOULD BE ELIMINATED IN THE FUTURE
			IF (ERRORWORD=RMC_NOD(.PASTPTR,.CONTEXTCC)) LSS 0
			THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
		END;

	[%C'/']:BEGIN
			!THE BEGINNING OF A SWITCH OPTION
			IF .EVALPTR[EVAL$S_SWITCH]
			THEN !IF A SWITCH OPTION WAS ALREADY BEING SCAN
			     ! AND A "/" IS DETECTED, THE FIRST SWITCH
			     !MUST BE EVALUATED FIRST BEFORE CONTINUING.
			     ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC)
			ELSE
			IF .EVALPTR[EVAL$S_FILESPEC] OR (.ERRORWORD GTR 0) 
			THEN
			!IF A FILESPEC WAS BEING SCAN PREVIOUS TO THE "/" DETECTION
			!THEN WE MUST TERMINATE THE FILESPEC SCAN OR
			!ERROR WORD CONTAINS THE PRESENT CONTEXT CHAR.
			!COUNT WHICH INDICATES A FILE SPEC DESCRIPTION.
			!BECAUSE OF THE DELIMITER DETECTED, THIS FILE
			!SPEC IS TERMINATED.
			     ERRORWORD=RMC_TERM_SPEC(.PASTPTR,.CONTEXTCC);
			IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0
				!IF A SWITCH (OPTION) WAS BEING ANALYSISED
				!TERMINATE THE SWITCH'S SELECTION FIELD
			THEN ERRORWORD=RMC_SOPTION();
			EVALPTR[EVAL$S_SWITCH]=1;
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
		END;
	
	[%C' ']:BEGIN
			IF .EVALPTR[EVAL$S_SWITCH]
			THEN !IF A SWITCH OPTION WAS ALREADY BEING SCAN
			     ! AND A "/" IS DETECTED, THE FIRST SWITCH
			     !MUST BE EVALUATED FIRST BEFORE CONTINUING.
			     ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC)
			ELSE IF .EVALPTR[EVAL$S_FILESPEC] OR (.CONTEXTCC GTR 0) THEN
			ERRORWORD=RMC_FILE_SPEC(.PRESENTPTR,.CONTEXTCC);

			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
		END;


	[%C'*',%C'?']:
			!Wild carding not implemented
		RETURN RMC_MSG(RMCWNI,S$SEVERE);
	

	[%C',',%C'.',%C'[',%C']',%C'(',%C'+',%C'-',%C')',%C'<',%C'>']:
		BEGIN
			IF .EVALPTR[EVAL$S_SWITCH]
			THEN !IF A SWITCH OPTION WAS ALREADY BEING SCAN
			     ! AND A "/" IS DETECTED, THE FIRST SWITCH
			     !MUST BE EVALUATED FIRST BEFORE CONTINUING.
				BEGIN
				  ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC);
				  IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD;
				  ERRORWORD=RMC_FILE_SPEC(.PRESENTPTR,ZERO)
				END ELSE
				  ERRORWORD=RMC_FILE_SPEC(.PASTPTR,.CONTEXTCC);
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
		END;



	[%C'=']:BEGIN
			IF .EVALPTR[EVAL$S_SIDE]
			THEN !MORE THAN ONE '=' SIGN IN COMMAND STRING
			!Output syntax error
				RETURN RMC_MSG(RMCSEC,S$SEVERE);
			IF .EVALPTR[EVAL$S_SWITCH]
			THEN ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC);
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD;
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
			IF .EVALPTR[EVAL$S_FILESPEC] OR (.ERRORWORD GTR 0)
			!ERROR WORD CONTAINS THE PRESENT CONTEXT CHAR.
			!COUNT WHICH INDICATES A FILE SPEC DESCRIPTION.
			!BECAUSE OF THE DELIMITER DETECTED, THIS FILE
			!SPEC IS TERMINATED.
			THEN ERRORWORD=RMC_TERM_SPEC(.PASTPTR,.CONTEXTCC);
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD;
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
			IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0
			!IF A SWITCH (OPTION) WAS BEING ANALYSISED
			!DETERMINATE THE SWITCH'S SELECTION FIELD
			THEN ERRORWORD=RMC_SOPTION();
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD;
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
			IF NOT .EVALPTR[EVAL$S_LTNODE]
			!NO NODE ID WAS DETECTED ON LT SIDE
			!DEFAULT TO LOCAL NODE
			THEN EVALPTR[EVAL$S_LOCALNOD]=1;
			!IF THE DELETE FUNCTION IS REQUESTED THEN 
			!AN ILLEGAL STATE EXISTS.  I.E. A RIGHT SIDE 
			!OF COMMAND STRING
			IF .SDBKPTR[SD$RMCFUN] EQL RMC$F_DEL
			!SYNTAX ERROR - '=' FOLLOWING A DELETE FUNCTION
			THEN RETURN RMC_MSG(RMCISS,S$SEVERE);
			IF .SDBKPTR[SD$RMCFUN] NEQ RMC$F_REN
			THEN !CHK FOR RENAME FUNCTION ALREADY REQUESTED
			!OVERRIDES SEND / GET FUNCTIONS
			IF .EVALPTR[EVAL$S_LOCALNOD]
			!IF LOCAL NODE WAS DETECTED THEN LOCAL
			!IS THE RECIEVER OTHERWISE THE SENDER IN THE
			!TRANSMISSION
			THEN SDBKPTR[SD$RMCFUN]=RMC$F_GET
			ELSE SDBKPTR[SD$RMCFUN]=RMC$F_SEND;
			EVALPTR[EVAL$S_SIDE]=1
		END;

	[%C'@']:BEGIN
			!CHK IF ANY ITEMS(FILE SPECS,
			!SWITCHES OR NODES) WERE PREVIOUSLY DETECTED.
			IF .CONTEXTCC NEQ 0
			THEN RETURN RMC_MSG(RMCSEC,S$SEVERE)
			ELSE IF .EVALPTR[EVAL$S_INDCOMPL]
			     THEN RETURN RMC_MSG(RMCSEC,S$SEVERE)
			     !TWO INDIRECT FILES DETECTED IN PRESENT COMMAND
			     !STRING SCAN
			     ELSE EVALPTR[EVAL$S_INDIR]=1
		END;

	[OTHERWISE]:BEGIN
			IF .EVALPTR[EVAL$S_SWITCH]
			THEN ERRORWORD=RMC_SWITCH(.PASTPTR,.CONTEXTCC);
			IF .EVALPTR[EVAL$S_FILESPEC] OR (.ERRORWORD GTR 0)
			!ERROR WORD CONTAINS THE PRESENT CONTEXT CHAR.
			!COUNT WHICH INDICATES A FILE SPEC DESCRIPTION.
			!BECAUSE OF THE DELIMITER DETECTED, THIS FILE
			!SPEC IS TERMINATED.
			THEN ERRORWORD=RMC_TERM_SPEC(.PASTPTR,.CONTEXTCC);
			IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0
			!IF A SWITCH (OPTION) WAS BEING ANALYSISED
			!DETERMINATE THE SWITCH'S SELECTION FIELD
			THEN ERRORWORD=RMC_SOPTION();
			IF .ERRORWORD LSS 0 THEN RETURN .ERRORWORD
			!AN ERROR WAS DETECTED AND CONTROL MUST BE PASS
			!BACK
			ELSE IF NOT .EVALPTR[EVAL$S_MORE]
				THEN BEGIN
				IF NOT .EVALPTR[EVAL$S_RTNODE]
				THEN IF .EVALPTR[EVAL$S_LOCALNOD]
				THEN RETURN RMC_MSG(RMCISN,S$SEVERE)
				ELSE IF .SDBKPTR[SD$RMCFUN] NEQ RMC$F_DEL
				     THEN EVALPTR[EVAL$S_LOCALNOD]=1;
				RETURN ZERO
				END
				ELSE	LEAVE LOOP1
		END;
	TES;
END;
END;		!END OF LOOP1
END;		!END OF LOOP2
END;
END;


GLOBAL ROUTINE RMC_INPUT(PTR)=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--


LOCAL	EVALPTR: REF EVAL_BLK;
LOCAL	CHARCOUNT;		!NEW INPUT STREAM CHARACTER COUNT

EVALPTR=EVALBLK;

IF (MAX$CMDSIZE-1)-.TOTALCHARCOUNT GTR 0
THEN BEGIN

	IF (CHARCOUNT=GET_INPUT_STRIN(1+.EVALPTR[EVAL$S_INDCOMPL],PTR,(MAX$CMDSIZE-1)-.TOTALCHARCOUNT)) LSS 0
	THEN BEGIN

	SELECTONE .CHARCOUNT OF
	SET
		[G_I_S$EOF]: BEGIN
				RMC_MSG(RMCEIF,S$COMMENT);
				CHARCOUNT=0;
				CH$WCHAR(%O'0',.PTR);	!MAKE SURE A NULL IS POINTERED TO
				EVALPTR[EVAL$S_INPUTEOF]=1
			     END;
		[G_I_S$IER]: RETURN RMC_MSG(RMCI16,S$SEVERE);
		[G_I_S$CCO]: RETURN RMC_MSG(RMCI17,S$SEVERE);
		[G_I_S$ILC]: RETURN RMC_MSG(RMCI18,S$SEVERE);
		[G_I_S$CNI]: RETURN RMC_MSG(RMCI19,S$SEVERE);
		[OTHERWISE]: RETURN RMC_MSG(RMCI31,S$SEVERE)
	TES
	     END;
	  TOTALCHARCOUNT=.TOTALCHARCOUNT+.CHARCOUNT;
	  RETURN .CHARCOUNT
  END
ELSE RETURN RMC_MSG(RMCCTL,S$SEVERE);
END;







GLOBAL ROUTINE RMC_NOD(CONTEXT,CHARCOUNT)=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--
LOCAL	ERRORWORD;

LOCAL	EVALPTR:REF EVAL_BLK,
	SDBKPTR:REF SD_RMCBLK;

EVALPTR=EVALBLK;
SDBKPTR=SDRMCBLK;


IF .EVALPTR[EVAL$S_FILESPEC] OR .EVALPTR[EVAL$S_SWITCH]
THEN !IF EITHER FILESPEC OR OPTION SWITCH TEXT STRING WERE STARTED
     !THEN WE SHOULD NOT BE HERE
     RETURN RMC_MSG(RMCNDD,S$SEVERE)
ELSE BEGIN
	LOCAL NODEFLAGWORD,LIMITSIZE,DAPCODE;
	SELECTONE CHK_NODEID(.CONTEXT,.CHARCOUNT,DAPCODE,NODEFLAGWORD,LIMITSIZE) OF
	SET
	[CHK$NO]:!FAILURE HAS  OCCURRED WHILE DOING A NODE TABLE LOOKUP
		RETURN RMC_MSG(RMCINR,S$SEVERE);
	[CHK$OK]:!NODE NAME FOUND
	TES;
		IF NOT CH$FAIL(CH$FIND_SUB(.CHARCOUNT,.CONTEXT,.EVALPTR[EVAL$LOCALCC],.EVALPTR[EVAL$LOCALPTR]))
		THEN !THIS NODEID IS THE LOCAL NODE
		   IF .EVALPTR[EVAL$S_LOCALNOD]
		   THEN !THIS IS A DUPLICATE NODE (ALREADY DETECTED)
			!(I.E. TRANSFER  IS REQUESTED WITHIN THE SAME NODE
			RETURN RMC_MSG(RMCISN,S$SEVERE)
		  ELSE BEGIN
			!MARK THE LOCAL NODE AS BEING FOUND
			EVALPTR[EVAL$S_LOCALNOD]=1;
			END
		ELSE BEGIN
			!SAVE REMOTE NODE FLAG WORD
			EVALPTR[EVAL$RNODECHAR]=.NODEFLAGWORD;
			!SAVE THE REMOTE FILE LIMIT SIZE
			IF NOT .EVALPTR[EVAL$S_LIMIT]
			THEN SDBKPTR[SD$LIMIT]=.LIMITSIZE;
			IF .SDBKPTR[SD$RDAP_NOD] NEQ 0
			THEN IF CH$FAIL(CH$FIND_SUB(.CHARCOUNT,.CONTEXT,.EVALPTR[EVAL$REMOTECC],.EVALPTR[EVAL$REMOTEPTR]))
				THEN RETURN RMC_MSG(RMCISN,S$SEVERE)
				ELSE !THEY ARE THE SAME REMOTE NODE
				BEGIN
					SDBKPTR[SD$PTR_LNOD]=.CONTEXT;
					SDBKPTR[SD$CNT_LNOD]=.CHARCOUNT
				END
			ELSE BEGIN
			!SAVE THE REMOTE FILE SPEC NODE TEXT PTR 
			!AND CHARACTER COUNT
			SDBKPTR[SD$PTR_RNOD]=.CONTEXT;
			SDBKPTR[SD$CNT_RNOD]=.CHARCOUNT;
			!SAVE REMOTE DAP NODE CODE
			SDBKPTR[SD$RDAP_NOD]=.DAPCODE
			   END
		     END;
	END;
	IF .EVALPTR[EVAL$S_SIDE]
	!SET NODE SIDE WHICH WAS DETECTED
	THEN EVALPTR[EVAL$S_RTNODE]=1
	ELSE EVALPTR[EVAL$S_LTNODE]=1;
	RETURN 0
END;





GLOBAL ROUTINE RMC_FILE_SPEC(CONTEXT,CHARCOUNT)=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--

LOCAL	EVALPTR: REF EVAL_BLK,
	SDBKPTR: REF SD_RMCBLK;

EVALPTR=EVALBLK;
SDBKPTR=SDRMCBLK;


IF NOT .EVALPTR[EVAL$S_FILESPEC]
THEN BEGIN
	!MARK AS THE BEGINNING OF A FILESPEC
	EVALPTR[EVAL$S_FILESPEC]=1;
	!SAVE THE CHARACTER COUNT AND PTR OF THE START OF THE FILESPEC
	EVALPTR[EVAL$FILESPECCC]=.CHARCOUNT+1;
	EVALPTR[EVAL$FILESPCPTR]=.CONTEXT
     END
ELSE BEGIN
	!WE ALREADY KNOW THAT WE'RE SCANNING A FILE BLOCK
	!SO JUST INCREMENT THE CHARCOUNT
	EVALPTR[EVAL$FILESPECCC]=.CHARCOUNT+1+.EVALPTR[EVAL$FILESPECCC]
	!BUMP CHARCOUNT BY 1 FOR DELIMITERS NOT COUNTED
     END;
END;




GLOBAL ROUTINE RMC_TERM_SPEC(CONTEXT,CHARCOUNT)=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--

LOCAL ERRORWORD;	!LOCAL ERROR VALUE FOR VALUE REGISTER RETURN
LOCAL	EVALPTR: REF EVAL_BLK,
	SDBKPTR: REF SD_RMCBLK;
BEGIN

EVALPTR=EVALBLK;
SDBKPTR=SDRMCBLK;


RMC_FILE_SPEC(.CONTEXT,(.CHARCOUNT)-1);
IF .EVALPTR[EVAL$S_INDIR]
THEN BEGIN
	!IF TRUE THEN WE HAVE AN INDIRECT FILE SPEC
	EVALPTR[EVAL$S_INDCOMPL]=1;
	IF (ERRORWORD=RMC_FPARSE(.SDBKPTR[SD$LDAP_NOD],.EVALPTR[EVAL$FILESPCPTR],EVALPTR[EVAL$FILESPECCC])) LSS 0
	THEN RETURN .ERRORWORD
	ELSE BEGIN
		IF (ERRORWORD=CMD_DEFAULT(EVALPTR[EVAL$FILESPCPTR],EVALPTR[EVAL$FILESPECCC])) LSS 0
		THEN RETURN .ERRORWORD;
		ERRORWORD=INIT_INDIRECT(.EVALPTR[EVAL$FILESPCPTR]);
		SELECTONE .ERRORWORD OF
		SET
			[INI_IN$OK]:BEGIN
					 RMC_MSG(RMCIDF,S$COMMENT_HOLD);
				   END;
			[INI_IN$FNF]: ERRORWORD=RMC_MSG(RMCINF,S$SEVERE_HOLD);
			[INI_IN$PRF]: ERRORWORD= RMC_MSG(RMCIPF,S$SEVERE_HOLD);
			[INI_IN$IDM]: ERRORWORD= RMC_MSG(RMCINA,S$SEVERE_HOLD);
			[INI_IN$BFS]: ERRORWORD= RMC_MSG(RMCIOF,S$SEVERE_HOLD);
			[OTHERWISE]: ERRORWORD= RMC_MSG(RMCI25,S$SEVERE_HOLD)
		TES;
		!Output comment message as to input from indirect file
		 MSGERR(.EVALPTR[EVAL$FILESPCPTR],S$MSGCRLF);

		IF .ERRORWORD LSS 0
		!Return with .value if errorword lefted negative
		THEN RETURN .ERRORWORD;

		  BEGIN
		 	 EVALPTR[EVAL$S_INDIR]=0;
			 TOTALCHARCOUNT=0;
			!RESET COMMAND STRING CHAR. COUNT AND
			!TOTAL COMMAND STRING CHAR. COUNT BECAUSE
			!OF INDIRECT FILE INPUT
			EVALPTR[EVAL$S_MORE]=1
			!SET THE MORE SWITCH FLAG FOR NEW
			!INPUT COMMAND STRING
		  END
	END
      END
ELSE IF .EVALPTR[EVAL$SWTCHFUNCT] NEQ 0
	!IF A SWITCH FUNCTION FIELD IS BEING SOUGHT 
	!THEN DON'T SAVE IT AS LEFT/RIGHT FILE SPEC
   THEN BEGIN
	EVALPTR[EVAL$S_FILESPEC]=0;
	RETURN 0
	END
   ELSE 
	IF .EVALPTR[EVAL$S_SIDE]	!IF TRUE THEN THIS IS THE RIGHT SIDE
	THEN BEGIN
		EVALPTR[EVAL$RFILESPCCC]=.EVALPTR[EVAL$FILESPECCC];
		EVALPTR[EVAL$RFILESPCPT]=.EVALPTR[EVAL$FILESPCPTR];
		EVALPTR[EVAL$S_RFILESP]=1
	     END
	ELSE BEGIN
		EVALPTR[EVAL$LFILESPCCC]=.EVALPTR[EVAL$FILESPECCC];
		EVALPTR[EVAL$LFILESPCPT]=.EVALPTR[EVAL$FILESPCPTR];
		EVALPTR[EVAL$S_LFILESP]=1
	     END;
END;
	EVALPTR[EVAL$FILESPECCC]=0;
	EVALPTR[EVAL$S_FILESPEC]=0;
	RETURN 0
END;


END
ELUDOM