MODULE SCA$REPORT_PACKAGE IDENT "T4.0-13" !************************************************************************* ! * ! © 2000 BY * ! COMPAQ COMPUTER CORPORATION * ! © 2000 BY * ! ELECTRONIC DATA SYSTEMS LIMITED * ! * ! 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 OR 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 COMPAQ COMPUTER * ! CORPORATION OR EDS. * ! * ! NEITHER COMPAQ NOR EDS ASSUME ANY RESPONSIBILITY FOR THE USE OR * ! RELIABILITY OF THIS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY * ! COMPAQ. * ! * !************************************************************************* !++ ! Facility: ! SCA - Language Sensitive Editor ! REPORT - Report Tool Subfacility ! ! Abstract: ! This module implements the Package report. !-- ! Global variables (options) used in this module. ! VARIABLE sca$report_option_help_library, sca$report_option_languages; PROCEDURE sca$report_package !++ ! FUNCTIONAL DESCRIPTION: ! ! This is the Digital-specific routine for the Package report. ! Customers who wish to modify this routine should first rename it. ! Options for this report are described in SCA$REPORT_CUSTOMIZATIONS.TPU. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_PACKAGE'); ENDON_ERROR; ! Do report initialization (create buffers, open the output file, etc.). ! sca$report_portable_initialization; ! Build the report definition. ! sca$report_build_definition_package; ! Generate the report. ! sca$report_process_queries; ! Do common cleanup ! sca$report_post_process; sca$report_common_cleanup; RETURN; ENDPROCEDURE PROCEDURE sca_report_define_options_package !++ ! FUNCTIONAL DESCRIPTION: ! ! Define the valid options for the PACKAGE report. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA_REPORT_DEFINE_OPTIONS_PACKAGE'); ENDON_ERROR; ! Define valid options for the PACKAGE report. ! sca$report_add_valid_option ('domain_query', '', 'sca$report_process_option_domain_query'); sca$report_add_valid_option ('output', '', 'sca$report_process_option_output'); sca$report_add_valid_option ('target', 'LSE', 'sca$report_process_option_package_target'); sca$report_add_valid_option ('languages', '', ''); sca$report_add_valid_option ('help_library', '', ''); sca$report_add_valid_option ('routine_depth', '1', 'sca$report_process_option_number_or_all'); sca$report_add_valid_option ('sca_debug_messages', False, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('status_messages', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('traceback_flag', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('trace_messages', False, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('use_source_spelling', True, 'sca$report_process_option_boolean'); ENDPROCEDURE PROCEDURE sca$report_build_definition_package !++ ! FUNCTIONAL DESCRIPTION: ! ! Build the report definition array for the PACKAGE report. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_BUILD_DEFINITION_PACKAGE'); ENDON_ERROR; ! Initialize subdefinition array. ! sca$report_subdefinition_array := CREATE_ARRAY(1); sca$report_subdefinition_index := 0; !========================================================================= ! Subdefinition for routine subqueries - it contains 2 entries. ! sca$report_create_subdefinition ('routine subqueries', 2); !------------------------------------------------------------------------- ! level +0 - routine remark ! $REMARK query ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (0, 1, 2, 0); sca$report_definition_add_label ('remark entry'); sca$report_definition_add_query (sca$report_k_query_routine_remark); sca$report_definition_add_info (sca$report_k_info_type_tag_name, sca$report_location_tag_name); sca$report_definition_add_info (sca$report_k_info_type_tag_text, sca$report_location_tag_text); !------------------------------------------------------------------------- ! level +0 - parameters ! parameters_query ! attribute - type NAME, location parameter_name ! attribute - type VARIABLE_TYPE, location parameter_type ! attribute - type SOURCE_LOCATION, location source_location ! attribute - type MECHANISM, location parameter_mechanisn ! entity_query_name - SCA$REPORT_CURRENT_PARAMETER ! sca$report_definition_add_entry (0, 1, 4, 1); sca$report_definition_add_label ('parameters entry'); sca$report_definition_add_option (sca$report_k_option_order_lexical); sca$report_definition_add_query (sca$report_k_query_parameters); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_parameter_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_parameter_type); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); sca$report_definition_add_info (sca$report_k_info_type_mechanism, sca$report_location_parameter_mechanism); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_PARAMETER'); !------------------------------------------------------------------------- ! End of subdefinition ! sca$report_end_subdefinition; !========================================================================= ! Now build the main definition for this report. It will have 4 direct ! entries, plus 4 from INCLUDEs, for a total of 8. ! sca$report_create_definition (8); !------------------------------------------------------------------------- ! files entry: ! level 1 ! files_query (2 possibilities, depending on sca$report_domain) ! attribute - type NAME, location file_name ! entity_query_name - SCA$REPORT_CURRENT_FILE ! sca$report_definition_add_entry (1, 1, 1, 4); sca$report_definition_add_label ('files entry'); ! The query to get all files for the report depends on the value of the ! /DOMAIN qualifier, and is set up by the before_query action routine. ! sca$report_definition_add_query (0); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_file_name); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_FILE'); ! Action routine for before files query - set up file query expression. ! sca$report_definition_add_action_routine ( 'sca$report_setup_file_query', sca$report_k_invoke_before_query); ! Action routine for after files query - write output file header. ! sca$report_definition_add_action_routine ( 'sca$report_start_package_file', sca$report_k_invoke_after_query); ! Action routine for before each file is processed - set up variables ! sca$report_current_decl_class and sca$report_current_file, to be used in ! forming dynamic queries. ! sca$report_definition_add_action_routine ( 'sca$report_do_file_setup_specs', sca$report_k_invoke_before_each_entity); ! Action routine for after each file is processed - close source files and ! dump output buffer. ! sca$report_definition_add_action_routine ( 'sca$report_cleanup_file', sca$report_k_invoke_after_each_entity); !------------------------------------------------------------------------- ! modules entry: ! level 2 ! modules_query (depends on language) ! attribute - type NAME, location module_name ! entity_query_name - SCA$REPORT_CURRENT_MODULE ! sca$report_definition_add_entry (2, 1, 1, 1); sca$report_definition_add_label ('modules entry'); ! The variables sca$report_current_decl_class and sca$report_current_file ! are filled in by an action routine for the files entry. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_modules_1, 'sca$report_current_decl_class', sca$report_k_query_modules_2 + '"', 'sca$report_current_file', '"' ); sca$report_definition_add_option (sca$report_k_option_newitem); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_module_name); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_MODULE'); ! Action routine for after each module is processed - generate the package ! definition for the entire module. ! sca$report_definition_add_action_routine ( 'sca$report_do_package_module', sca$report_k_invoke_after_each_entity); !------------------------------------------------------------------------- !routines entry: ! level 3 ! routines_query (depends on language) ! attribute - type NAME, location routine_name ! entity_query_name - SCA$REPORT_CURRENT_ROUTINE ! sca$report_definition_add_entry (3, 1, 1, 1); sca$report_definition_add_label ('routines entry'); ! The variable sca$report_current_decl_class is filled in by an action ! routine for the files entry. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_routines_1, 'sca$report_current_decl_class', sca$report_k_query_routines_2, 'sca$report_option_routine_depth', sca$report_k_query_routines_3 ); sca$report_definition_add_option (sca$report_k_option_newitem); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_ROUTINE'); ! Action routine for before each routine is processed - write status ! message. ! sca$report_definition_add_action_routine ( 'sca$report_do_routine_setup', sca$report_k_invoke_before_each_entity); !------------------------------------------------------------------------- ! INCLUDE subdefinition for routine subqueries ! level 4 ! sca$report_definition_include_subdefinition (4, 'routine subqueries'); !------------------------------------------------------------------------- ! nonmodules entry: ! level 2 ! nonmodules_query (depends on language) ! attribute - type NAME, location module_name ! entity_query_name - SCA$REPORT_CURRENT_MODULE ! sca$report_definition_add_entry (2, 1, 0, 2); sca$report_definition_add_label ('nonmodules entry'); ! The variables sca$report_current_decl_class and sca$report_current_file ! are filled in by an action routine for the files entry. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_nonmodules_1, 'sca$report_current_decl_class', sca$report_k_query_nonmodules_2 + '"', 'sca$report_current_file', '"' ); !------------------------------------------------------------------------- ! nonmodules routines entry: ! level 3 ! nonmodules routines query ! attribute - type NAME, location routine_name ! entity_query_name - SCA$REPORT_CURRENT_ROUTINE ! sca$report_definition_add_entry (3, 1, 1, 3); sca$report_definition_add_label ('nonmodules routines entry'); sca$report_definition_add_option (sca$report_k_option_once_only); ! If routine_depth is 1, this is a dummy query, just to get us a copy of ! the set of routines, etc. that comprise the non-module compilation units ! for the current file. ! If routine_depth is ALL or some number > 1, this query gets all the ! nested routines as well. sca$report_definition_add_query_dynamic ( 'FIND @SCA$REPORT_CURRENT_MODULE', 'sca$report_nesting_part' ); sca$report_definition_add_option (sca$report_k_option_newitem); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_ROUTINE'); ! Action routine for before the query is processed - set the variable ! sca$report_nesting_part to be the portion of the query expression needed ! to include routines to the specified depth. ! sca$report_definition_add_action_routine ( 'sca$report_setup_routine_nesting', sca$report_k_invoke_before_query); ! Action routine for before each routine is processed - write status ! message. ! sca$report_definition_add_action_routine ( 'sca$report_do_routine_setup', sca$report_k_invoke_before_each_entity); ! Action routine for after all subqueries are processed - generate a ! package definition for all the nonmodule routines. ! sca$report_definition_add_action_routine ( 'sca$report_do_package_nonmodules', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! INCLUDE subdefinition for routine subqueries ! level 4 ! sca$report_definition_include_subdefinition (4, 'routine subqueries'); !========================================================================= ENDPROCEDURE PROCEDURE sca$report_package_dump_parameters (parameter_array, package_name) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure writes the DEFINE PARAMETER statements for a given package. ! It is used only when the report target is VMS command language. ! ! FORMAL PARAMETERS: ! ! parameter_array ! ! An array whose indices are parameter names, and whose values are ! the source spellings of the names. IN parameter. ! ! package_name ! ! The name of the package. IN parameter. !-- LOCAL parameter_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_PACKAGE_DUMP_PARAMETERS'); ENDON_ERROR; parameter_name := GET_INFO(parameter_array,'FIRST'); LOOP EXITIF parameter_name = tpu$k_unspecified; sca$report_append_text ( 'DEFINE PARAMETER ' + parameter_array{parameter_name} + ' /PACKAGE=' + package_name, TRUE); parameter_name := GET_INFO(parameter_array,'NEXT'); ENDLOOP; RETURN ENDPROCEDURE PROCEDURE sca$report_package_parameters (parameter_entry_result, parameter_array) !++ ! FUNCTIONAL DESCRIPTION: ! ! If the report output is portable commands, this procedure writes the ! SET ROUTINE PARAMETER commands for the current routine. ! ! If the report output is VMS commands, this procedure writes the ! parameters part of the DEFINE ROUTINE command, and sets up the parameter ! array. ! ! In a portable command sequence, this procedure writes a sequence of ! commands like this: ! ! LSE SET ROUTINE PARAMETER p1 REQUIRED attribute ! LSE SET ROUTINE PARAMETER p2 REQUIRED attribute ! ... ! ! In the VMS command: ! ! DEFINE ROUTINE routine-name parameter[,...] ! ! this procedure writes the parameter[,...] part. The actual format used is ! ! DEFINE ROUTINE routine-name - ! parameter/BY_xxx , - ! ... ! /PACKAGE=package-name ! ! The parameter array is set up so that the indices are parameter names. ! This array will be used later, to write the DEFINE PARAMETER commands. ! ! FORMAL PARAMETERS: ! ! parameter_entry_result ! ! The entry result for the parameters of one routine. IN parameter. ! ! parameter_array ! ! An array, whose indices are parameter names. This array must have been ! previously initialized by CREATE_ARRAY. IN OUT parameter. !-- LOCAL i, n_parameters, parameter_name, parameter_mechanism, parameter_occurrence_result, parameter_text; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_PACKAGE_PARAMETERS'); ENDON_ERROR; ! Check for an empty result (no parameters). ! IF parameter_entry_result{sca$report_k_entry_number_occurrences} = 0 THEN RETURN; ENDIF; ! Write all the parameters. For each parameter, also write the passing ! mechanism (VALUE, REFERENCE, or DESCRIPTOR) if it's present in the SCA ! library. ! i := 1; n_parameters := parameter_entry_result{sca$report_k_entry_number_occurrences}; LOOP EXITIF i > n_parameters; parameter_occurrence_result := sca$report_fetch_occurrence (parameter_entry_result, i); sca$report_fetch_result (parameter_occurrence_result, sca$report_location_parameter_name, parameter_name); sca$report_fetch_result (parameter_occurrence_result, sca$report_location_parameter_mechanism, parameter_mechanism); IF sca$report_target_index = sca$report_k_target_lse_portable THEN ! Generate portable commands ! IF parameter_mechanism <> '' THEN sca$report_append_text ( ' LSE SET ROUTINE PARAMETER ' + parameter_name + ' REQUIRED ' + parameter_mechanism, TRUE); ELSE sca$report_append_text ( ' LSE SET ROUTINE PARAMETER ' + parameter_name + ' REQUIRED UNKNOWN', TRUE); ENDIF; ELSE ! Generate VMS syntax ! parameter_text := parameter_name; IF parameter_mechanism <> '' THEN parameter_text := parameter_text + '/BY_' + parameter_mechanism; ENDIF; IF i = n_parameters THEN parameter_text := parameter_text + ' -'; ELSE parameter_text := parameter_text + ', -'; ENDIF; sca$report_append_text (' ' + parameter_text, TRUE); ! Remember the parameter name so that we can later write the ! DEFINE PARAMETER command for it. ! parameter_array {CHANGE_CASE(parameter_name,UPPER,NOT_IN_PLACE)} := parameter_name; ENDIF; i := i + 1; ENDLOOP; RETURN; ENDPROCEDURE PROCEDURE sca$report_start_package_file !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes introductory formatting material for the PACKAGE ! file. This consists of a version number and timestamp. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_START_PACKAGE_FILE'); ENDON_ERROR; sca$report_append_text (FAO ('!! Generated by the SCA Report Tool, ' + sca$report_package_module_ident + ', !%D', 0), TRUE); ENDPROCEDURE PROCEDURE sca$report_do_package_module !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the package definition for an entire module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL i, package_name, parameter_array, parameter_entry_result, routine_entry_result, routine_occurrence_result, routine_name, routine_remark, routine_remark_entry_result, routine_remark_occurrence_result; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_PACKAGE_MODULE'); ENDON_ERROR; ! Fetch the module name. The current occurrence array is for the module ! being processed. ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_module_name, package_name); ! Invent a name if there is none for the module (this can happen for an Ada ! generic package). ! IF package_name = '' THEN package_name := 'Unnamed module'; ENDIF; ! Fetch the entry result for the routines query. If there are no routines ! within this module, just return. ! routine_entry_result := sca$report_fetch_entry (sca$report_current_occurrence_result, 'routines entry'); IF routine_entry_result{sca$report_k_entry_number_occurrences} = 0 THEN RETURN; ENDIF; ! Generate the package definition. ! IF sca$report_target_index = sca$report_k_target_lse_portable THEN sca$report_define_one_package_port (package_name, routine_entry_result); ELSE sca$report_define_one_package_vms (package_name, routine_entry_result); ENDIF; ENDPROCEDURE PROCEDURE sca$report_do_package_nonmodules !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the package definition for all the "non-module" ! routines within a file. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL file_name, file_occurrence, i, package_name, parameter_array, parameter_entry_result, routine_entry_result, routine_occurrence_result, routine_name, routine_remark, routine_remark_entry_result, routine_remark_occurrence_result; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_PACKAGE_NONMODULES'); ENDON_ERROR; ! Fetch the file name. Its occurrence array is the parent of the current ! entry array. ! file_occurrence := sca$report_current_entry_result{sca$report_k_occurrence_parent_link}; sca$report_fetch_result (file_occurrence, sca$report_location_file_name, file_name); package_name := FILE_PARSE (file_name, '', '', NAME); ! Fetch the entry result for the routines query. If there are no routines ! within this module, just return. ! routine_entry_result := sca$report_current_entry_result; IF routine_entry_result{sca$report_k_entry_number_occurrences} = 0 THEN RETURN; ENDIF; ! Generate the package definition. ! IF sca$report_target_index = sca$report_k_target_lse_portable THEN sca$report_define_one_package_port (package_name, routine_entry_result); ELSE sca$report_define_one_package_vms (package_name, routine_entry_result); ENDIF; ENDPROCEDURE PROCEDURE sca$report_define_one_package_port (package_name, routine_entry_result) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure writes the portable LSE commands to define a single package. ! ! FORMAL PARAMETERS: ! ! package_name ! ! The name of the package. This is the name of the current compilation ! unit, if it's a module. If not, the package name is the name of the ! source file. IN parameter. !-- LOCAL i, lang, lang_list; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DEFINE_ONE_PACKAGE_PORT'); ENDON_ERROR; sca$report_append_text ('LSE NEW PACKAGE ' + package_name, TRUE); sca$report_append_text ( ' LSE SET PACKAGE ROUTINE EXPAND LSE$PKG_EXPAND_ROUT_', TRUE); sca$report_append_text ( ' LSE SET PACKAGE PARAMETER EXPAND LSE$PKG_EXPAND_PARM_', TRUE); IF (GET_INFO (sca$report_option_help_library, 'TYPE') = STRING) AND (sca$report_option_help_library <> '') THEN sca$report_append_text ( ' LSE SET PACKAGE HELP LIBRARY ' + sca$report_option_help_library, TRUE); ENDIF; sca$report_append_text (' LSE SET PACKAGE HELP TOPIC "' + package_name + '"', TRUE); ! Get language list into a normalized form. ! IF GET_INFO (sca$report_option_languages, 'TYPE') = STRING THEN lang_list := sca$report_option_languages; ! Strip parens, if present. ! LOOP EXITIF INDEX (lang_list, '(') = 0; lang_list := lang_list - '('; ENDLOOP; LOOP EXITIF INDEX (lang_list, ')') = 0; lang_list := lang_list - ')'; ENDLOOP; ! Remove extra blank space. ! EDIT (lang_list, COMPRESS, TRIM); ELSE lang_list := ''; ENDIF; IF lang_list <> '' THEN LOOP EXITIF lang_list = ''; ! Find the next language name in the list. ! i := INDEX (lang_list, ','); IF i = 0 THEN lang := lang_list; lang_list := ''; ELSE lang := SUBSTR (lang_list, 1, i-1); lang_list := SUBSTR (lang_list, i+1); ENDIF; lang := EDIT (lang, TRIM); sca$report_append_text (' LSE SET PACKAGE LANGUAGE ' + lang, TRUE); ENDLOOP; ELSE sca$report_append_text ( ' LSE SET PACKAGE LANGUAGE {defined_language}', TRUE); ENDIF; sca$report_blank_line; sca$report_define_routines (package_name, routine_entry_result); RETURN; ENDPROCEDURE PROCEDURE sca$report_define_one_package_vms (package_name, routine_entry_result) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure writes the VMS commands to define a single package. ! ! FORMAL PARAMETERS: ! ! package_name ! ! The name of the package. This is the name of the current compilation ! unit, if it's a module. If not, the package name is the name of the ! source file. IN parameter. !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DEFINE_ONE_PACKAGE_VMS'); ENDON_ERROR; sca$report_append_text ('DEFINE PACKAGE ' + package_name + '-', TRUE); sca$report_append_text (' /ROUTINE_EXPAND=LSE$PKG_EXPAND_ROUT_ -', TRUE); sca$report_append_text (' /PARAMETER_EXPAND=LSE$PKG_EXPAND_PARM_ -', TRUE); IF (GET_INFO (sca$report_option_help_library, 'TYPE') = STRING) AND (sca$report_option_help_library <> '') THEN sca$report_append_text ( ' /HELP_LIBRARY=' + sca$report_option_help_library + ' -', TRUE); ENDIF; sca$report_append_text (' /TOPIC_STRING="' + package_name + '" -', TRUE); IF (GET_INFO (sca$report_option_languages, 'TYPE') = STRING) AND ( sca$report_option_languages <> '') THEN sca$report_append_text (' /LANGUAGE=' + sca$report_option_languages, TRUE); ELSE sca$report_append_text (' /LANGUAGE=({language-name1}...)', TRUE); ENDIF; sca$report_blank_line; sca$report_define_routines (package_name, routine_entry_result); RETURN; ENDPROCEDURE PROCEDURE sca$report_define_routines (package_name, routine_entry_result) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure writes the definitions for all the routines in a single ! package. ! ! FORMAL PARAMETERS: ! ! package_name ! The name of the package, as a string. IN parameter. ! !-- LOCAL i, parameter_array, parameter_entry_result, routine_occurrence_result, routine_name, routine_remark, routine_remark_entry_result, routine_remark_occurrence_result; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DEFINE_ROUTINES'); ENDON_ERROR; ! Generate the routine definition for each routine in the package. ! IF sca$report_target_index = sca$report_k_target_lse_vms THEN parameter_array := CREATE_ARRAY; ENDIF; i := 1; LOOP EXITIF i > routine_entry_result{sca$report_k_entry_number_occurrences}; ! Fetch the occurrence for the next routine. ! routine_occurrence_result := sca$report_fetch_occurrence (routine_entry_result, i); ! Fetch the routine's name. ! sca$report_fetch_result (routine_occurrence_result, sca$report_location_routine_name, routine_name); ! Fetch the parameters for this routine. ! parameter_entry_result := sca$report_fetch_entry (routine_occurrence_result, 'parameters entry'); ! Fetch the remark string for the routine (if any). ! routine_remark_entry_result := sca$report_fetch_entry (routine_occurrence_result, 'remark entry'); IF routine_remark_entry_result{sca$report_k_entry_number_occurrences} > 0 THEN routine_remark_occurrence_result := sca$report_fetch_occurrence (routine_remark_entry_result, 1); sca$report_fetch_result (routine_remark_occurrence_result, sca$report_location_tag_text, routine_remark); ELSE routine_remark := ''; ENDIF; ! Write the commands to define the routine and its parameters. ! IF sca$report_target_index = sca$report_k_target_lse_portable THEN ! Write portable commands for this routine. ! Write the NEW ROUTINE command. ! sca$report_append_text ('LSE NEW ROUTINE "' + routine_name + '"', TRUE); ! Write the SET ROUTINE HELP TOPIC command. ! sca$report_append_text ( ' LSE SET ROUTINE HELP TOPIC "' + routine_name + '"', TRUE); ! Write the SET ROUTINE DESCRIPTION command. ! IF routine_remark <> '' THEN sca$report_append_text ( ' LSE SET ROUTINE DESCRIPTION "' + STR(routine_remark) + '"', TRUE); ENDIF; ! Write the NEW and SET ROUTINE PARAMETER commands for the routine. ! sca$report_package_parameters (parameter_entry_result, 0); ELSE ! Write VMS commands for this routine. ! Write the DEFINE ROUTINE command. ! sca$report_append_text ('DEFINE ROUTINE "' + routine_name + '" -', TRUE); ! Write the parameters part of the DEFINE ROUTINE command. ! sca$report_package_parameters (parameter_entry_result, parameter_array); ! Write the DEFINE ROUTINE /TOPIC_STRING qualifier. ! sca$report_append_text (' /TOPIC_STRING="' + routine_name + '" -', TRUE); ! Write the DEFINE ROUTINE /DESCRIPTION qualifier. ! IF routine_remark <> '' THEN sca$report_append_text ( ' /DESCRIPTION= "' + STR(routine_remark) + '" -', TRUE); ENDIF; ! Write the DEFINE ROUTINE /PACKAGE qualifier ! sca$report_append_text (' /PACKAGE= ' + package_name, TRUE); ENDIF; sca$report_blank_line; i := i + 1; ENDLOOP; ! Write VMS parameter definitions for all the routines processed above ! IF sca$report_target_index = sca$report_k_target_lse_vms THEN sca$report_package_dump_parameters (parameter_array, package_name); DELETE (parameter_array); ENDIF; ENDPROCEDURE PROCEDURE sca$report_process_option_package_target (option_name, option_value, is_default) !++ ! FUNCTIONAL DESCRIPTION: ! ! Process the TARGET option for the PACKAGE report. The values accepted ! are LSE, VMSLSE, PLSE, and PORTABLE (to match LSE's SET COMMAND LANGUAGE ! syntax), and LSEDIT (as a synonym for LSE). ! ! FORMAL PARAMETERS: ! ! See description of option processing procedures in ! SCA$REPORT_PORTABLE_SYNTAX.TPU. ! ! ROUTINE VALUE: ! ! TRUE if the option value is ok. FALSE if not. !-- LOCAL temp_value; ON_ERROR [OTHERWISE] : sca$report_temp_result := FALSE; sca$report_cmd_error_cleanup('SCA$REPORT_PROCESS_OPTION_PACKAGE_TARGET'); RETURN; ENDON_ERROR; IF (option_value = 'VMSLSE') OR (option_value = 'LSE') OR (option_value = 'LSEDIT') THEN sca$report_target_index := sca$report_k_target_lse_vms; sca$report_file_type_default := 'LSE'; ELSE IF (option_value = 'PLSE') OR (option_value = 'PORTABLE') THEN sca$report_target_index := sca$report_k_target_lse_portable; sca$report_file_type_default := 'PLSE'; ELSE sca$report_status_message ('Target ' + option_value + ' is not valid for this report'); sca$report_temp_result := FALSE; ENDIF; ENDIF; ENDPROCEDURE ENDMODULE