! LSE$GRAMMAR_ALIAS.TPU !************************************************************************* ! * ! © Copyright 2005 Hewlett-Packard Development Company, L.P. * ! * ! Confidential computer software. Valid license from HP required for * ! possession, use or copying. Consistent with FAR 12.211 and 12.212, * ! Commercial Computer Software, Computer Software Documentation, and * ! Technical Data for Commercial Items are licensed to the U.S. * ! Government under vendor's standard commercial license. * ! * !************************************************************************* ! !++ ! FACILITY: ! VAX Language-Sensitive Editor ! ! ABSTRACT: ! This file contains the Portable/LSE language-related grammar syntax. ! ! ENVIRONMENT: ! Portable/LSE ! ! Author: Norman M. Chan, Technical Languages and Environments ! ! CREATION DATE: 04-March-1991 ! ! MODIFIED BY: ! ! X4.0 DAS 9-Apr-91 STREAMLF this file ! X4.0-1 LRH 19-Apr-91 fixed call to set(lse$alias) ! X4.0-2 WC3 29-Apr-91 Fix prompting in LSE_NEW_ALIAS ! Make LSE_SHOW_ALIAS a show list ! Change lse_extract_new_alias to lse$extract_new_alias( ! ! X4.0-3 WC3 15-May-91 Portable language consistency ! X4.0-4 DAS 16-May-91 Put back lse$extract_new_alias routine ! X4.0-5 NMC 31-May-91 Modify lse$extract_new_alias to lse_extract_new_alias ! X4.0-6 NMC 20-Aug-91 Use lse$unset_curr_lang_element in lse_delete_alias ! Fix a bug in lse_show_alias. ! X4.0-7 NMC 28-Aug-91 Modified set(lse$alias, lang, alias, on) to return ! a boolean value. ! X4.0-8 NMC 9-Sep-91 Use lse$add in add_remove builtins. ! X4.0-9 NMC 16-Sep-91 Add error trap to lse_new_alias for defined alias ! or token. ! X4.0-10 NMC 30-Sep-91 Update current alias in lse_new_alias ! Add lse$compare_lang_pack_elem call to check for ! possible current alias being deleted. ! 4.0-11 NMC 10-Oct-91 Modified lse$prompt_lang_elem_param to ! lse$prompt_lang_pack_elem_param ! Modified lse$get_valid_lang_elem to ! lse$get_valid_lang_pack_elem ! 4.0-12 NMC 15-Oct-91 Modified lse_delete_alias to take wildcard name ! Added lse$_nonidchar to error trap for NEW ALIAS ! Fix bug in lse_show_alias to make sure we have a ! valid language before the show operation. ! 4.0-13 NMC 22-Oct-91 Updated some Haley Headers. ! 4.0-14 NMC 30-Dec-91 Modified lse_show_alias to set the current language. ! 4.0-15 DEC 22-Jan-92 Fixed doc headers. ! 4.0-16 WC3 22-Feb-92 Doc build fixes. ! 4.0-17 WC3 13-Apr-92 Make NEW silently re-initialize instead of issue ! an error when the element exists ! 4.0-18 SHE 4-May-92 Set current language before alias ! ! NOTE - FOR ADDING PROCEDURES ! ! The following is a documentation template which is used with PDF to ! create documentation. When creating a new procedure, copy the template ! above the procedure. The information will be supplied by the documentation ! group. ! !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! procedure lse$grammar_alias_module_ident return "X4.0-18"; endprocedure; procedure lse_new_alias (;alias_name, defined_language) ! ! DESCRIPTION: ! Creates a new alias assicated with the specified language ! !doc_begin ! ! ONE LINE DEFINITION: ! Creates a new alias associated with the specified language. ! ! DESCRIPTION: ! (NEW ALIAS) ! (NEW ALIASSee also SET ALIAS commands) ! (Aliascreating a new) ! An alias is an abbreviated series of characters that represent a ! longer string of text. You can specify an identifier at the current ! cursor position as the text you want to generate using the ! SET ALIAS EXPAND TEXT command. After you define an alias name ! with the NEW ALIAS command and added text with the SET ALIAS EXPAND ! TEXT command, you can type the alias and expand it to its full ! context using the EXPAND command. !

