Google
 

Trailing-Edge - PDP-10 Archives - DEC_CMS-20_V1.0_SRC - cms/sources/main.bli
There are 13 other files named main.bli in the archive. Click here to see a list.
MODULE MAIN (
		IDENT = '1',
		MAIN = MAIN,
		%IF
		    %BLISS(BLISS32)
		%THEN
		    LANGUAGE(BLISS32),
		    ADDRESSING_MODE(EXTERNAL=LONG_RELATIVE,
				NONEXTERNAL=LONG_RELATIVE)
		%ELSE
		    LANGUAGE(BLISS36)
		%FI
		) =
BEGIN

!
!			  COPYRIGHT (C) 1982 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
! ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER
! COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE
! AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!

!++
! FACILITY:
!
!	CMS Command dispatcher
!
! ABSTRACT:
!
!	Pick up the processor name requested and execute it.
!
! ENVIRONMENT:
!
!	VAX/VMS, DS-20
!
! AUTHOR: Dave Knight, CREATION DATE: 17-Oct-79
!
!--
!
! TABLE OF CONTENTS:
!

FORWARD ROUTINE
	MAIN;

!
! INCLUDE FILES:
!

LIBRARY 'XPORT:';

%if %bliss(bliss32) %then

    LIBRARY 'SYS$LIBRARY:STARLET';

%else

    REQUIRE 'jsys:';

%fi

REQUIRE 'BLISSX:';

require 'sconfg:';

REQUIRE 'COMUSR:';

! REQUIRE 'CONDIT:';

REQUIRE 'HOSUSR:';

!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!
	own
		status;			!status code stored for return to 
					!system if necessary

!
! EXTERNAL REFERENCES:
!

external literal
	s_nyi,
	s_usehelp;		! please type help

EXTERNAL ROUTINE
	BATRUN,			! test if running in batch (CNTRLC)
	BUG,			! Report a bug.
        cmsext,			! exception handler for rolbck
	CODSPL,			! Get the spelling for an integer code.
	COMCOD,			! Get the integer code for the command.
	COPY,			!COPY command
	CREATE,			!CREATE command
	DIFF,			! Compare source files
	ERASE,			! DELETE command processing
	ERS,			! Report a user mistake.
	exits,			! exit silently
	INSERT,			! INSERT/REMOVE command
	INTERM,			! Initialize terminal functions.
	REPLACE,		! REPLACE command
	RESERVE,		! RESERVE, FETCH, and ANNOTATE commands
	set_exit,		! set up exit and exception handling
	STSET,			! Set command
	STSHOW,			! SHOW command
	sysmsg,			! tell user
	UNRESERVE,		! UNRESERVE command
	VERIFY;			! VERIFY command
ROUTINE MAIN =		! Main routine

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine dispatches to the respective subcommand.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	The command line is read by calling COMCOD.
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	The value returned by the routine dispatched to, or K_SILENT_ERROR
!	if the user made a mistake.
!
! SIDE EFFECTS:
!
!	The user's subcommand is executed if he did not make a mistake.
!
!--

    BEGIN

    %if VaxVms %then
    enable
        cmsext;			! enable exception handler
    %fi
    
    LOCAL
	COMMAND_CODE ;		! Integer code for the subcommand.

    INTERM();

    ! check if exit handler needs to be registered
    IF
	%if VaxVms %then NOT BATRUN() %fi
	%if Tops20 %then true         %fi
    THEN
	BEGIN
        ! register exit handler
        IF
	    NOT set_exit()
        THEN
	    RETURN K_SILENT_ERROR ;
	END ;

    !Get the command code
    IF
	NOT COMCOD(COMMAND_CODE)
    THEN
	RETURN K_SILENT_ERROR ;    

    !Now go execute the command
status=(SELECTONE .COMMAND_CODE OF

	SET
	[K_ANNOTATE_COM, K_FETCH_COM, K_RESERVE_COM]:

	    RESERVE() ;

	[K_DIFFERENCES_COM]:

	    DIFF() ;

	[K_COPY_COM]:

	    COPY() ;

	[K_CREATE_COM]:

	    CREATE();

	[K_DELETE_COM]:

	    ERASE() ;

	[K_INSERT_COM, K_REMOVE_COM]:

	    INSERT();

	[K_HELP_COM]:

	    BEGIN
	    sysmsg(s_usehelp,LIT(%string('Please type HELP ',fac_name)),0);
	    exits(s_usehelp)
	    END;

	[K_INITIALIZE_COM, K_SET_COM]:

	    STSET();

	[K_REPLACE_COM]:

	    REPLACE() ;

	[K_SHOW_COM]:

	    STSHOW();

	[K_UNRESERVE_COM]:

	    UNRESERVE();

	[K_VERIFY_COM]:

	    VERIFY();

	[K_ARCHIVE_COM]:

	    ERS(s_nyi,CAT(('The '), CODSPL(.COMMAND_CODE),
		(' command is not yet available'))) ;

	[OTHERWISE]:

	    BUG(LIT('MAIN did not recognize the command code')) ;

	TES);				! Return value from command routine.

	!Status back to Bliss for system	!In case of a return to this
						!main module, the system should
						!pass back to the system the 
						!correct status with the in-
						!hibit bit (bit 29-inhibits 
						!system messages from appearing
						!before the user) set as well.

	%IF %BLISS(BLISS32)
	%THEN
	    ! Bit 29 error condition on the VAX,
	    ! STS$M_INHIB_MSG is only available in STARLET
	    return (.status OR STS$M_INHIB_MSG);  
	%ELSE
	    return (.status);
	%FI
    END;				       ! End of Routine MAIN
END					       !End of MAIN
ELUDOM