Google
 

Trailing-Edge - PDP-10 Archives - DEC_CMS-20_V1.0_SRC - cms/sources/gramar.bli
There are no other files named gramar.bli in the archive.
module gramar (	! Grammar table for the CMS command language
		ident = '1',
		%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 Library Processor
!
! Abstract:
!
!	This module declares the grammar for the CMS command language
!	in the form of a vector called GRATAB.  It also declares routines
!	to access the vector.
!
! Environment:  Transportable
!
! Author:  Earl Van Horn	Creation Date:  April, 1979
!
!--
!
! Table of Contents:
!
forward routine
    nxtgra ;			! Find the next command entry in GRATAB.

!
! Include Files:
!
%if %bliss(bliss32) %then
    library 'sys$library:starlet';
%else
    require 'jsys:';
%fi

library 'XPORT:' ;
require 'BLISSX:' ;
require 'COMUSR:' ;		! Declarations for the user of the CMS
				! command language processor.
require 'LANGME:' ;		! Language processor mechanism declarations

!
! Macros:
!
! The following macros make the GRATAB vector easier to declare and
! understand.
!
macro
    command [] =
	k_beg_com_mark ,
	%remaining ,
	k_end_com_mark
	%,

    optional [] =
	k_beg_opt_mark ,
	%remaining ,
	k_end_opt_mark
	%,

    qualifiers [] =
	k_beg_qua_mark ,
	%remaining ,
	k_end_qua_mark
	%,

    repeatable [] =
	k_beg_rep_mark ,
	%remaining ,
	k_end_rep_mark
	% ;

!
! Equated Symbols:
!

!
! Own and PLIT Storage:
!

! The GRATAB table describes the grammar of the CMS command language.
! Anticipated extensions are included only to the extent necessary to
! encourage users to use longer abbreviations.
!
global bind
    gratab = uplit %bliss32(word) (

	command(k_annotate_com,			! ANNOTATE
		qualifiers(k_output_qual, k_append_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual)
		),

	command(k_archive_com),			! ARCHIVE (not implemented)

	command(k_copy_com,			! COPY ELEMENT
		k_element_sub,
		qualifiers(k_log_qual,k_nolog_qual),
		k_elem_ref_syn,
		repeatable(k_ext_fname_syn),
		k_remark_syn
		),

	command(k_create_com,			! CREATE CLASS
		k_class_sub,
		qualifiers(k_log_qual,k_nolog_qual),
		k_cls_name_syn,
		k_remark_syn
		),

	command(k_create_com,			! CREATE ELEMENT
		k_element_sub,
		qualifiers(k_keep_qual, k_reserve_qual,k_log_qual,k_nolog_qual,
			   k_nokeep_qual,k_noreserve_qual),
		repeatable(k_ext_fname_syn,
		    qualifiers(k_history_qual, k_notes_qual, k_position_qual,k_nohistory_qual,
			       k_nonotes_qual)),
		k_remark_syn
		),

	command(k_delete_com,			! DELETE CLASS
		k_class_sub,
		qualifiers(k_log_qual,k_nolog_qual),
		k_cls_name_syn,
		k_remark_syn
		),

	command(k_delete_com,			! DELETE ELEMENT
		k_element_sub,
		qualifiers(k_all_qual,k_log_qual,k_nolog_qual),
		k_elem_ref_syn,
		k_remark_syn
		),

	command(k_differences_com,		! DIFFERENCES
		qualifiers(k_output_qual, k_append_qual, k_parallel_qual,
                           k_log_qual, k_nolog_qual,k_width_qual,
			   k_nooutput_qual, k_noappend_qual, k_noparallel_qual),
		k_file_spec_syn,
		k_file_spec_syn
		),

	command(k_fetch_com,			! FETCH
		qualifiers(k_log_qual,k_nolog_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual, k_merge_qual, k_nohistory_qual,
			   k_nonotes_qual,k_nomerge_qual),
		k_remark_syn
		),

	command(k_help_com,			! HELP
		optional(k_help_topic_syn)
		),

	command(k_initialize_com,		! INITIALIZE
		qualifiers(k_log_qual,k_nolog_qual),
		k_dir_spec_syn,
		k_remark_syn
		),

	command(k_insert_com,			! INSERT
		qualifiers(k_if_absent_qual,k_supersede_qual,k_log_qual,k_nolog_qual,
			   k_nosupersede_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual),
		k_cls_name_syn,
		k_remark_syn
		),

	command(k_remove_com,			! REMOVE
		qualifiers(k_if_present_qual,k_log_qual,k_nolog_qual),
		k_elem_ref_syn,
		k_cls_name_syn,
		k_remark_syn
		),

	command(k_replace_com,			! REPLACE
		qualifiers(k_keep_qual, k_reserve_qual,k_log_qual,k_nolog_qual,
			   k_nokeep_qual,k_noreserve_qual),
		k_elem_ref_syn,
		qualifiers(k_variant_qual,k_novariant_qual),
		k_remark_syn
		),

	command(k_reserve_com,			! RESERVE
		qualifiers(k_log_qual,k_nolog_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual, k_merge_qual, k_nohistory_qual,
			   k_nonotes_qual,k_nomerge_qual),
		k_remark_syn
		),

	command(k_set_com,			! SET ATTRIBUTE
		k_attribute_sub,
		qualifiers(k_log_qual,k_nolog_qual),
		k_ext_fname_syn,
		qualifiers(k_history_qual, k_notes_qual, k_position_qual,
			   k_nohistory_qual,k_nonotes_qual),
		k_remark_syn
		),

	command(k_set_com,			! SET CLASS
		k_class_sub,
		qualifiers(k_log_qual,k_nolog_qual,k_noread_qual,k_read_qual),
		k_cls_name_syn,
		k_remark_syn
		),

	command(k_set_com,			! SET LIBRARY
		k_library_sub,
		qualifiers(k_log_qual,k_nolog_qual),
		k_dir_spec_syn
		),

	command(k_show_com,			! SHOW ANCESTORS
		k_ancestors_sub,
		qualifiers(k_output_qual, k_append_qual, k_class_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual,k_noclass_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual, k_from_qual)
		),

	command(k_show_com,			! SHOW CLASS
		k_class_sub,
		qualifiers(k_output_qual, k_append_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual),
		optional(k_cls_name_syn)
		),

	command(k_show_com,			! SHOW DESCENDANTS
		k_descendants_sub,
		qualifiers(k_output_qual, k_append_qual, k_class_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual,k_noclass_qual),
		k_elem_ref_syn,
		qualifiers(k_gen_qual)
		),

	command(k_show_com,			! SHOW ELEMENT
		k_element_sub,
		qualifiers(k_output_qual, k_append_qual, k_format_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual,k_noformat_qual),
		optional(k_wild_elem_ref_syn,
			 qualifiers(k_gen_qual))
		),

	command(k_show_com,			! SHOW GENERATION
		k_generation_sub,
		qualifiers(k_output_qual, k_append_qual, k_class_qual,
			   k_brief_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual,k_noclass_qual,k_nobrief_qual),
		k_wild_elem_ref_syn,
		qualifiers(k_gen_qual)
		),

	command(k_show_com,			! SHOW GROUP (not implemented)
		k_group_sub),

	command(k_show_com,			! SHOW HISTORY
		k_history_sub,
		qualifiers(k_output_qual, k_append_qual, k_since_qual,
			   k_unusual_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual,k_nounusual_qual),
		optional(k_elem_ref_syn)
		),

    	command(k_show_com,			! SHOW LIBRARY
    		k_library_sub,
		qualifiers(k_output_qual, k_append_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual)
    		),

	command(k_show_com,			! SHOW RESERVATIONS
		k_reservations_sub,
		qualifiers(k_output_qual, k_append_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual),
		optional(k_elem_ref_syn)
		),

	command(k_show_com,			! SHOW VERSION
		k_version_sub,
		qualifiers(k_output_qual, k_append_qual,k_log_qual,k_nolog_qual,
			   k_nooutput_qual,k_noappend_qual)
		),

	command(k_unreserve_com,		! UNRESERVE
		qualifiers(k_delete_qual,k_log_qual,k_nolog_qual,
			   k_nodelete_qual),
		k_elem_ref_syn,
		k_remark_syn
		),

	command(k_verify_com,			! VERIFY
		qualifiers(k_recover_qual,k_repair_qual,k_log_qual,k_nolog_qual,
			   k_norecover_qual,k_norepair_qual)
		),

	k_end_gram_mark) : gratab_vector ;

!
! External References:
!
external routine
    bug ;			! Report a bug.
global routine nxtgra(a_this_x) =

!++
! Functional Description:
!
!	This routine assumes that the fullword whose address is passed as
!	parameter is an index in the GRATAB vector.  It advances this
!	index to the next command entry in GRATAB, i.e., to the next GRATAB
!	item that is the integer code for a command.  The new index value is
!	stored back in the same fullword.  Note that the index is always
!	incremented, so that succssive calls to this routine with the same
!	variable as actual parameter will step the variable through the
!	command entries.
!
!	Calling this routine with an index of zero starts the scan, and
!	gets you the entry for the first command.  FALSE is returned if the
!	end of the grammar table is encountered before the next command entry.
!	Once the end of the table has been reached (FALSE has been returned),
!	do not call again without reseting the index.
!
! Formal Parameters:
!
!	a_this_x:	Address of a fullword containing the index to be
!			advanced.
!
! Implicit Inputs:
!
!	The GRATAB vector declared in this module.
!
! Implicit Outputs:
!
!	None
!
! Routine Value:
! Completion Codes:
!
!	FALSE is returned if the end of GRATAB is reached before the
!	next command entry, and otherwise TRUE is returned.
!
! Side Effects:
!
!	None
!
!--

    begin	! NXTGRA
    bind
	this_x = .a_this_x ;
    local
	code ;			! Content of the current item in GRATAB.

    code = .gratab[.this_x] ;
    if .code eql k_end_gram_mark
    then
	bug(lit('NXTGRA was called at the end of GRATAB')) ;

    repeat
	begin	! Check and advance.
	if (.code geq k_command_1 and .code leq k_command_n)
	or (.code geq k_sub_command_1 and .code leq k_sub_command_n)
	or (.code geq k_qualifier_1 and .code leq  k_qualifier_n)
	or (.code geq k_syntactic_1 and .code leq k_syntactic_n)
	or (.code geq k_mark_1 and .code leq k_mark_n)
	then
	    begin	! Advance and test.
	    this_x = .this_x + 1 ;
	    code = .gratab[.this_x] ;
	    if .code geq k_command_1 and .code leq k_command_n
	    then
		return true ;
	    if .code eql k_end_gram_mark
	    then
		return false ;
	    end		! Advance and test.
	else
	    bug(lit('NXTGRA was called with an invalid argument')) ;
	end ;	! Check and advance.

    0	! Satisfy the compiler; this is never executed.
    end ;	! NXTGRA
end				! Module GRAMAR
eludom