! LSE prompts you to specify an alias name. ! If you do not specify a language to be associated with the alias, ! LSE uses the currently defined language. These language and alias ! names become the defaults for subsequent SET ALIAS commands. ! ! RELATED COMMANDS: ! SET ALIAS EXPAND TEXT ! DELETE ALIAS ! EXTRACT ALIAS ! EXTRACT NEW ALIAS ! SHOW ALIAS ! ! CATEGORY: ! Language ! !doc_end ! local new_alias, the_alias_name, the_lang, the_lang_name; ON_ERROR [LSE$_NONIDCHAR]: eve$message( ERROR_TEXT ); lse$post_command_proc; RETURN FALSE; [LSE$_TEMPORALIASDEF]: eve$message( ERROR_TEXT ); lse$post_command_proc; RETURN FALSE; [OTHERWISE]: lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_new_alias"); ENDON_ERROR; lse_new_alias := FALSE; ! ! Get the language and the language element name parameter ! if lse$prompt_lang_pack_elem_param( alias_name, LSE$ALIAS, defined_language, LSE$LANGUAGE, the_alias_name, the_lang_name) then ! Get the language from the language name ! the_lang := get_info(the_lang_name, 'lse$language_type'); if the_lang <> tpu$k_unspecified then ! Check for already exising ! new_alias := get_info( the_lang, 'lse$find_alias', the_alias_name ); if get_info( new_alias, 'type' ) = LSE$ALIAS_TYPE then lse$delete_alias( new_alias ); endif; ! Create a new alias and add it to the language. ! new_alias := lse$create_alias(the_alias_name); if set(lse$alias, the_lang, new_alias, lse$add) then ! Update current alias and language ! lse$set_curr_lang_element(the_lang); lse$set_curr_lang_element(new_alias); lse_new_alias := TRUE; endif; else eve$message (lse$_langnotdef, 0, the_lang_name); endif; endif; lse$post_command_proc; endprocedure; procedure lse_set_alias_expand_text (;text_string, defined_alias, defined_language) ! ! DESCRIPTION: ! Define the expanded text of an alias ! !doc_begin ! ! ONE LINE DEFINITION: ! Defines the expanded text of an alias. ! ! DESCRIPTION: ! (SET ALIAS EXPAND TEXT) ! (SET ALIAS commandsSET ALIAS EXPAND TEXT) ! (Aliasdefining expanded text) ! When an EXPAND command is executed on an alias, the text of the alias ! name is replaced in the buffer with the expand text. ! ! RELATED COMMANDS: ! NEW ALIAS ! SHOW ALIAS ! SET LANGUAGE IDENTIFIER CHARACTERS ! ! CATEGORY: ! Language ! !doc_end ! local the_alias, the_expand_text, the_lang; ON_ERROR [OTHERWISE]: lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_set_alias_expand_text"); ENDON_ERROR; lse_set_alias_expand_text := FALSE; ! Get the expanded text string ! if lse$prompt_string( text_string, the_expand_text, lse$_exptxtprompt, lse$_exptxtnotdef, lse$current_identifier ) then ! Make sure the alias name is associated with the language name specified ! if lse$get_valid_lang_pack_elem( defined_alias, LSE$ALIAS, defined_language, LSE$LANGUAGE, the_alias, the_lang ) then set(lse$expand_text, the_alias, the_expand_text); lse$set_curr_lang_element( the_lang ); lse$set_curr_lang_element( the_alias ); lse_set_alias_expand_text := TRUE; endif; endif; lse$post_command_proc; endprocedure; procedure lse_delete_alias(;alias_name_wild, language_name_wild) ! ! Deletes the indicated alias(es) for the specified language(s). ! Wildcards are accepted for both alias and language names. ! !doc_begin ! ! ONE LINE DEFINITION: ! Deletes the definition of one or more aliases associated with the ! specified language(s). ! ! DESCRIPTION: ! (DELETE ALIAS) ! (Aliasdeleting) ! This command removes the specified name from the list of aliases ! associated with the specified language. Wildcards are accepted ! for both alias and language names. !

! If you do not specify an alias or language name, LSE uses ! the current alias and language. ! If the alias you are deleting is the current alias, ! then the current alias element is set to UNSPECIFIED. ! Otherwise, neither the current alias nor the current language ! are set as a result of this command. ! ! RELATED COMMANDS: ! NEW ALIAS ! SHOW ALIAS ! EXTRACT ALIAS ! SET ALIAS EXPAND TEXT ! ! CATEGORY: ! Language ! !doc_end ! local alias_name_pattern, lang_name_pattern; ON_ERROR [OTHERWISE]: lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_delete_alias" ); ENDON_ERROR; lse_delete_alias := FALSE; ! Make sure the alias name is associated with the language name specified ! if lse$prompt_lang_pack_elem_param( alias_name_wild, LSE$ALIAS, language_name_wild, LSE$LANGUAGE, alias_name_pattern, lang_name_pattern ) then lse_delete_alias := lse$delete_lang_pack_elem( alias_name_pattern, LSE$ALIAS, lang_name_pattern, LSE$LANGUAGE ); endif; lse$post_command_proc; endprocedure; procedure lse_show_alias(;alias_name_wild, defined_language) ! ! Displays complete information about the indicated aliases in the language ! specified. Wildcard is accepted for the alias name only. If a single ! alias is input, all attributes associated with the alias is displayed. If ! wildcarded alias names are input, brief information for each alias is ! displayed. ! !doc_begin ! ! ONE LINE DEFINITION: ! Displays the definitions and characteristics of one or more aliases. ! ! DESCRIPTION: ! (SHOW ALIAS) ! (Aliasshowing) ! If you specify an alias name, LSE displays all the attributes associated ! with that alias. If you specify a wildcard alias name, LSE displays ! a list with brief information about the matching aliases in the language. !

