! LSE$SHOW_LIST.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 utility routines to support show lists ! ! ENVIRONMENT: ! Portable/LSE ! ! Author: Walter Carrell III ! ! CREATION DATE: 09-Apr-91 ! ! MODIFIED BY: ! X4.0-1 WC3 29-Apr-91 Many changes to general list support ! X4.0-2 WC3 15-May-91 Portable language consistency ! X4.0-3 NMC 08-May-91 Add adjustment list support ! X4.0-4 NMC 06-Aug-91 Add package list support ! X4.0-5 NMC 13-Aug-91 Fix bug in package list support ! X4.0-6 DEC 08-Aug-91 Add token and placeholder list support ! X4.0-7 SHE 03-Sep-91 Changed lse_undefine_key to lse_delete_key ! in lse$shlst_register ! X4.0-8 DAS 27-Oct-91 Removed assignment to WCX ! X4.0-9 WC3 15-Nov-91 Move removing quotes from show list item names ! to the find procedure. ! X4.0-10 NMC 9-Dec-91 Added routine list support ! X4.0-11 NMC 30-Dec-91 Fix return status in lse$shlst_process ! X4.0-12 WC3 28-Jan-92 Change the order of SHOW BUFFER list ! X4.0-13 WC3 30-Jan-92 Fix n squared in show list processing when ! ambiguous items are in the list and the ! selection string has a wildcard ! Fix quote removal bug where trailing quote was ! begin removed even when it wasn't there. ! X4.0-14 WC3 27-Apr-92 Fix several bug introduced by -13 ! X4.0-15 WC3 07-May-92 Fix empty list bug ! X4.0-16 WC3 08-May-92 Added missing local declarations ! 4.5-1 CJH 24-Sep-96 Added declarations of ! lse$$k_shlst_current_find_proc and ! lse$$k_shlst_current_name_proc. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! 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$show_list_util_module_ident return "X4.0-16" endprocedure; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_save( old_range, new_range ) ! ! FUNCTION: ! ! Save enough information so that the old range can be retrieved ! and replace the new range. ! ! PARAMETERS: ! ! old_range - A range to be saved and removed ! ! new_range - The new range associated with the old range ! ! RETURN VALUE: ! ! success boolean ! LOCAL buff, indx, info_array; ON_ERROR [OTHERWISE]: lse$$pop_position; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_save"); ENDON_ERROR; lse$$push_position; ! Create the old_range buffer is necessary ! IF lse$$x_old_range_buffer = TPU$K_UNSPECIFIED THEN lse$$x_old_range_buffer := eve$init_buffer('$OLD_RANGE_BUFFER', ""); set (permanent, lse$$x_old_range_buffer); set (lse$overviews, lse$$x_old_range_buffer, off); SET(MODIFIABLE, lse$$x_old_range_buffer, ON ); ENDIF; ! Create the replacement info array if necessary ! IF lse$$x_show_list_array = TPU$K_UNSPECIFIED THEN lse$$x_show_list_array := CREATE_ARRAY; ENDIF; ! Create a info array based on the buffer if necessary ! buff := GET_INFO( new_range, 'buffer' ); info_array := lse$$x_show_list_array{ buff }; IF info_array = TPU$K_UNSPECIFIED THEN lse$$x_show_list_array{ buff } := create_array; info_array := lse$$x_show_list_array{ buff }; info_array{ 0 } := 0; ENDIF; ! Find the end of the array ! indx := 1; LOOP EXITIF (indx > info_array{ 0 } ) OR (info_array{ indx } = TPU$K_UNSPECIFIED); indx := indx + 2; ENDLOOP; ! Save the info ! POSITION( END_OF( lse$$x_old_range_buffer ) ); info_array{ indx } := new_range; info_array{ indx+1 } := MOVE_TEXT( old_range ); IF indx > info_array{ 0 } THEN info_array{ 0 } := info_array{ 0 } + 2; ENDIF; lse$$pop_position; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_hlt_range( ref_mark ) ! ! FUNCTION: ! ! Return the range to be highlighted associated with the ref_mark ! ! PARAMETERS: ! ! ref_mark - Mark which might be within a range passed a new_range to ! lse$shlst_save ! ! RETURN VALUE: ! ! the highlight range ! LOCAL output_range, temp_output; ON_ERROR [OTHERWISE]: lse$$pop_position; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_hlt_range"); ENDON_ERROR; temp_output := lse$shlst_new_range( ref_mark ); IF GET_INFO( temp_output, 'type' ) = RANGE THEN return temp_output; ENDIF; ! Skip the header ! lse$$push_position; POSITION( ref_mark ); IF GET_INFO( ref_mark, 'record_number' ) <= 2 THEN IF GET_INFO( GET_INFO( ref_mark, 'buffer' ), 'record_count' ) >= 3 THEN POSITION( 3 ); ENDIF; ENDIF; ! Walk forward looking for non-blank line ! LOOP EXITIF GET_INFO(MARK(NONE), 'record_number') >= GET_INFO(current_buffer, 'record_count' ); EXITIF CURRENT_LINE <> ''; LSE$MOVE_VERTICAL( 1 ); ENDLOOP; ! Must also try going backward for the end of buffer case ! IF GET_INFO(ref_mark, 'record_number') > GET_INFO(current_buffer, 'record_count' ) THEN MOVE_VERTICAL( -1 ); ENDIF; LOOP EXITIF GET_INFO(mark(none), 'record_number') = 1; EXITIF CURRENT_LINE <> ''; LSE$MOVE_VERTICAL( -1 ); ENDLOOP; ! Return the right range ! output_range := lse$shlst_new_range( MARK( NONE ) ); IF GET_INFO( output_range, 'type' ) <> RANGE THEN output_range := CREATE_RANGE( LINE_BEGIN, LINE_END, NONE ); ENDIF; lse$$pop_position; RETURN output_range; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_old_range( ref_mark ) ! ! FUNCTION: ! ! Return the range associated with the ref_mark ! ! Looks for ref_mark within the new_ranges passed to lse$shlst_save ! Returns old_range of the first match it finds, ! tpu$k_unspecified if it doesn't find a match. ! ! PARAMETERS: ! ! ref_mark - Mark which might be within a range passed a new_range to ! lse$shlst_save ! ! RETURN VALUE: ! ! tpu$k_unspecified or old_range ! LOCAL buff, indx, info_array; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_old_range"); ENDON_ERROR; ! Sanity check ! IF (lse$$x_old_range_buffer = TPU$K_UNSPECIFIED) OR (lse$$x_show_list_array = TPU$K_UNSPECIFIED) THEN RETURN TPU$K_UNSPECIFIED; ENDIF; buff := GET_INFO( ref_mark, 'buffer' ); IF lse$$x_show_list_array{ buff } = TPU$K_UNSPECIFIED THEN RETURN TPU$K_UNSPECIFIED; ENDIF; ! De-reference the info array ! info_array := lse$$x_show_list_array{ buff }; ! Return the info ! indx := 1; LOOP EXITIF indx > info_array{ 0 }; ! Is the ref_mark within new_range ! IF info_array{ indx } <> TPU$K_UNSPECIFIED THEN IF GET_INFO( ref_mark, 'within_range', info_array{ indx } ) THEN RETURN info_array{ indx+1 }; ENDIF; ENDIF; ! Next ! indx := indx + 2; ENDLOOP; RETURN TPU$K_UNSPECIFIED; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_reset( ref_buffer ) ! ! FUNCTION: ! ! Deletes all the ranges associated with the buffer ! ! PARAMETERS: ! ! ref_buffer - Buffer for whon to erase the ramges ! ! RETURN VALUE: ! ! success boolean ! LOCAL indx, info_array; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_reset"); ENDON_ERROR; ! Sanity check ! IF (lse$$x_old_range_buffer = TPU$K_UNSPECIFIED) OR (lse$$x_show_list_array = TPU$K_UNSPECIFIED) THEN RETURN true; ENDIF; IF lse$$x_show_list_array{ ref_buffer } = TPU$K_UNSPECIFIED THEN RETURN true; ENDIF; ! De-reference the info array ! info_array := lse$$x_show_list_array{ ref_buffer }; ! Return the info ! indx := 1; LOOP EXITIF indx > info_array{ 0 }; ! Is the ref_mark within new_range ! IF info_array{ indx } <> TPU$K_UNSPECIFIED THEN DELETE( info_array{ indx } ); ERASE( info_array{ indx+1 } ); DELETE( info_array{ indx+1 } ); ENDIF; ! Next ! indx := indx + 2; ENDLOOP; RETURN true; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_expand( buff ) ! ! FUNCTION: ! ! Expand a line in a show list ! ! PARAMETERS: ! ! buff - The show buffer to expand ! ! RETURN VALUE: ! ! success_boolean ! LOCAL old_range, saved_modify_state, show_item, new_range_end, status; ON_ERROR [OTHERWISE]: lse$$pop_position; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_expand"); ENDON_ERROR; ! Nothing to be done if we don't know what to do ! IF NOT lse$is_show_list( buff ) THEN RETURN false; ENDIF; lse$$push_position; ! Position to the right line ! POSITION( buff ); ! Protect against call on already expanded text ! old_range := lse$shlst_hlt_range( MARK( NONE ) ); IF GET_INFO( lse$shlst_new_range(BEGINNING_OF(old_range)), 'type' ) = RANGE THEN lse$$pop_position; RETURN true; ENDIF; ! Output the full output ! POSITION( END_OF( old_range ) ); MOVE_HORIZONTAL( 1 ); saved_modify_state := SET(MODIFIABLE, CURRENT_BUFFER, ON ); ! Do the expansion ! IF lse$shlst_get_item( BEGINNING_OF( old_range ), show_item ) THEN ! Marks get special treatment because their implementation is different ! IF lse$shlst_get_registered_info( BEGINNING_OF( old_range ), lse$$k_reg_show_keyword ) = lse$show_mark_list THEN lse$$lse_mark_name := show_item; execute ("lse$$x_user_mark := " + lse$$k_mark_prefix + show_item); show_item := lse$$x_user_mark; ENDIF; lse$shlst_execute_registered_proc( BEGINNING_OF( old_range ), lse$$k_reg_expand_proc, show_item ); ELSE ! Get out if something is amiss ! lse$$pop_position; RETURN TRUE; ENDIF; ! Make a range of the expanded text ! MOVE_HORIZONTAL( -1 ); new_range_end := MARK( NONE ); POSITION( END_OF( old_range ) ); MOVE_HORIZONTAL( 1 ); lse$shlst_save( old_range, CREATE_RANGE( MARK(NONE), new_range_end, NONE ) ); SET(MODIFIABLE, CURRENT_BUFFER, saved_modify_state ); lse$$highlight_show_list; lse$$pop_position; RETURN TRUE; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_collapse( ref_mark ) ! ! FUNCTION: ! ! Replace the new range associated with the ref_mark with the old range ! ! Looks for ref_mark within the new_ranges passed to lse$shlst_save ! If it finds a match, it replaces the new_range with the old_range ! removing the range pair from it's data base ! ! PARAMETERS: ! ! ref_mark - Mark which might be within a range passed a new_range to ! lse$shlst_save ! ! RETURN VALUE: ! ! success_boolean ! LOCAL buff, indx, info_array, saved_modifiable, temp_mark; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_replace"); ENDON_ERROR; ! Sanity check ! IF (lse$$x_old_range_buffer = TPU$K_UNSPECIFIED) OR (lse$$x_show_list_array = TPU$K_UNSPECIFIED) THEN RETURN FALSE; ENDIF; buff := GET_INFO( ref_mark, 'buffer' ); IF lse$$x_show_list_array{ buff } = TPU$K_UNSPECIFIED THEN RETURN FALSE; ENDIF; ! De-reference the info array ! info_array := lse$$x_show_list_array{ buff }; temp_mark := BEGINNING_OF( lse$shlst_hlt_range( ref_mark ) ); ! Replace the info ! indx := 1; LOOP EXITIF indx > info_array{ 0 }; ! Is the ref_mark within new_range ! IF info_array{ indx } <> TPU$K_UNSPECIFIED THEN IF GET_INFO( temp_mark, 'within_range', info_array{ indx } ) THEN saved_modifiable := SET( MODIFIABLE, buff, ON ); POSITION( info_array{ indx } ); ERASE( info_array{ indx } ); POSITION( MOVE_TEXT( info_array{ indx+1 } ) ); DELETE( info_array{ indx } ); DELETE( info_array{ indx+1 } ); SET( MODIFIABLE, buff, saved_modifiable ); RETURN true; ENDIF; ENDIF; ! Next ! indx := indx + 2; ENDLOOP; RETURN false; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_new_range( ref_mark ) ! ! FUNCTION: ! ! Returns a new_range if the mark is within one ! ! PARAMETERS: ! ! ref_mark - Mark which might be within a range passed a new_range to ! lse$shlst_save ! ! RETURN VALUE: ! ! success_boolean ! LOCAL buff, indx, info_array; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_NEW_RANGE"); ENDON_ERROR; ! Sanity check ! IF (lse$$x_old_range_buffer = TPU$K_UNSPECIFIED) OR (lse$$x_show_list_array = TPU$K_UNSPECIFIED) THEN RETURN FALSE; ENDIF; buff := GET_INFO( ref_mark, 'buffer' ); IF lse$$x_show_list_array{ buff } = TPU$K_UNSPECIFIED THEN RETURN FALSE; ENDIF; ! De-reference the info array ! info_array := lse$$x_show_list_array{ buff }; ! Return the info ! indx := 1; LOOP EXITIF indx > info_array{ 0 }; ! Is the ref_mark within new_range ! IF info_array{ indx } <> TPU$K_UNSPECIFIED THEN IF GET_INFO( ref_mark, 'within_range', info_array{ indx } ) THEN RETURN info_array{ indx }; ENDIF; ENDIF; ! Next ! indx := indx + 2; ENDLOOP; RETURN false; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_line( ref_mark ) ! ! FUNCTION: ! ! Returns the single line associated with the mark ! ! PARAMETERS: ! ! ref_mark - Mark which might be within a range passed a new_range to ! lse$shlst_save ! ! RETURN VALUE: ! ! success_boolean ! LOCAL temp_range, output_range; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_line"); ENDON_ERROR; temp_range := lse$shlst_hlt_range( ref_mark ); output_range := lse$shlst_old_range( BEGINNING_OF(temp_range) ); IF GET_INFO( output_range, 'type' ) <> RANGE THEN output_range := temp_range; ENDIF; ! Convert to string for the rest of the procedure ! RETURN str( output_range ); ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$is_show_list(;buffer_ptr) !++ ! FUNCTIONAL DESCRIPTION: ! ! LSE$IS_SHOW_LIST checks whether the specified buffer a show list buffer ! ! INPUTS ! ! buffer_ptr - buffer in question, defaults to current_buffer ! ! RETURNS: ! ! The show keyword the buffer was registered with, or FALSE if it isn't ! a show list. ! ! COMPLETION CODES: ! ! none ! ! LOCAL buf_name, item, the_buffer_ptr; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$is_show_list"); ENDON_ERROR; ! Create the registration array is necessary ! IF lse$$x_show_list_reg_array = TPU$K_UNSPECIFIED THEN return false; ENDIF; if get_info(buffer_ptr, "type") <> BUFFER then the_buffer_ptr := current_buffer; else the_buffer_ptr := buffer_ptr; endif; item := lse$$x_show_list_reg_array {get_info( the_buffer_ptr, 'name' ) }; IF item <> tpu$k_unspecified then return true; else return false; endif; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_get_registered_info( buffer_mark_or_list_type, field ) !++ ! FUNCTIONAL DESCRIPTION: ! ! lse$shlst_get_registered_info returns one of the fields associated with ! the buffer or mark passed ! ! INPUTS ! ! buffer_mark_or_list_type - A buffer mark or show type to get info on ! ! field - Appropriate lse$$k_reg... constant ! ! RETURNS: ! ! The field contents requested ! LOCAL item, indx; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_get_registered_info"); ENDON_ERROR; ! Get the index for this one ! CASE GET_INFO( buffer_mark_or_list_type, "type" ) [BUFFER]: indx := GET_INFO( buffer_mark_or_list_type, 'name' ); [MARKER]: indx := GET_INFO( GET_INFO( buffer_mark_or_list_type, 'buffer' ), 'name' ); [KEYWORD]: indx := buffer_mark_or_list_type; [OTHERWISE]: indx := GET_INFO( current_buffer, 'name' ); ENDCASE; ! Performance of arrays if baddddd. This procedure gets called alot. ! It is typically called for the same buffer/array many times before ! changing. So we store cache the data ! IF indx = lse$$x_shlst_current_buf_name THEN RETURN lse$$shlst_current_field( field ); ELSE IF indx = lse$$x_shlst_current_keyword THEN RETURN lse$$shlst_current_field( field ); ENDIF; ENDIF; item := lse$$x_show_list_reg_array{ indx }; IF item <> tpu$k_unspecified then ! Cache the current items ! lse$$k_shlst_current_buffer_name := item{ lse$$k_reg_buffer_name }; lse$$k_shlst_current_show_keyword := item{ lse$$k_reg_show_keyword }; lse$$k_shlst_current_name_start := item{ lse$$k_reg_name_start }; lse$$k_shlst_current_name_end := item{ lse$$k_reg_name_end }; lse$$k_shlst_current_tname_proc := item{ lse$$k_reg_tname_proc }; lse$$k_shlst_current_first_proc := item{ lse$$k_reg_first_proc }; lse$$k_shlst_current_next_proc := item{ lse$$k_reg_next_proc }; lse$$k_shlst_current_find_proc := item{ lse$$k_reg_find_proc }; lse$$k_shlst_current_name_proc := item{ lse$$k_reg_name_proc }; lse$$k_shlst_current_expand_proc := item{ lse$$k_reg_expand_proc }; lse$$k_shlst_current_delete_proc := item{ lse$$k_reg_delete_proc }; lse$$k_shlst_current_goto_source_proc := item{ lse$$k_reg_goto_source_proc}; lse$$x_shlst_current_keyword := lse$$k_shlst_current_show_keyword; lse$$x_shlst_current_buf_name := lse$$k_shlst_current_buffer_name; return lse$$shlst_current_field( field ); else return TPU$K_UNSPECIFIED; endif; ENDPROCEDURE; PROCEDURE lse$$shlst_current_field( field ) !++ ! FUNCTIONAL DESCRIPTION: ! ! lse$lse$$shlst_current_field returns cached field values ! ! INPUTS ! ! field - Appropriate lse$$k_reg... constant ! ! RETURNS: ! ! The field contents requested ! CASE field [lse$$k_reg_buffer_name]: RETURN lse$$k_shlst_current_buffer_name; [lse$$k_reg_show_keyword]: RETURN lse$$k_shlst_current_show_keyword; [lse$$k_reg_name_start]: RETURN lse$$k_shlst_current_name_start; [lse$$k_reg_name_end]: RETURN lse$$k_shlst_current_name_end; [lse$$k_reg_tname_proc]: RETURN lse$$k_shlst_current_tname_proc; [lse$$k_reg_first_proc]: RETURN lse$$k_shlst_current_first_proc; [lse$$k_reg_next_proc]: RETURN lse$$k_shlst_current_next_proc; [lse$$k_reg_find_proc]: RETURN lse$$k_shlst_current_find_proc; [lse$$k_reg_name_proc]: RETURN lse$$k_shlst_current_name_proc; [lse$$k_reg_expand_proc]: RETURN lse$$k_shlst_current_expand_proc; [lse$$k_reg_delete_proc]: RETURN lse$$k_shlst_current_delete_proc; [lse$$k_reg_goto_source_proc]: RETURN lse$$k_shlst_current_goto_source_proc; [OTHERWISE]: eve$message( lse$_internerr, 0, 'lse$lse$$shlst_current_field' ); ENDCASE; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_execute_registered_proc( buffer_mark_or_list_type, field; show_item ) !++ ! FUNCTIONAL DESCRIPTION: ! ! lse$shlst_execute_registered_proc executes the procedure specified by the ! field. ! ! INPUTS ! ! buffer_mark_or_list_type - A buffer or mark to get info on ! ! field - Appropriate lse$$k_reg... constant ! ! show_item - Optional parameter to be passed ! ! RETURNS: ! ! returns what ever the procedure returns ! LOCAL proc; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_execute_registered_proc"); ENDON_ERROR; ! Create the registration array is necessary ! lse$$x_execute_passed_variable := show_item; proc := lse$shlst_get_registered_info( buffer_mark_or_list_type, field ); IF proc <> tpu$k_unspecified then execute( proc ); RETURN lse$$x_execute_return_variable; endif; RETURN 0; ENDPROCEDURE; ! !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_register( show_keyword; buffer_name ) ! ! FUNCTIONAL DESCRIPTION: ! ! LSE$SHLST_REGISTER register's a show list information about a ! show list buffer. ! ! INPUTS ! ! show_keyword - The keyword passed to LSE$SHOW to get the list ! ! RETURNS: ! ! success boolean ! ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_register"); ENDON_ERROR; CASE show_keyword [lse$buffer_list]: lse$shlst_register_full(buffer_name, lse$buffer_list, lse$$k_buffer_list_start_col, lse$$k_buffer_list_start_col - 1 + lse$$k_buffer_list_name_length, 'lse$$std_tname_proc(', 'GET_INFO( BUFFERS, "last" )', 'GET_INFO( BUFFERS, "previous" )', 'GET_INFO( BUFFERS, "find_buffer",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$buffer(', 'lse_delete_buffer(', 'lse_goto_buffer(' ); [lse$show_mark_list]: lse$shlst_register_full(buffer_name, lse$show_mark_list, 1, lse$k_mark_output_length, 'lse$$std_tname_proc(', , , , , 'lse$$show_lse$show_mark(', 'lse_delete_mark(', 'lse_goto_mark(' ); [lse$language_list]: lse$shlst_register_full(buffer_name, lse$language_list, 1, lse$k_lang_list_len, 'lse$$std_tname_proc(', 'GET_INFO(LSE$SYSTEM,"first",LSE$LANGUAGE )', 'GET_INFO(LSE$SYSTEM,"next",LSE$LANGUAGE )', 'GET_INFO( LSE$SYSTEM, "lse$find_language",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$language(', 'lse_delete_language(', ); [lse$alias_list]: lse$shlst_register_full(buffer_name, lse$alias_list, 2, lse$$k_alias_name_size+1, 'lse$$std_tname_proc(', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "first", lse$alias)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "next", lse$alias)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "lse$find_alias",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$alias(', 'lse_delete_alias(', ); [lse$adjustment_list]: lse$shlst_register_full(buffer_name, lse$adjustment_list, 2, lse$$k_adjust_name_size+1, 'lse$$std_tname_proc(', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "first", lse$adjustment)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "next", lse$adjustment)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "lse$find_adjustment",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$adjustment(', 'lse_delete_adjustment(', ); [lse$package_list]: lse$shlst_register_full(buffer_name, lse$package_list, 2, lse$$k_pack_name_size+1, 'lse$$std_tname_proc(', 'GET_INFO( LSE$SYSTEM, "first", lse$package)', 'GET_INFO( LSE$SYSTEM, "next", lse$package)', 'GET_INFO( LSE$SYSTEM, "lse$find_package",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$package(', 'lse_delete_package(', ); [lse$key_list]: lse$shlst_register_full(buffer_name, lse$key_list, 1, lse$$k_key_list_name_len, 'lse$$std_tname_proc(', 'GET_INFO( DEFINED_KEY, "first", eve$current_key_map_list )', 'GET_INFO( DEFINED_KEY, "next", eve$current_key_map_list )', 'lse$$get_key_keyword(', 'lse$$get_key_name(', 'lse$$show_keyname(', 'lse_delete_key(', ); [lse$placeholder_list]: lse$shlst_register_full(buffer_name, lse$placeholder_list, 1, lse$$k_plac_name_size+1, 'lse$$std_tname_proc_w_remove_quotes(', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "first", lse$placeholder)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "next", lse$placeholder)', 'GET_INFO(lse$get_curr_lang_element(LSE$LANGUAGE),"lse$find_placeholder",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$placeholder(', 'lse_delete_placeholder(', ); [lse$token_list]: lse$shlst_register_full(buffer_name, lse$token_list, 1, lse$$k_token_name_size+1, 'lse$$std_tname_proc_w_remove_quotes(', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "first", lse$token)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "next", lse$token)', 'GET_INFO( lse$get_curr_lang_element(LSE$LANGUAGE), "lse$find_token",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$token(', 'lse_delete_token(', ); [lse$pack_routine_list]: lse$shlst_register_full(buffer_name, lse$pack_routine_list, 1, lse$$k_routine_name_size+1, 'lse$$std_tname_proc_w_remove_quotes(', 'GET_INFO( lse$get_curr_lang_element(LSE$PACKAGE), "first", lse$routine)', 'GET_INFO( lse$get_curr_lang_element(LSE$PACKAGE), "next", lse$routine)', 'GET_INFO(lse$get_curr_lang_element(LSE$PACKAGE), "lse$find_routine",', 'lse$$shlst_get_std_name(', 'lse$$show_lse$routine(', 'lse_delete_routine(', ); [lse$lang_routine_list]: lse$shlst_register_full(buffer_name, lse$lang_routine_list, 1, lse$$k_routine_name_size+1, 'lse$$std_tname_proc_w_remove_quotes(', 'LSE$$FIRST_LANG_ROUTINE', 'LSE$$NEXT_LANG_ROUTINE', 'LSE$$FIND_LANG_ROUTINE(', 'lse$$shlst_get_std_name(', 'lse$$show_lse$routine(', 'lse_delete_routine(', ); [OTHERWISE]: eve$message( lse$_internerr, 0, 'lse$shlst_register' ); return false; ENDCASE; RETURN true; ENDPROCEDURE; !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_register_full( buffer_name, show_keyword, name_start, name_end, tname_proc, first_proc, next_proc; find_proc_name, name_proc, expand_proc_name, delete_proc_name, goto_source_proc_name) ! ! FUNCTIONAL DESCRIPTION: ! ! LSE$SHLST_REGISTER register's a show list information about a ! show list buffer. ! ! INPUTS ! ! buffer_name - The buffer name the show is in ! ! show_keyword - The keyword passed to LSE$SHOW to get the list ! ! name_start - The column the name starts on the line ! ! name_end - The column the name ends on the line ! ! tname_proc - Procedure name to call to find an entry. Will be ! called as EXECUTE( expand_proc_name + 'name )' ) ! ! first_proc - String to use in an EXECUTE call which returns the ! first item in the list from TPU. ! EXECUTE( 'first_item := ' + first_proc ); ! ! next_proc - String to use in an EXECUTE call which returns the ! next item in the list from TPU. ! EXECUTE( 'next_item := ' + next_proc ); ! ! find_proc_name - Procedure name to call to find an entry. Will be ! called as EXECUTE( expand_proc_name + 'name )' ) ! ! name_proc - Procedure name to call to get a name from a type. Will be ! called as EXECUTE( expand_proc_name + 'name )' ) ! ! expand_proc_name- Procedure name to call to expand an entry. Will be ! called as EXECUTE( expand_proc_name + 'show_item )' ) ! ! delete_proc_name- Procedure name to call to delete an entry. Will be ! called as EXECUTE( delete_proc_name + 'show_item )' ) ! ! goto_source_proc_name - Procedure name to call to delete an entry. ! Will be called as: ! EXECUTE( goto_source_proc_name + 'show_item )' ) ! ! RETURNS: ! ! success boolean ! LOCAL item; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_register_full"); ENDON_ERROR; ! Create the registration array is necessary ! IF lse$$x_show_list_reg_array = TPU$K_UNSPECIFIED THEN lse$$x_show_list_reg_array := CREATE_ARRAY; ENDIF; ! Add it to the list ! item := CREATE_ARRAY( lse$$k_reg_max, lse$$k_reg_min ); item{ lse$$k_reg_buffer_name } := buffer_name; item{ lse$$k_reg_show_keyword } := show_keyword; item{ lse$$k_reg_name_start } := name_start; item{ lse$$k_reg_name_end } := name_end; IF tname_proc <> tpu$k_unspecified THEN item{ lse$$k_reg_tname_proc } := COMPILE('lse$$x_execute_return_variable := ' + tname_proc + 'lse$$x_execute_passed_variable )' ); ENDIF; IF first_proc <> tpu$k_unspecified THEN item{ lse$$k_reg_first_proc } := COMPILE('lse$$x_execute_return_variable := ' + first_proc ); ENDIF; IF next_proc <> tpu$k_unspecified THEN item{ lse$$k_reg_next_proc } := COMPILE('lse$$x_execute_return_variable := ' + next_proc ); ENDIF; IF find_proc_name <> tpu$k_unspecified THEN item{ lse$$k_reg_find_proc } := COMPILE('lse$$x_execute_return_variable := ' + find_proc_name + 'lse$$x_execute_passed_variable )' ); ENDIF; IF name_proc <> tpu$k_unspecified THEN item{ lse$$k_reg_name_proc } := COMPILE('lse$$x_execute_return_variable := ' + name_proc + 'lse$$x_execute_passed_variable )' ); ENDIF; IF expand_proc_name <> tpu$k_unspecified THEN item{ lse$$k_reg_expand_proc } := COMPILE('lse$$x_execute_return_variable := ' + expand_proc_name + 'lse$$x_execute_passed_variable )' ); ENDIF; IF delete_proc_name <> tpu$k_unspecified THEN item{ lse$$k_reg_delete_proc } := COMPILE('lse$$x_execute_return_variable := ' + delete_proc_name + 'lse$$x_execute_passed_variable )' ); ENDIF; IF goto_source_proc_name <> tpu$k_unspecified THEN item{ lse$$k_reg_goto_source_proc} := COMPILE('lse$$x_execute_return_variable := ' + goto_source_proc_name + 'lse$$x_execute_passed_variable )' ); ENDIF; ! Index the array into the root array ! lse$$x_show_list_reg_array{ show_keyword } := item; IF buffer_name <> tpu$k_unspecified THEN lse$$x_show_list_reg_array{ buffer_name } := item; ENDIF; return true; ENDPROCEDURE; PROCEDURE lse$$shlst_get_std_name( item ) ! ! FUNCTIONAL DESCRIPTION: ! ! lse$$shlst_get_std_name returns a name given a type in the 'standard' way ! ! INPUTS ! ! item - arbitrary tpu type ! ! RETURNS: ! ! the name ! return GET_INFO( item, 'name' ); ENDPROCEDURE; PROCEDURE lse$$shlst_dump_registered( indx ) ! ! FUNCTIONAL DESCRIPTION: ! ! LSE$$SHLST_DUMP_REGISTERED dump the registered info ! ! INPUTS ! ! lse$$x_show_list_reg_array ! ! RETURNS: ! ! success boolean ! LOCAL item; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$shlst_dump_registered"); ENDON_ERROR; ! Create the registration array is necessary ! IF lse$$x_show_list_reg_array = TPU$K_UNSPECIFIED THEN MESSAGE( 'lse$$x_show_list_reg_array is unspecified' ); RETURN true; ENDIF; item := lse$$x_show_list_reg_array( indx ); message( 'lse$$k_reg_buffer_name: ' + lse$$shlst_output_str( item{ lse$$k_reg_buffer_name } ) ); message( 'lse$$k_reg_show_keyword: ' + lse$$shlst_output_str( item{ lse$$k_reg_show_keyword } ) ); message( 'lse$$k_reg_name_start: ' + lse$$shlst_output_str( item{ lse$$k_reg_name_start } ) ); message( 'lse$$k_reg_name_end: ' + lse$$shlst_output_str( item{ lse$$k_reg_name_end } ) ); message( 'lse$$k_reg_tname_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_tname_proc } ) ); message( 'lse$$k_reg_first_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_first_proc } ) ); message( 'lse$$k_reg_next_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_next_proc } ) ); message( 'lse$$k_reg_find_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_find_proc } ) ); message( 'lse$$k_reg_name_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_name_proc } ) ); message( 'lse$$k_reg_expand_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_expand_proc } ) ); message( 'lse$$k_reg_delete_proc: ' + lse$$shlst_output_str( item{ lse$$k_reg_delete_proc } ) ); message( 'lse$$k_reg_goto_source_pro: ' + lse$$shlst_output_str( item{ lse$$k_reg_goto_source_proc} ) ); ENDPROCEDURE; PROCEDURE lse$$shlst_output_str( output_item ) ! ! debugging routine ! ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$shlst_output_str"); ENDON_ERROR; CASE GET_INFO( output_item, 'type' ) [BUFFER]: RETURN GET_INFO( output_item, 'name' ); [STRING]: RETURN output_item; [KEYWORD]: RETURN STR( output_item ); [UNSPECIFIED]: RETURN 'unspecified'; [PROGRAM]: RETURN 'program'; [INTEGER]: RETURN STR( output_item ); [OTHERWISE]: eve$message( lse$_internerr, 0, 'lse$$shlst_output_str' ); ENDCASE; ENDPROCEDURE; ! !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! PROCEDURE lse$shlst_get_item( ref_mark, output_item ) !++ ! FUNCTIONAL DESCRIPTION: ! ! LSE$GET_LIST_ITEM parses a show list line and returns the item ! ! INPUTS ! ! ref_mark - A mark to get a buffer for ! ! item_type - The item's type ! ! OUTPUTS: ! ! output_item - The item for the mark ! ! RETURNS: ! ! Status keyword ! LOCAL item_line, item_name_pat, item_name_pat_len, count, current_name, name_start, name_end, hlt_range, last_loop_item, loop_item, status, match_name; ON_ERROR [OTHERWISE]: lse$$pop_position; lse$$pop_position; lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_get_item"); ENDON_ERROR; ! Marks are completely different, do them and be gone ! IF lse$shlst_get_registered_info( ref_mark, lse$$k_reg_show_keyword ) = lse$show_mark_list THEN status := lse$$get_mark_list_mark_name( ref_mark, output_item ); RETURN TRUE; ENDIF; ! Get the single line ! name_start := lse$shlst_get_registered_info( ref_mark, lse$$k_reg_name_start ); name_end := lse$shlst_get_registered_info( ref_mark, lse$$k_reg_name_end ); item_line := lse$shlst_line( ref_mark ); ! If the item list line contains ellipsis, we search through the item ! list to test for a possible wildcard match ! item_name_pat := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_tname_proc, SUBSTR( item_line, name_start, name_end-name_start+1) ); IF NOT lse$$is_name_truncated( item_name_pat ) THEN output_item := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_find_proc, item_name_pat ); IF output_item = 0 THEN RETURN false; ELSE RETURN true; ENDIF; ELSE item_name_pat := SUBSTR( item_name_pat, 1, LENGTH(item_name_pat) -lse$$k_ellipsis_len) + '*'; item_name_pat := lse$$shlst_remove_quotes( item_name_pat ); ENDIF; ! First see if we have multiple matches ! loop_item := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_first_proc ); count := 0; LOOP ! Get the current_name ! current_name := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_name_proc, loop_item ); ! Count multiple matches ! IF lse$$strmatch_wild( current_name, item_name_pat ) THEN last_loop_item := loop_item; count := count + 1; ENDIF; ! Next ! EXITIF count > 1; loop_item := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_next_proc ); EXITIF loop_item = 0; ENDLOOP; ! Success ! IF count = 1 THEN output_item := last_loop_item; RETURN true; ENDIF; ! Failure ! IF count = 0 THEN eve$message( lse$_cannotfind, 0, EDIT( SUBSTR( item_line, name_start, name_end - name_start + 1), TRIM) ); return false; ENDIF; ! Ambigious, try to resolve it ! lse$$push_position; ! Position to the item and save the position so the position ! in the item list item is unchanged ! POSITION( GET_INFO( ref_mark, 'buffer' )); lse$$push_position; ! Loop over the item to find the number of this ambigious item ! lse$top; count := 0; item_name_pat_len := LENGTH( item_name_pat ); LOOP ! Test for bottom of item ! EXITIF (GET_INFO( CURRENT_BUFFER, 'record_count' ) < GET_INFO( MARK( NONE ), 'record_number' )); ! Match? ! match_name := SUBSTR( lse$shlst_line( MARK( NONE) ), name_start, item_name_pat_len ); match_name := lse$$shlst_remove_quotes( match_name ); IF lse$$strmatch_wild( match_name, item_name_pat ) THEN ! Count the matches ! count := count + 1; ENDIF; ! Are we at the one we want ! hlt_range := lse$shlst_hlt_range( MARK( NONE ) ); EXITIF GET_INFO( ref_mark, 'within_range', hlt_range ); ! Next ! POSITION( END_OF( hlt_range ) ); LSE$MOVE_HORIZONTAL( 1 ); ENDLOOP; ! Walk the item list to find the one we are on ! output_item := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_first_proc ); LOOP ! Out of items ! EXITIF output_item = 0; ! Match ! IF lse$$strmatch_wild( SUBSTR( lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_name_proc, output_item ), 1, item_name_pat_len ), item_name_pat ) THEN ! Done when we've found the same number of matches as above ! EXITIF count = 1; count := count - 1; ENDIF; ! Next ! output_item := lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_next_proc); ENDLOOP; ! Pop twice, once for original position on entry, once for item ! list item position on entry ! lse$$pop_position; lse$$pop_position; ! Make sure it is a match ! IF lse$$strmatch_wild( SUBSTR( lse$shlst_execute_registered_proc( ref_mark, lse$$k_reg_name_proc, output_item ), 1, item_name_pat_len ), item_name_pat ) THEN RETURN true; ELSE RETURN false; ENDIF; ENDPROCEDURE; ! !doc_begin ! ! ONE LINE DEFINITION: ! «TBS» ! ! DESCRIPTION: ! «TBS» ! ! RELATED COMMANDS: ! «TBS» ! ! EXAMPLE: ! «TBS» ! ! CATEGORY: ! «TBS» ! !doc_end ! procedure lse$shlst_process( show_item, show_list_type ) ! ! FUNCTION: ! ! LSE$SHLST_PROCESS determines whether to show a list or single show ! ! INPUTS: ! ! show_item - String, the user input ! ! show_list_type - Keyword to use to get a show list ! ! OUTPUTS: ! ! Show list or show ! ! RETURNS: ! ! success_boolean ! LOCAL item_ptr, count, count_name, current_name, item_name_pat, last_loop_item, loop_item, name_start, name_end, saved_mark, saved_mod, status, try_first_match; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$shlst_process"); ENDON_ERROR; ! Register ! lse$shlst_register( show_list_type ); IF show_list_type = LSE$KEY_LIST THEN ! Eve's parsing of wildcarded key names produces bad messages. ! So we avoid it all together ! IF lse$$wildcard_name( show_item ) THEN try_first_match := false; ELSE try_first_match := true; ENDIF; ELSE try_first_match := true; ENDIF; ! Should we try a first match? ! IF try_first_match THEN loop_item := lse$shlst_execute_registered_proc( show_list_type, lse$$k_reg_find_proc, show_item ); IF loop_item <> 0 THEN lse$shlst_process := lse$show( loop_item ); RETURN; ELSE IF (lse$$wildcard_name( show_item ) = FALSE) AND (show_item <> '*') THEN eve$message( lse$_cannotfind, 0, show_item ); lse$shlst_process := FALSE; RETURN; ENDIF; ENDIF; ENDIF; ! Get them all into a buffer ! lse$shlst_process := lse$show(show_list_type); ! Special case "*" ! IF (show_item = '*') AND (get_info( current_buffer, 'record_count') > 8) ! Arbitrary number THEN ! We're done when there are a bunch of records in the buffer, ! That is it isn't possible that there is just one item in the list ! RETURN; ENDIF; ! Save where the list left the cursor ! saved_mark := MARK( NONE ); ! Position to the first line ! lse$top; POSITION( lse$shlst_hlt_range( MARK( NONE ) ) ); name_start := lse$shlst_get_registered_info( MARK(NONE), lse$$k_reg_name_start ); name_end := lse$shlst_get_registered_info( MARK(NONE), lse$$k_reg_name_end ); ! Strip out lines that don't match ! saved_mod := SET( MODIFIABLE, CURRENT_BUFFER, ON ); LOOP ! Do the match test simply against the text on the ! line if possible ! item_name_pat := lse$shlst_execute_registered_proc( MARK(NONE), lse$$k_reg_tname_proc, SUBSTR( lse$shlst_line( MARK(NONE) ), name_start, name_end-name_start+1) ); IF lse$$is_name_truncated( item_name_pat ) THEN ! Strip off "..." ! item_name_pat := SUBSTR( item_name_pat, 1, LENGTH(item_name_pat) - lse$$k_ellipsis_len ) + '*'; ENDIF; item_name_pat := lse$$shlst_remove_quotes( item_name_pat ); ! Can we just test the strings as they appear? ! IF LENGTH( item_name_pat ) >= LENGTH( show_item ) THEN ! Simple text test if possible ! IF lse$$strmatch_wild( item_name_pat, show_item ) THEN ! Match ! IF lse$shlst_get_item( MARK(NONE), item_ptr ) THEN count := count + 1; count_name := lse$shlst_execute_registered_proc( show_list_type, lse$$k_reg_name_proc, item_ptr ); MOVE_VERTICAL( 1 ); ELSE RETURN true; ENDIF; ELSE ! No match ! ERASE_LINE; ENDIF; ELSE ! Input name is longer that the current item ! IF item_name_pat <> SUBSTR( show_item, 1, LENGTH(item_name_pat) ) THEN ! If the left most don't match they can't possible match ! ERASE_LINE; ELSE ! We couldn't match it just by the text one the line ! Get the item off the line ! IF lse$shlst_get_item( MARK(NONE), item_ptr ) THEN ! Does it match ! IF lse$$strmatch_wild( lse$shlst_execute_registered_proc( show_list_type, lse$$k_reg_name_proc, item_ptr ), show_item ) THEN ! Match ! count := count + 1; count_name := lse$shlst_execute_registered_proc( show_list_type, lse$$k_reg_name_proc, item_ptr ); MOVE_VERTICAL( 1 ); ELSE ! No match ! ERASE_LINE; ENDIF; ELSE MOVE_VERTICAL( 1 ); ENDIF; ENDIF; ENDIF; ! Done on end of item ! EXITIF END_OF(lse$shlst_hlt_range(MARK(NONE ))) < MARK(NONE); ENDLOOP; SET( MODIFIABLE, CURRENT_BUFFER, saved_mod ); POSITION( SAVED_MARK ); lse$shlst_process := TRUE; ! If we found only one, show it full ! IF count = 1 THEN lse$delete_created_show_window; lse$shlst_process := lse$show( lse$shlst_execute_registered_proc( show_list_type, lse$$k_reg_find_proc, count_name ) ); ENDIF; endprocedure; PROCEDURE lse$$get_key_keyword( kname ) ! ! FUNCTIONAL DESCRIPTION: ! ! lse$$get_key_keyword returns the tpu keyword for the keyname ! ! It is a jacket for lse$prompt_key to conform to the calling convention ! to register a show list. ! ! INPUTS ! ! kname - The key name to translate ! ! RETURNS: ! ! the keyword for the key ! LOCAL key_keyword; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$get_key_keyword"); ENDON_ERROR; lse$prompt_key( kname, key_keyword, '' ); return key_keyword; ENDPROCEDURE; PROCEDURE lse$$get_key_name( kname ) ! ! FUNCTIONAL DESCRIPTION: ! ! lse$$get_key_name returns the keyname translated for V3.1 compatability ! ! It is a jacket for lse$convert_keyname( eve$key_name( ! to register a show list. ! ! INPUTS ! ! kname - The key name to translate ! ! RETURNS: ! ! the keyword for the key ! LOCAL key_keyword; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$get_key_name"); ENDON_ERROR; return lse$convert_keyname( eve$key_name( kname ) ); ENDPROCEDURE; procedure lse$$remove_quotes( the_string ) local first_char; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$remove_quotes"); ENDON_ERROR; first_char := substr(the_string, 1, 1); if (first_char <> '"') and (first_char <> "'") then return the_string; endif; if substr(the_string, length(the_string), 1) = first_char then return substr(the_string, 2, length(the_string) - 2); else return the_string; endif; endprocedure; procedure lse$$std_tname_proc_w_remove_quotes( item ) ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$std_tname_proc_w_remove_quotes"); ENDON_ERROR; return lse$$remove_quotes( EDIT( item, TRIM ) ); endprocedure; procedure lse$$shlst_remove_quotes( the_string ) local first_char; ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$remove_quotes"); ENDON_ERROR; first_char := substr(the_string, 1, 1); if (first_char <> '"') and (first_char <> "'") then return the_string; endif; if substr(the_string, length(the_string), 1) = first_char then return substr(the_string, 2, length(the_string) - 2); else return substr(the_string, 2, length(the_string)); endif; endprocedure; procedure lse$$std_tname_proc( item ) ON_ERROR [OTHERWISE]: lse$$unexpected_error( ERROR, ERROR_TEXT, ERROR_LINE, "lse$$std_tname_proc"); ENDON_ERROR; return EDIT( item, TRIM ); endprocedure; VARIABLE lse$$x_old_range_buffer, lse$$x_show_list_array, lse$$x_show_list_reg_array, ! Variables to allow us to do EXECUTE magic in ! lse$shlst_execute_registered_proc ! lse$$x_execute_passed_variable, lse$$x_execute_return_variable, ! Cached values for performance ! lse$$k_shlst_current_buffer_name, lse$$k_shlst_current_show_keyword, lse$$k_shlst_current_name_start, lse$$k_shlst_current_name_end, lse$$k_shlst_current_tname_proc, lse$$k_shlst_current_first_proc, lse$$k_shlst_current_next_proc, lse$$k_shlst_current_find_proc, lse$$k_shlst_current_name_proc, lse$$k_shlst_current_expand_proc, lse$$k_shlst_current_delete_proc, lse$$k_shlst_current_goto_source_proc, lse$$x_shlst_current_keyword, lse$$x_shlst_current_buf_name; CONSTANT lse$$k_reg_min := 0, lse$$k_reg_buffer_name := 0, lse$$k_reg_show_keyword := 1, lse$$k_reg_name_start := 2, lse$$k_reg_name_end := 3, lse$$k_reg_tname_proc := 4, lse$$k_reg_first_proc := 5, lse$$k_reg_next_proc := 6, lse$$k_reg_find_proc := 7, lse$$k_reg_name_proc := 8, lse$$k_reg_expand_proc := 9, lse$$k_reg_delete_proc := 10, lse$$k_reg_goto_source_proc := 11, lse$$k_reg_max := 11;