Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/rmcpar.bli
There are no other files named rmcpar.bli in the archive.
MODULE RMCPARSE(!RMCOPY PARSER CONTROL ROUTINE AND SEPARATE SYSTEM FILE SPEC PARSERS
		  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:
!
! ENVIRONMENT:
!	TRANSPORTABLE
!
! AUTHOR: JOHN DEROSE, CREATION DATE: FEB 1978
!
! MODIFIED BY:
!
!--
!
! TABLE OF CONTENTS:
!
FORWARD ROUTINE
	RMC_PARSE,			!RMC PARSER MODULE  CONTROL ROUTINE
	RMC_FPARSE,			!RMC FILE PARSER ROUTINE
	TOPS10_PARSECHK;		!TOPS10 FILE PARSER ROUTINE
!
! DEFINITION LIBRARY FILES:
!
LIBRARY 'RMCOPY';	!The interface to the system-independent portion
!
!
!
! CONDITIONAL COMPILATION:
	%IF FTTOPS10 %THEN %INFORM ('RMCOPY FOR TOPS10') %FI
	%IF FTTOPS20 %THEN %INFORM ('RMCOPY FOR TOPS20') %FI
	%IF FTVAX %THEN %INFORM ('RMCOPY FOR VAX') %FI
!
!
! MACROS:
!
!
! EQUATED SYMBOLS:
!
!
! OWN STORAGE:
!
!
! EXTERNAL REFERENCES:
!
EXTERNAL ROUTINE 
	RMC_MSG,			!RMC MSG TTY-OUTPUT ROUTINE
	MSGERR,				!Message/error routine
	RMC_STRIPSTRING,		!RMC STRIP TEXT STRING ROUTINE
	RMC_RDNUMA,			!RMC RADIX TEXT TO NUMBER ROUTINE
	FILE_SPEC,			!FILE SPEC INTO BLOCK ROUTINE
	ZEROBLK,			!ZERO CORE BLOCK ROUTINE
	COMPRESS_BLKS;			!COMPRESS BLANKS ROUTINE




EXTERNAL
	SOURCE_FILE$BLK,		!SOURCE FILE DATA BLOCK
	EVALBLK: VECTOR[EVAL$SIZE],	!EVALUATION PTR/STATUS BLOCK
	SDRMCBLK: VECTOR[SD$SIZE];	!SEND RMC BLOCK
!
!
!




GLOBAL ROUTINE TOPS10_PARSECHK(TEXTPTR,CCADDR)=
BEGIN
!++
!
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS:
!
! IMPLICIT INPUTS:
!
! IMPLICIT OUTPUTS:
!
! ROUTINE VALUE:
!
! SIDE EFFECTS:
!
!--
LABEL LOOP;
LITERAL
	!DEFINE THE CHAR. LENGTHS OF THE TOPS-10 PARSING
	!OF FILE SPECS.
	!MAX. FILENAME CHAR. COUNT
	FILESZMAXCHRCNT=15,
	!MAX. EXTENSION CHAR. COUNT
	EXTSZMAXCHRCNT=15;
LOCAL	PASTPTR,		!PAST PTR INTO COMMAND STRING
	PRESENTPTR,		!PRESENT PTR INTO COMMAND STRING
	PTR;			!WORKING PTR INTO COMMAND STRING
LOCAL CC,NUMBERFILES,CHARCOUNT,NVALUE;
LOCAL TMP:BITVECTOR[SWFUNC$SIZE];

NUMBERFILES=0;
TMP[START$VAL]=TMP[PPN$VAL]=0;
TMP[PERIOD$VAL]=TMP[COMMA1$VAL]=TMP[COMMA2$VAL]=TMP[COLON1$VAL]=0;
PTR=.TEXTPTR;
.CCADDR=CHARCOUNT=COMPRESS_BLKS(..CCADDR,.TEXTPTR);
LOOP:BEGIN
WHILE 1 DO
BEGIN
PASTPTR=.PTR;		!REMEMBER OLD POINTER
CC=RMC_STRIPSTRING(PTR);
PRESENTPTR=.PTR;
IF .CC EQL 0 THEN CHARCOUNT=.CHARCOUNT-1
ELSE CHARCOUNT=.CHARCOUNT-(.CC+1);
	SELECTONE CH$RCHAR_A(PTR) OF 
	SET

	[%C'[']:BEGIN
		  IF .TMP[PPN$VAL]
		  THEN RETURN -1	!ILLEGAL PPN
		  ELSE TMP[START$VAL]=TMP[PPN$VAL]=1
		END;

	[%C',']:BEGIN
		  IF .TMP[PPN$VAL] AND NOT .CC GTR FILESZMAXCHRCNT
		  ! TEST THE PPN  FIELDS
		  THEN IF NOT .TMP[COMMA1$VAL]
			THEN BEGIN
				TMP[COMMA1$VAL]=1;
				IF RMC_RDNUMA(.PASTPTR,8,.CC,NVALUE) LSS 0
				THEN RETURN -1	!NOT AN OCTAL FIELD
			     END
			ELSE IF NOT .TMP[COMMA2$VAL]
			     THEN  BEGIN
					TMP[COMMA2$VAL]=1;
					IF RMC_RDNUMA(.PASTPTR,8,.CC,NVALUE) LSS 0
					THEN RETURN -1	!NOT AN OCTAL FIELD
				   END
			     ELSE BEGIN !SFD OK FOR -10 FILE SPEC
				  END
		   ELSE RETURN -2 !NEW FILE SPEC STARTED
		END;

	[%C']']:BEGIN
		  IF NOT .TMP[PPN$VAL] OR .CC GTR FILESZMAXCHRCNT
		  THEN RETURN -1	!PPN FIELD NEVER STARTED
		  ELSE IF NOT .TMP[COMMA1$VAL]
		       THEN RETURN -1	!NO CONTENTS IN PPN
			ELSE IF NOT .TMP[COMMA2$VAL]
			     THEN 
				IF RMC_RDNUMA(.PASTPTR,8,.CC,NVALUE) LSS 0
				THEN RETURN -1;	!NOT AN OCTAL FIELD
		  TMP[PPN$VAL]=0
		END;

	[%C'.']:BEGIN
		  IF NOT .TMP[PERIOD$VAL]
		  THEN TMP[PERIOD$VAL]=TMP[START$VAL]=1
		  ELSE RETURN -4	!ILLEGAL FILE SPEC
		END;

	[%C':']:BEGIN
		  IF CH$RCHAR(.PTR) EQL %C':'
		  THEN RETURN -4	!ILLEGAL NODE ID IN FILE SPEC
		  ELSE IF NOT .TMP[START$VAL]
		       THEN TMP[START$VAL]=1
		       ELSE RETURN -4	!DSK STRUCT. IN MID. OF FILE SPEC
		END;
	[%O'0',%C'/',%C'=']:
		BEGIN
		IF .TMP[PPN$VAL]
		THEN IF NOT .TMP[COMMA1$VAL]
		      THEN RETURN -1	!ILLEGAL PPN FIELD
		      ELSE IF NOT .TMP[COMMA2$VAL]
			   THEN BEGIN
				IF RMC_RDNUMA(.PASTPTR,8,.CC,NVALUE) LSS 0
				THEN RETURN -1	!NOT AN OCTAL FIELD
				END;
		  CHARCOUNT=.CHARCOUNT+1
		END;
	[OTHERWISE]:  RETURN -4	!ILLEGAL CHARACTER IN FILE SPEC
	TES;
	IF .CHARCOUNT EQL 0 THEN LEAVE LOOP
	ELSE IF .CHARCOUNT LSS 0 THEN RETURN -4
	END;
    END;
	BEGIN
	  LOCAL FILEPTR:REF FILE$ARG;
	  FILEPTR=SOURCE_FILE$BLK;
	  ZEROBLK(.FILEPTR,FILE$SIZE_ARG);
	  FILE_SPEC(.TEXTPTR,.CCADDR,.FILEPTR);
	  IF .FILEPTR[EXT$CNT] GTR EXTSZMAXCHRCNT
	  THEN RETURN -4
	  ELSE IF .FILEPTR[FILE$CNT] GTR FILESZMAXCHRCNT
		THEN RETURN -4;
	   RETURN .NUMBERFILES
	END;
END;






GLOBAL ROUTINE RMC_PARSE=
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;

	!START THE PARSING SCAN OF THE COMMAND STRING FILE SPECS(RIGHT
	!SIDE FIRST).
  BEGIN    LOCAL NUMFILESPECS;		!NUMBER OF FILES SPECS FOUND

    INCR SIDE FROM RIGHTSIDE TO LEFTSIDE DO
    BEGIN
	LOCAL DAPNODECODE;
	SELECTONE .SDBKPTR[SD$RMCFUN] OF
	SET
	[RMC$F_DEL]:BEGIN SIDE=LEFTSIDE;
		IF .EVALPTR[EVAL$S_LOCALNOD] OR .EVALPTR[EVAL$LFILESPCCC] EQL 0
		THEN RETURN RMC_MSG(RMCINR,S$SEVERE)
		ELSE DAPNODECODE=.SDBKPTR[SD$RDAP_NOD]
		    END;
	[RMC$F_REN]:BEGIN
		IF .EVALPTR[EVAL$S_LOCALNOD]
		THEN RETURN RMC_MSG(RMCINR,S$SEVERE)
		ELSE DAPNODECODE=.SDBKPTR[SD$RDAP_NOD]
		    END;
	[RMC$F_SEND]:BEGIN
		IF NOT .EVALPTR[EVAL$S_LOCALNOD]
		THEN RETURN RMC_MSG(RMCNLN,S$SEVERE)
		!NO LOCAL NODE ID (ILLEGAL REQUEST - REMOTE TO REMOTE)
		ELSE IF (.SIDE EQL RIGHTSIDE)
		THEN DAPNODECODE=.SDBKPTR[SD$LDAP_NOD]
		ELSE DAPNODECODE=.SDBKPTR[SD$RDAP_NOD]
		    END;
	[RMC$F_GET]:BEGIN
		IF NOT .EVALPTR[EVAL$S_LOCALNOD]
		THEN RETURN RMC_MSG(RMCNLN,S$SEVERE)
		!NO LOCAL NODE ID (ILLEGAL REQUEST - REMOTE TO REMOTE)
		ELSE IF (.SIDE EQL LEFTSIDE)
		THEN DAPNODECODE=.SDBKPTR[SD$RDAP_NOD]
		ELSE DAPNODECODE=.SDBKPTR[SD$LDAP_NOD]
		    END
	TES;
	IF .SIDE EQL RIGHTSIDE
      THEN BEGIN
	IF (NUMFILESPECS=RMC_FPARSE(.DAPNODECODE,.EVALPTR[EVAL$RFILESPCPT],EVALPTR[EVAL$RFILESPCCC])) LSS 0
	THEN BEGIN
	 	RETURN .NUMFILESPECS
	     END
	   END
      ELSE IF (NUMFILESPECS=RMC_FPARSE(.DAPNODECODE,.EVALPTR[EVAL$LFILESPCPT],EVALPTR[EVAL$LFILESPCCC])) LSS 0
	THEN BEGIN
	 	RETURN .NUMFILESPECS
	     END;

      BEGIN
	!PERFORM A TST OF THE NUMBER OF FILESPECS ON EACH SIDE OF COMMAND
	!STRING -- LOOKING FOR DEFAULTS.
	CASE .NUMFILESPECS FROM ZERO TO HUNDRED OF 
	SET
		[ZERO]:	IF (.SIDE EQL RIGHTSIDE) AND (NOT .EVALPTR[EVAL$S_RFILESP])
			THEN RETURN RMC_MSG(RMCNFS,S$SEVERE)
			ELSE ;!SET LEFT SIDE DEFAULT FLAG

		[INRANGE]:IF .SIDE EQL LEFTSIDE THEN RETURN RMC_MSG(RMCNLN,S$SEVERE)
			ELSE ;!MARK MULTI-FILE REQUEST
		[OUTRANGE]:RETURN RMC_MSG(RMCMFN,S$SEVERE)
	TES;
	END;
      END;
  END;
END;


GLOBAL ROUTINE RMC_FPARSE(DAPNODECODE,FILESPECPTR,FILECCADDR)=
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 ..FILECCADDR EQL 0
THEN RETURN 0;

BEGIN
	CASE .DAPNODECODE FROM DAP$ILLEGAL TO DAP$TOPS10 OF
	SET
		[DAP$ILLEGAL]:	BEGIN
				  !WARN NO DAP CODE PRESENT SO NOT FILE 
				  !PARSING IS PERFORMED.
				  ERRORWORD=RMC_MSG(RMCLRD,S$WARN)
				END;

		[DAP$TOPS10]:	BEGIN
				  IF (ERRORWORD=TOPS10_PARSECHK(.FILESPECPTR,.FILECCADDR)) LSS 0
				  THEN SELECTONE  .ERRORWORD OF 
				SET
				[-1]:
			ERRORWORD=RMC_MSG(RMCMFN,S$SEVERE_HOLD);
				[-2]:
			ERRORWORD=RMC_MSG(RMCIPP,S$SEVERE_HOLD);
				[OTHERWISE]:
			ERRORWORD=RMC_MSG(RMCIFS,S$SEVERE_HOLD)
				TES
				END;

		[INRANGE]:	BEGIN
				  !NOT IMPLEMENTED YET LEGAL DAP CODES
				  ERRORWORD=RMC_MSG(RMCLRD,S$WARN)
				END;

		[OUTRANGE]:	BEGIN
				  !OUT OF THE LEGAL DAP CODE RANGE ALL TOGETHER
				  !SEND ERROR AND BAIL OUT
				  ERRORWORD=RMC_MSG(RMCIRD,S$SEVERE_HOLD)
				END;
	TES;
	IF .ERRORWORD LSS 0
		!Output actual text string in error
	THEN	MSGERR(.FILESPECPTR,S$MSGCRLF);
	RETURN .ERRORWORD
END;
END;






END
ELUDOM