! You can navigate through the list using Ctrl/F (forward) ! and Ctrl/B (reverse). Ctrl/E (expand) lets you ! display full information about the indicated alias. The COLLAPSE command ! reverts back to the brief display. ! ! RELATED COMMANDS: ! NEW ALIAS ! DELETE ALIAS ! EXTRACT ALIAS ! ! CATEGORY: ! Language ! !doc_end ! local saved_lang, the_lang, alias_name_pattern, the_lang_name; ON_ERROR [OTHERWISE]: if saved_lang <> 0 then lse$set_curr_lang_element(saved_lang); endif; lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_show_alias"); ENDON_ERROR; lse_show_alias := FALSE; ! Make sure the alias name is associated with the language name specified ! if lse$prompt_lang_pack_elem_param( alias_name_wild, LSE$ALIAS, defined_language, LSE$LANGUAGE, alias_name_pattern, the_lang_name ) then the_lang := get_info(the_lang_name, 'lse$language_type'); if the_lang <> tpu$k_unspecified then ! Saved the current language ! saved_lang := lse$get_curr_lang_element(LSE$LANGUAGE); lse$set_curr_lang_element(the_lang); ! Do the show ! if lse$shlst_process( alias_name_pattern, lse$alias_list ) then lse_show_alias := TRUE; else ! Restore the current language ! lse_show_alias := FALSE; lse$set_curr_lang_element(saved_lang); endif; else eve$message (lse$_langnotdef, 0, the_lang_name); endif; endif; lse$post_command_proc; endprocedure; procedure lse_extract_alias(;alias_name_wild, language_name_wild) ! ! Extracts the definition of an alias and formats it as portable commands. ! Wildcarded names are accepted for both alias and language name. In the ! lattar case, all alias(es) definition associated with one or more ! languages are extracted. ! !doc_begin ! ! ONE LINE DEFINITION: ! Extracts the definition of the specified alias(es). ! ! DESCRIPTION: ! (EXTRACT ALIAS) ! (Aliasextracting) ! LSE inserts the indicated definitions at the end of the current ! buffer in a form that lets them be executed with the EXECUTE ! BUFFER LSE command. ! ! RELATED COMMANDS: ! EXTRACT NEW ALIAS ! NEW ALIAS ! SET ALIAS EXPAND TEXT ! DELETE ALIAS ! SHOW ALIAS ! ! CATEGORY: ! Language ! !doc_end ! LOCAL alias_name_pattern, lang_name_pattern, status; ON_ERROR [OTHERWISE]: lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_extract_alias"); ENDON_ERROR; lse_extract_alias := FALSE; ! Get the alias and language wildcard name ! if lse$prompt_lang_pack_elem_param( alias_name_wild, LSE$ALIAS, language_name_wild, LSE$LANGUAGE, alias_name_pattern, lang_name_pattern) then lse_extract_alias := lse$extract_lang_pack_elem(alias_name_pattern, LSE$ALIAS, lang_name_pattern, LSE$LANGUAGE, FALSE) endif; lse$post_command_proc; endprocedure; ! lse_extract_alias procedure lse_extract_new_alias(;alias_name_wild, language_name_wild) ! ! ! Extracts the definition of an alias and formats it as portable commands. ! Only definitions created in the current editing session will be extracted. ! Wildcarded names are accepted for both alias and language name. In the ! lattar case, all alias(es) definition associated with one or more ! languages are extracted. ! !doc_begin ! ! ONE LINE DEFINITION: ! Extracts the definition of the specified alias(es) created or modified ! during the current editing session. ! ! DESCRIPTION: ! (EXTRACT NEW ALIAS) ! (Aliasextracting) ! LSE inserts the indicated definitions at the end of the current ! buffer in a form that lets them be executed with the EXECUTE ! BUFFER LSE command. ! ! RELATED COMMANDS: ! EXTRACT ALIAS ! NEW ALIAS ! SET ALIAS EXPAND TEXT ! SHOW ALIAS ! DELETE ALIAS ! ! CATEGORY: ! Language ! !doc_end ! LOCAL alias_name_pattern, lang_name_pattern; ON_ERROR [OTHERWISE]: lse$post_command_proc; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse_extract_new_alias"); ENDON_ERROR; lse_extract_new_alias := FALSE; ! Get the alias and language wildcard name ! if lse$prompt_lang_pack_elem_param( alias_name_wild, LSE$ALIAS, language_name_wild, LSE$LANGUAGE, alias_name_pattern, lang_name_pattern) then lse_extract_new_alias := lse$extract_lang_pack_elem( alias_name_pattern, LSE$ALIAS, lang_name_pattern, LSE$LANGUAGE, TRUE) endif; lse$post_command_proc; endprocedure; ! lse_extract_new_alias