MODULE SCA$REPORT_INTERNALS IDENT "T4.0-9" !************************************************************************* ! * ! © 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 - Source Code Analyzer ! REPORT- Report Subfacility ! ! Abstract: ! This module implements the Software Internals report. ! !-- PROCEDURE sca$report_internals !++ ! FUNCTIONAL DESCRIPTION: ! ! This is the Digital-specific routine for the software internals 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_INTERNALS'); ENDON_ERROR; ! Do report initialization (create buffers, open the output file, etc.). ! sca$report_portable_initialization; ! Build the report definition. ! sca$report_build_definition_internals; ! Generate the report. ! ! Make chapters for the compilation units within the report domain as ! follows: ! ! Each module gets its own chapter, with the module name used as the ! chapter name. ! ! All the non-module compilation units (routines, tasks) are included in ! a single chapter, whose name is the source file name. ! sca$report_process_queries; ! Do common cleanup ! sca$report_post_process; sca$report_common_cleanup; RETURN ENDPROCEDURE PROCEDURE sca_report_define_options_internals !++ ! FUNCTIONAL DESCRIPTION: ! ! Define the valid options for the INTERNALS report. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA_REPORT_DEFINE_OPTIONS_INTERNALS'); ENDON_ERROR; ! Define valid options for the INTERNALS report. ! sca$report_add_valid_option ('domain_query', '', 'sca$report_process_option_domain_query'); sca$report_add_valid_option ('fill', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('output', '', 'sca$report_process_option_output'); sca$report_add_valid_option ('target', 'SDML', 'sca$report_process_option_formatted_target'); sca$report_add_valid_option ('decl_class_modules', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('decl_class_routines', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('description_indent_width', 32, ''); sca$report_add_valid_option ('internals_maximum_fragment_size', 12, ''); sca$report_add_valid_option ('list_style', sca$report_k_list_numbered, ''); sca$report_add_valid_option ('literal_angle_brackets', True, 'sca$report_process_option_boolean'); sca$report_add_valid_option ('overview_level', -1, ''); 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_internals !++ ! FUNCTIONAL DESCRIPTION: ! ! Build the report definition array for the INTERNALS report. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_BUILD_DEFINITION_INTERNALS'); ENDON_ERROR; ! Initialize subdefinition array. ! sca$report_subdefinition_array := CREATE_ARRAY(1); sca$report_subdefinition_index := 0; !========================================================================= ! Subdefinition for routine subqueries - it contains 5 entries. ! sca$report_create_subdefinition ('routine subqueries', 5); !------------------------------------------------------------------------- ! level +0 - return value tag 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 ('return value entry'); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_return_value); 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 query ! attribute - type NAME, location parameter_name ! attribute - type NAME_SCA, location parameter_name_SCA ! attribute - type VARIABLE_TYPE, location variable_type ! attribute - type SOURCE_LOCATION, location source_location ! entity_query_name - SCA$REPORT_CURRENT_PARAMETER ! sca$report_definition_add_entry (0, 3, 4, 0); sca$report_definition_add_label ('parameter entry'); sca$report_definition_add_option (sca$report_k_option_order_lexical); ! These first 2 queries get parameter text from the routine header (for ! all parameters). They are used to get a query result that can be used ! for finding the subtag for each parameter, as a sublevel of the ! parameters query. sca$report_definition_add_query (sca$report_k_query_parameter_tag); sca$report_definition_add_query (sca$report_k_query_parameter_all_subtags); 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_name_SCA, sca$report_location_parameter_name_SCA); 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_entity_name ('SCA$REPORT_CURRENT_PARAMETER'); !------------------------------------------------------------------------- ! level +1 - $UNTAGGED text for parameter ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (1, 1, 2, 0); sca$report_definition_add_label ('parameter untagged entry'); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_parameter_untagged_text); 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 +1 - tagged text for parameter from FORMAL PARAMETERS section of ! header comment block. ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (1, 1, 2, 1); sca$report_definition_add_label ('parameter subtag entry'); sca$report_definition_add_option (sca$report_k_option_all_occurrences); ! The query string is formed dynamically by the before_query action routine, ! and contains the name of the current parameter. An action routine is ! used, rather than ...add_query_dynamic, because no query is formed if the ! parameter name is null. ! sca$report_definition_add_query (0); 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); ! Action routine for before parameter subtag query - form query string. ! sca$report_definition_add_action_routine ( 'sca$report_setup_parameter_subtag_query', sca$report_k_invoke_before_query); !------------------------------------------------------------------------- ! level +0 - routine $REMARK tag 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 ('routine 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); !------------------------------------------------------------------------- ! End of subdefinition 'routine subqueries' ! sca$report_end_subdefinition; !========================================================================= !========================================================================= ! Now build the main definition for this report. It will have 29 entries ! directly defined, plus 10 entries defined by INCLUDEs, for a total of ! 39 entries. ! sca$report_create_definition (39); !------------------------------------------------------------------------- ! 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_software_specification', sca$report_k_invoke_after_query); ! Action routine for before each file is processed - set up query ! expresssions for finding modules and routines, fill in global variables ! for the file. ! sca$report_definition_add_action_routine ( 'sca$report_do_file_setup_internals', 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 ! attribute - type DECL_CLASS, location module_decl_class ! entity_query_name - SCA$REPORT_CURRENT_MODULE ! sca$report_definition_add_entry (2, 1, 2, 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 query, and contain the ! declaration class of the current compilation unit and the name of its ! source file. ! 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_all_occurrences); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_module_name); sca$report_definition_add_info (sca$report_k_info_type_decl_class, sca$report_location_module_decl_class); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_MODULE'); ! Action routine for before each module is processed - generate chapter ! beginning tags. ! sca$report_definition_add_action_routine ( 'sca$report_start_internals_module', sca$report_k_invoke_before_each_entity); !------------------------------------------------------------------------- ! level 3 - module-level tags query ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 3, 1); sca$report_definition_add_label ('module tags entry'); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_option (sca$report_k_option_order_lexical); sca$report_definition_add_query_dynamic (sca$report_k_query_module_tags_1); sca$report_definition_add_query (sca$report_k_query_module_tags_2); 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); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); ! Action routine for after the module description query is complete - ! add module description to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_module_tags', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - included files ! attribute - type NAME, location file_name ! sca$report_definition_add_entry (3, 1, 1, 1); sca$report_definition_add_label ('included files entry'); sca$report_definition_add_query (sca$report_k_query_included_files); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_file_name); ! Action routine for after all entities are processed - add list of ! included files to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_included_files', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported routines ! attribute - type NAME, location routine_name ! sca$report_definition_add_entry (3, 2, 1, 1); sca$report_definition_add_label ('imported routines entry'); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_imported_routines_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); ! Action routine for after all entities are processed - add list of ! imported routines to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_routines', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported types ! attribute - type NAME, location object_name ! sca$report_definition_add_entry (3, 2, 1, 1); sca$report_definition_add_label ('imported types entry'); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_imported_types_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); ! Action routine for after all entities are processed - add list of ! imported types to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_types', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported variables ! attribute - type NAME, location object_name ! attribute - type VARIABLE_TYPE, location object_type ! sca$report_definition_add_entry (3, 2, 2, 1); sca$report_definition_add_label ('imported variables entry'); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_imported_variables_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_object_type); ! Action routine for after all entities are processed - add list of ! imported variables to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_variables', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - exported types ! attribute - type NAME, location object_name ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 2, 1); sca$report_definition_add_label ('exported types entry'); sca$report_definition_add_query (sca$report_k_query_exported_types); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_OBJECT'); ! Action routine for after all entities are processed - add list of ! exported types to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_exported_types', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 4 - object description ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (4, 1, 2, 1); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_object_description); 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); ! Action routine for after query is processed - do comment filtering. ! sca$report_definition_add_action_routine ( 'sca$report_do_comment_filter', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - exported variables ! attribute - type NAME, location object_name ! attribute - type VARIABLE_TYPE, location object_type ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 3, 1); sca$report_definition_add_label ('exported variables entry'); sca$report_definition_add_query (sca$report_k_query_exported_variables); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_object_type); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_OBJECT'); ! Action routine for after all entities are processed - add list of ! exported variables to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_exported_variables', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 4 - object description ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (4, 1, 2, 1); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_object_description); 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); ! Action routine for after query is processed - do comment filtering. ! sca$report_definition_add_action_routine ( 'sca$report_do_comment_filter', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - module-wide variables ! attribute - type NAME, location object_name ! attribute - type VARIABLE_TYPE, location object_type ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 3, 1); sca$report_definition_add_label ('module variables entry'); sca$report_definition_add_query (sca$report_k_query_module_variables); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_object_type); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_OBJECT'); ! Action routine for after all entities are processed - add list of ! module variables to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_module_variables', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 4 - object description ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (4, 1, 2, 1); sca$report_definition_add_query (sca$report_k_query_object_description); sca$report_definition_add_option (sca$report_k_option_all_occurrences); 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); ! Action routine for after query is processed - do comment filtering. ! sca$report_definition_add_action_routine ( 'sca$report_do_comment_filter', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - COMMON areas ! attribute - type NAME, location object_name ! sca$report_definition_add_entry (3, 1, 1, 1); sca$report_definition_add_label ('common entry'); sca$report_definition_add_query (sca$report_k_query_common); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); ! Action routine for after all entities are processed - add list of ! common areas to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_common', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- !routines entry: ! level 3 ! routines_query (depends on language) ! attribute - type NAME, location routine_name ! attribute - type RETURN_VALUE_TYPE, location routine_type ! attribute - type DECL_TYPE, location routine_decl_type ! attribute - type DECL_CLASS, location routine_decl_class ! attribute - type ROUTINE_RANGE, location routine_range ! entity_query_name - SCA$REPORT_CURRENT_ROUTINE ! sca$report_definition_add_entry (3, 1, 5, 2); sca$report_definition_add_label ('routines entry'); ! The variable sca$report_current_decl_class is filled in by an action ! routine for the files query, and contains the declaration class of the ! current compilation unit. ! 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_all_occurrences); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); sca$report_definition_add_info (sca$report_k_info_type_return_value_type, sca$report_location_routine_type); sca$report_definition_add_info (sca$report_k_info_type_decl_type, sca$report_location_routine_decl_type); sca$report_definition_add_info (sca$report_k_info_type_decl_class, sca$report_location_routine_decl_class); sca$report_definition_add_info (sca$report_k_info_type_routine_range, sca$report_location_routine_range); 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); ! Action routine for after each routine's subqueries are processed - ! generate the routine description for the chapter. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_routine', sca$report_k_invoke_after_each_entity); !------------------------------------------------------------------------- ! level 4 - tagged text for routine, ! except for excluded tags and module tags ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (4, 2, 3, 1); sca$report_definition_add_label ('routine tags entry'); sca$report_definition_add_option (sca$report_k_option_order_lexical); sca$report_definition_add_query (sca$report_k_query_routine_tags_1); sca$report_definition_add_query (sca$report_k_query_routine_tags_2); 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); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); !------------------------------------------------------------------------- ! INCLUDE subdefinition for routine subqueries ! level 4 ! sca$report_definition_include_subdefinition (4, 'routine subqueries'); !------------------------------------------------------------------------- ! nonmodules entry: ! level 2 ! nonmodules_query (depends on language) ! sca$report_definition_add_entry (2, 1, 0, 1); 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 query, and contain the ! declaration class of the current compilation unit and the name of its ! source file. ! 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', '"' ); ! Action routine for after the nonmodules query is processed - generate ! chapter header for all the non-modules. ! sca$report_definition_add_action_routine ( 'sca$report_start_internals_nonmodule', sca$report_k_invoke_after_query); !------------------------------------------------------------------------- ! level 3 - nonmodule module-level tags query ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 2, 3, 1); sca$report_definition_add_label ('nonmodule module tags entry'); sca$report_definition_add_option (sca$report_k_option_once_only); sca$report_definition_add_option (sca$report_k_option_order_lexical); sca$report_definition_add_query (sca$report_k_query_nonmodule_module_tags_1); sca$report_definition_add_query (sca$report_k_query_nonmodule_tags_2); 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); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); ! Action routine for after the module description query is complete - ! add module description to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_module_tags', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - included files ! attribute - type NAME, location file_name ! sca$report_definition_add_entry (3, 1, 1, 1); sca$report_definition_add_label ('nonmodule included files entry'); sca$report_definition_add_option (sca$report_k_option_once_only); sca$report_definition_add_query (sca$report_k_query_included_files); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_file_name); ! Action routine for after all entities are processed - add list of ! included files to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_included_files', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported routines ! attribute - type NAME, location routine_name ! sca$report_definition_add_entry (3, 2, 1, 1); sca$report_definition_add_label ('nonmodule imported routines entry'); sca$report_definition_add_option (sca$report_k_option_once_only); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_nonmodule_imported_routines_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); ! Action routine for after all entities are processed - add list of ! imported routines to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_routines', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported types ! attribute - type NAME, location object_name ! sca$report_definition_add_entry (3, 2, 1, 1); sca$report_definition_add_label ('nonmodule imported types entry'); sca$report_definition_add_option (sca$report_k_option_once_only); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_imported_types_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); ! Action routine for after all entities are processed - add list of ! imported types to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_types', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - imported variables ! attribute - type NAME, location object_name ! attribute - type VARIABLE_TYPE, location object_type ! sca$report_definition_add_entry (3, 2, 2, 1); sca$report_definition_add_label ('nonmodule imported variables entry'); sca$report_definition_add_option (sca$report_k_option_once_only); ! The variables sca$report_current_imported_filter and ! sca$report_current_decl_class are filled in by an action routine for the ! files query, depending on the source file language. ! sca$report_current_imported_filter determines whether associated ! declarations are filtered out of the first query for this entry. ! sca$report_current_decl_class contains the declaration class of the ! current compilation unit. ! sca$report_definition_add_query_dynamic ( sca$report_k_query_imported_variables_1, 'sca$report_current_imported_filter', sca$report_k_query_imported_2); sca$report_definition_add_query_dynamic ( sca$report_k_query_ref_not_decl_1, 'sca$report_current_decl_class', sca$report_k_query_ref_not_decl_2); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_object_type); ! Action routine for after all entities are processed - add list of ! imported variables to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_imported_variables', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - exported types ! attribute - type NAME, location object_name ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 2, 1); sca$report_definition_add_label ('nonmodule exported types entry'); sca$report_definition_add_option (sca$report_k_option_once_only); sca$report_definition_add_query (sca$report_k_query_exported_types); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_OBJECT'); ! Action routine for after all entities are processed - add list of ! exported types to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_exported_types', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 4 - object description ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (4, 1, 2, 1); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_object_description); 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); ! Action routine for after query is processed - do comment filtering. ! sca$report_definition_add_action_routine ( 'sca$report_do_comment_filter', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - exported variables ! attribute - type NAME, location object_name ! attribute - type VARIABLE_TYPE, location object_type ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (3, 1, 3, 1); sca$report_definition_add_label ('nonmodule exported variables entry'); sca$report_definition_add_option (sca$report_k_option_once_only); sca$report_definition_add_query (sca$report_k_query_exported_variables); sca$report_definition_add_entity_name ('SCA$REPORT_CURRENT_OBJECT'); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); sca$report_definition_add_info (sca$report_k_info_type_variable_type, sca$report_location_object_type); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); ! Action routine for after all entities are processed - add list of ! exported variables to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_exported_variables', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 4 - object description ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! sca$report_definition_add_entry (4, 1, 2, 1); sca$report_definition_add_option (sca$report_k_option_all_occurrences); sca$report_definition_add_query (sca$report_k_query_object_description); 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); ! Action routine for after query is processed - do comment filtering. ! sca$report_definition_add_action_routine ( 'sca$report_do_comment_filter', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! level 3 - COMMON areas ! attribute - type NAME, location object_name ! sca$report_definition_add_entry (3, 1, 1, 1); sca$report_definition_add_label ('nonmodule common entry'); sca$report_definition_add_option (sca$report_k_option_once_only); sca$report_definition_add_query (sca$report_k_query_common); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_object_name); ! Action routine for after all entities are processed - add list of ! common areas to output. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_common', sca$report_k_invoke_after_all_entities); !------------------------------------------------------------------------- ! nonmodules routines entry: ! level 3 ! nonmodules routines query ! attribute - type NAME, location routine_name ! attribute - type RETURN_VALUE_TYPE, location routine_type ! attribute - type DECL_TYPE, location routine_decl_type ! attribute - type DECL_CLASS, location routine_decl_class ! attribute - type ROUTINE_RANGE, location routine_range ! entity_query_name - SCA$REPORT_CURRENT_ROUTINE ! sca$report_definition_add_entry (3, 1, 5, 2); 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_all_occurrences); sca$report_definition_add_info (sca$report_k_info_type_name, sca$report_location_routine_name); sca$report_definition_add_info (sca$report_k_info_type_return_value_type, sca$report_location_routine_type); sca$report_definition_add_info (sca$report_k_info_type_decl_type, sca$report_location_routine_decl_type); sca$report_definition_add_info (sca$report_k_info_type_decl_class, sca$report_location_routine_decl_class); sca$report_definition_add_info (sca$report_k_info_type_routine_range, sca$report_location_routine_range); 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 each routine's subqueries are processed - ! generate routine section. ! sca$report_definition_add_action_routine ( 'sca$report_do_internals_routine', sca$report_k_invoke_after_each_entity); !------------------------------------------------------------------------- ! level 4 - tagged text for routine, ! except for excluded tags and module tags ! attribute - type TAG_NAME, location tag_name ! attribute - type TAG_TEXT, location tag_text ! attribute - type SOURCE_LOCATION, location source_location ! sca$report_definition_add_entry (4, 3, 3, 1); sca$report_definition_add_label ('nonmodule routine tags entry'); sca$report_definition_add_option (sca$report_k_option_order_lexical); sca$report_definition_add_query (sca$report_k_query_routine_tags_nomodule_1); sca$report_definition_add_query (sca$report_k_query_routine_tags_nomodule_2); sca$report_definition_add_query (sca$report_k_query_routine_tags_nomodule_3); 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); sca$report_definition_add_info (sca$report_k_info_type_source_location, sca$report_location_source_location); !------------------------------------------------------------------------- ! INCLUDE subdefinition for routine subqueries ! level 4 ! sca$report_definition_include_subdefinition (4, 'routine subqueries'); !========================================================================= ENDPROCEDURE PROCEDURE sca$report_do_file_setup_internals !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine fills in the queries that depend on the current source ! file name or language. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL file_name, language_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_FILE_SETUP_INTERNALS'); ENDON_ERROR; ! Invoke the common action routine for file setup. ! sca$report_do_file_setup_all; sca$report_get_language (sca$report_current_entity, language_name); IF language_name = 'ADA' THEN sca$report_current_imported_filter := ''; ELSE sca$report_current_imported_filter := ' AND (NOT OCCUR=ASSOC) '; ENDIF; ENDPROCEDURE PROCEDURE sca$report_start_internals_module !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the tags needed to begin a chapter for a ! software internals report. ! ! FORMAL PARAMETERS: ! ! None ! ! IMPLICIT OUTPUTS: ! ! sca$report_internals_chapter_name !-- LOCAL decl_class; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_START_INTERNALS_MODULE'); ENDON_ERROR; ! Fetch module name and decl class, and write chapter heading. The current ! occurrence array is for the module being processed. ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_module_name, sca$report_internals_chapter_name); sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_module_decl_class, decl_class); ! Invent a name if there is none for the module (this can happen for an Ada ! generic package). ! IF sca$report_internals_chapter_name = '' THEN sca$report_internals_chapter_name := 'Unnamed module'; ENDIF; ! Write status message. ! sca$report_status_message('--- Processing module ' + sca$report_internals_chapter_name + ' ---'); ! Write chapter heading. ! sca$report_chapter (sca$report_internals_chapter_name, decl_class); RETURN; ENDPROCEDURE PROCEDURE sca$report_start_internals_nonmodule !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the tags needed to begin a chapter for a ! software internals report. ! ! FORMAL PARAMETERS: ! ! None ! ! IMPLICIT OUTPUTS: ! ! sca$report_internals_chapter_name !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_START_INTERNALS_NONMODULE'); ENDON_ERROR; ! Fetch the file name. Its occurrence array is the current one. ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_file_name, sca$report_internals_chapter_name); ! Write status message. ! sca$report_status_message('--- Processing nonmodules for file ' + sca$report_internals_chapter_name + ' ---'); ! Write chapter heading. ! sca$report_chapter (sca$report_internals_chapter_name, 'file'); RETURN; ENDPROCEDURE PROCEDURE sca$report_do_internals_module_tags !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the module-level tagged text for the current ! chapter. ! ! FORMAL PARAMETERS: ! ! None !-- ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_MODULE_TAGS'); ENDON_ERROR; ! Write text for the module tags of the current chapter. ! sca$report_write_tags (sca$report_current_entry_result, sca$report_k_write_by_paragraphs); ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_common !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of COMMON areas for the ! current module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, common_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_COMMON'); ENDON_ERROR; sca$report_start_section (sca$report_section_common); sca$report_start_table (''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, common_name); sca$report_add_table_item (common_name); i := i + 1; ENDLOOP; sca$report_end_table; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_exported_types !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of exported types for the current ! module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, type_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_EXPORTED_TYPES'); ENDON_ERROR; sca$report_start_section (sca$report_section_exported_types); ! Write an empty paragraph to keep DOCUMENT happy. ! sca$report_paragraph (''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; ! Fetch and write type name. ! current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, type_name); sca$report_start_subsection (type_name); ! Write type description. ! tag_entry_result := sca$report_fetch_entry (current_occurrence_result, 1); sca$report_write_variable_tags (tag_entry_result, sca$report_k_write_by_paragraphs); sca$report_end_subsection; i := i + 1; ENDLOOP; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_exported_variables !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of exported variables for the ! current module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, variable_name, variable_type; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_EXPORTED_VARIABLES'); ENDON_ERROR; sca$report_start_section (sca$report_section_exported_variables); ! Write an empty paragraph to keep DOCUMENT happy. ! sca$report_paragraph (''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, variable_name); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_type, variable_type); sca$report_start_subsection (variable_name); IF GET_INFO(variable_type,'TYPE') = STRING THEN IF variable_type = '' THEN variable_type := sca$report_unknown; ENDIF; sca$report_paragraph (sca$report_item_type + ': ' + variable_type); ENDIF; ! Write type description. ! tag_entry_result := sca$report_fetch_entry (current_occurrence_result, 1); sca$report_write_variable_tags (tag_entry_result, sca$report_k_write_by_paragraphs); sca$report_end_subsection; i := i + 1; ENDLOOP; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_imported_routines !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of imported routines for the current ! module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, routine_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_IMPORTED_ROUTINES'); ENDON_ERROR; sca$report_start_section (sca$report_section_imported_routines); sca$report_start_table(''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_routine_name, routine_name); sca$report_add_table_item (routine_name); i := i + 1; ENDLOOP; sca$report_end_table; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_imported_types !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of imported types for the current ! module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, type_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_IMPORTED_TYPES'); ENDON_ERROR; sca$report_start_section (sca$report_section_imported_types); sca$report_start_table(''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, type_name); sca$report_add_table_item (type_name); i := i + 1; ENDLOOP; sca$report_end_table; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_imported_variables !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of imported variables for the ! current module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, variable_name, variable_type; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_IMPORTED_VARIABLES'); ENDON_ERROR; sca$report_start_section (sca$report_section_imported_variables); sca$report_start_table(''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, variable_name); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_type, variable_type); sca$report_add_table_item (variable_name, variable_type); i := i + 1; ENDLOOP; sca$report_end_table; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_included_files !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of included files for the current ! module. ! ! FORMAL PARAMETERS: ! ! None ! !-- LOCAL current_occurrence_result, file_name, i; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_INCLUDED_FILES'); ENDON_ERROR; sca$report_start_section (sca$report_section_included_files); sca$report_start_table(''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_file_name, file_name); sca$report_add_table_item (file_name); i := i + 1; ENDLOOP; sca$report_end_table; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_module_variables !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes out the list of module-wide variables for the ! current module. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL current_occurrence_result, i, variable_name, variable_type; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_MODULE_VARIABLES'); ENDON_ERROR; sca$report_start_section (sca$report_section_variables); ! Write an empty paragraph to keep DOCUMENT happy. ! sca$report_paragraph (''); i := 1; LOOP EXITIF i > sca$report_current_entry_result{sca$report_k_entry_number_occurrences}; current_occurrence_result := sca$report_fetch_occurrence (sca$report_current_entry_result, i); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_name, variable_name); sca$report_fetch_result (current_occurrence_result, sca$report_location_object_type, variable_type); sca$report_start_subsection (variable_name); IF GET_INFO(variable_type,'TYPE') = STRING THEN IF variable_type = '' THEN variable_type := sca$report_unknown; ENDIF; sca$report_paragraph (sca$report_item_type + ': ' + variable_type); ENDIF; ! Write type description. ! tag_entry_result := sca$report_fetch_entry (current_occurrence_result, 1); sca$report_write_variable_tags (tag_entry_result, sca$report_k_write_by_paragraphs); sca$report_end_subsection; i := i + 1; ENDLOOP; sca$report_end_section; ! Release the result array space. ! sca$report_clear_entry_result (sca$report_current_entry_result); ENDPROCEDURE PROCEDURE sca$report_do_internals_routine !++ ! FUNCTIONAL DESCRIPTION: ! ! This action routine writes the specification of the current routine. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL comment_entry_result, decl_type, i, n_parameters, parameter_entry_result, parameter_occurrence_result, parameter_name, parameter_names, parameter_type, remark_entry_result, remark_occurrence_result, remark_string, return_value_entry_result, return_value_occurrence_result, return_value, routine_decl_class, routine_name, routine_type, tags_entry; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_DO_INTERNALS_ROUTINE'); ENDON_ERROR; ! Fetch routine name and decl class. ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_routine_name, routine_name); sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_routine_decl_class, routine_decl_class); ! Start new routine section, using routine name as heading. ! sca$report_start_routine_section (sca$report_internals_chapter_name, routine_name, routine_decl_class); ! Write routine remark. ! remark_entry_result := sca$report_fetch_entry (sca$report_current_occurrence_result, 'routine remark entry'); IF remark_entry_result{sca$report_k_entry_number_occurrences} > 0 THEN remark_occurrence_result := sca$report_fetch_occurrence (remark_entry_result, 1); sca$report_fetch_result (remark_occurrence_result, sca$report_location_tag_text, remark_string); sca$report_write_routine_remark (remark_string); ENDIF; ! Get the return type information (from the routine occurrence result). ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_routine_type, routine_type); ! Fetch the parameter entry result. ! parameter_entry_result := sca$report_fetch_entry (sca$report_current_occurrence_result, 'parameter entry'); ! Get the list of parameter names. ! n_parameters := parameter_entry_result{sca$report_k_entry_number_occurrences}; IF n_parameters = 0 THEN parameter_names := 0; ELSE parameter_names := CREATE_ARRAY (n_parameters+1, 0); i := 1; 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_names{i} ); ! For the sample format, display "..." in place of any nameless ! parameter (assume the nameless parameter represents an optional ! parameter list). ! IF parameter_names{i} = '' THEN parameter_names{i} := '...'; ENDIF; i := i + 1; ENDLOOP; parameter_names{0} := n_parameters; ENDIF; ! Now write the sample format and return value. The sample format looks ! like a single call on the routine, with all the parameters. ! sca$report_write_routine_format (routine_name, routine_type, parameter_names); ! Get the return value text. ! return_value_entry_result := sca$report_fetch_entry (sca$report_current_occurrence_result, 'return value entry'); IF return_value_entry_result{sca$report_k_entry_number_occurrences} > 0 THEN return_value_occurrence_result := sca$report_fetch_occurrence (return_value_entry_result, 1); sca$report_fetch_result (return_value_occurrence_result, sca$report_location_tag_text, return_value); ELSE return_value := ''; ENDIF; ! Write the return value section. ! sca$report_write_return_value (routine_type, return_value); ! Write the parameter description section. ! parameter_entry_result := sca$report_fetch_entry (sca$report_current_occurrence_result, 'parameter entry'); IF parameter_entry_result{sca$report_k_entry_number_occurrences} > 0 THEN sca$report_start_parameter_section; i := 1; LOOP EXITIF i > parameter_entry_result{sca$report_k_entry_number_occurrences}; parameter_occurrence_result := sca$report_fetch_occurrence (parameter_entry_result, i); ! Get the parameter name and write it. ! sca$report_fetch_result (parameter_occurrence_result, sca$report_location_parameter_name, parameter_name); sca$report_start_parameter (parameter_name); ! Write the parameter type (if any). ! sca$report_fetch_result (parameter_occurrence_result, sca$report_location_parameter_type, parameter_type); IF parameter_type <> '' THEN sca$report_paragraph (sca$report_item_type + ': ' + parameter_type); ENDIF; ! Write commment text for this parameter, untagged and then tagged. ! The comment text is in the 2 subentries of the parameter entry ! result. ! comment_entry_result := sca$report_fetch_entry (parameter_occurrence_result, 'parameter untagged entry'); sca$report_write_parameter_description (comment_entry_result); comment_entry_result := sca$report_fetch_entry (parameter_occurrence_result, 'parameter subtag entry'); sca$report_write_parameter_description (comment_entry_result); ! Get next parameter. ! i := i + 1; ENDLOOP; sca$report_end_parameter_section; ENDIF; ! Write contents of top-level tags within this routine declaration. ! tags_entry := sca$report_fetch_entry (sca$report_current_occurrence_result, 'routine tags entry'); IF tags_entry = 0 THEN tags_entry := sca$report_fetch_entry (sca$report_current_occurrence_result, 'nonmodule routine tags entry'); ENDIF; IF tags_entry <> 0 THEN sca$report_write_routine_tags (tags_entry, sca$report_k_write_by_paragraphs); ENDIF; ! Write routine body (only for primary declarations, and not if suppressed ! by customization option). ! sca$report_fetch_result (sca$report_current_occurrence_result, sca$report_location_routine_decl_type, decl_type); IF (decl_type = 'primary_decl') AND (sca$report_option_overview_level <> 0) THEN sca$report_internals_routine_body (sca$report_current_occurrence_result); ENDIF; sca$report_end_routine_section (routine_name); ! Delete the routine occurrence arrays. ! sca$report_delete_occurrence_result (sca$report_current_occurrence_result); ENDPROCEDURE PROCEDURE sca$report_internals_routine_body (routine_occurrence_result) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure writes the body of a routine. ! ! FORMAL PARAMETERS: ! ! routine_occurrence_result ! ! The occurrence result for the routine. IN parameter. !-- LOCAL body_range, ending_line, file_spec, fragment_size, language_name, routine_range, saved_position, source_buffer, start_routine_marker, starting_exe_line; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_INTERNALS_ROUTINE_BODY '); ENDON_ERROR; saved_position := MARK(FREE_CURSOR); sca$report_start_routine_subsection (sca$report_section_body); ! Fetch the routine range. ! sca$report_fetch_result (routine_occurrence_result, sca$report_location_routine_range, routine_range); file_spec := routine_range{1}; starting_exe_line := routine_range{2}; ending_line := routine_range{3}; source_buffer := sca$report_get_source_file (file_spec); IF source_buffer = '' THEN ! We can't find the source file. The error message has already been put ! out by sca$report_get_source_file - just return. ! RETURN; ENDIF; POSITION(source_buffer); ! Mark the start of the routine. ! lse_line (INT(starting_exe_line)); start_routine_marker := MARK (FREE_CURSOR); ! Mark the end of the routine. ! lse_line (INT(ending_line)); POSITION (LINE_END); end_routine_marker := MARK (FREE_CURSOR); ! Generate top-level view of the code body. ! body_range := CREATE_RANGE (start_routine_marker, end_routine_marker, NONE); sca$report_get_size (body_range, fragment_size ); ! Copy the body of the routine to a scratch buffer. ! language_name := GET_INFO (CURRENT_BUFFER, 'LANGUAGE'); POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); IF language_name <> 0 THEN lse_set_buffer_language (language_name); ENDIF; COPY_TEXT (body_range); DELETE (body_range); POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); ! Convert tabs to blanks. ! sca$report_convert_tabs_to_spaces ( CREATE_RANGE (BEGINNING_OF (sca$report_code_fragment_buffer), END_OF (sca$report_code_fragment_buffer)) ); POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); IF fragment_size > sca$report_option_internals_maximum_fragment_size THEN ! Form the top-level view of the routine body. If the result is a ! single overview line, expand it one level. ! lse_view_source (1); POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); lse$move_vertical(1); IF MARK(FREE_CURSOR) >= END_OF (sca$report_code_fragment_buffer) THEN POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); lse_expand (1); ELSE POSITION (BEGINNING_OF (sca$report_code_fragment_buffer)); ENDIF; ENDIF; ! Generate the Body section of the report for this routine. ! Note that if we didn't generate an overview for the code fragment, the ! current position is now the beginning of the code fragment buffer. ! body_range := CREATE_RANGE (MARK(FREE_CURSOR), END_OF(sca$report_code_fragment_buffer), NONE); sca$report_strip_blank_lines (body_range); sca$report_internals_body_fragment (body_range); ! Cleanup and return. ! ERASE (sca$report_code_fragment_buffer); sca$report_end_routine_subsection; POSITION (saved_position); RETURN ENDPROCEDURE PROCEDURE sca$report_internals_body_fragment (in_fragment_range) !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure reports a given body fragment. If the entire fragment is ! less than the maximum size (in lines), then we simply report the fragment. ! If not, we report the top-level view of it, then iterate to report its ! subfragments. ! ! FORMAL PARAMETERS: ! ! in_fragment_range ! ! A range containing the code fragment to be reported. IN parameter. ! ! IMPLICIT INPUTS: ! ! sca$report_option_internals_maximum_fragment_size ! sca$report_option_overview_level ! ! ALGORITHM: ! ! We do a top-down, depth-first walk of the overview tree of the fragment. ! If we can't expand a fragment fully, because it is too long, we collapse it ! to show just the top-level, then process its inner fragments. ! ! There are two ways to illustrate this. One way is to show an actual report. ! This is done separately, in the documentation for Reports Using Views, for ! the body of the LSE$$PARSE_ERASE routine. ! ! The second way is by a sample tree walk. Suppose we have the tree ! ! A ! B ! B1 ! B2 ! B3 ! C ! C1 ! D ! ! We process A, then B, then B1, B2, B3, then C, then C1, then D. ! !-- LOCAL current_fragment_number, ! fragment number of the fragment of the ! fragment we're currently processing fragment_range, fragment_size, id_text_size, overview_end_marks, overview_level, overview_mark, start_position, subfragment_number, ! fragment number of the last ! subfragment used temp_pos; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_INTERNALS_BODY_FRAGMENT'); ENDON_ERROR; fragment_range := in_fragment_range; ! Start at the first source line of the fragment. ! POSITION (BEGINNING_OF (fragment_range)); POSITION(LINE_BEGIN); start_position := MARK(NONE); overview_mark := 0; overview_level := 1; IF sca$report_option_overview_level > 0 THEN overview_end_marks := CREATE_ARRAY (sca$report_option_overview_level); overview_end_marks{1} := END_OF (fragment_range); ELSE overview_end_marks := 0; ENDIF; ! current_fragment_number refers to the fragment we're currently ! writing out. ! current_fragment_number := 1; ! subfragment_number refers to the last fragment that was used in a ! cross-reference. ! subfragment_number := 1; ! Write the current fragment. For each overview line in the current ! fragment, we write a cross-reference tag. ! LOOP ! Write current fragment number. ! sca$report_start_fragment (current_fragment_number, id_text_size); ! Add the cross reference number to the overview line (if any) that was ! previously displayed for this fragment. ! sca$report_write_cross_reference (current_fragment_number, overview_mark); ! Write the code fragment, and remember where the overview lines are so ! that we can add cross-reference numbers later when we know what they ! are. ! sca$report_write_code_fragment (fragment_range, id_text_size, subfragment_number, (overview_level = sca$report_option_overview_level) ); sca$report_end_fragment; ! Update the current fragment number. We are done if the current ! fragment number is equal to the last used subfragment number (this ! implies that we have processed all subfragments). ! EXITIF current_fragment_number = subfragment_number; current_fragment_number := current_fragment_number + 1; ! Find the next overview to be expanded. ! IF (overview_level < sca$report_option_overview_level) OR (sca$report_option_overview_level <= 1) THEN POSITION (start_position); overview_level := overview_level + 1; ELSE ! We don't want to display any lower-level detail - start looking ! for overview lines after the end of the current fragment. ! POSITION (overview_end_marks{overview_level}); MOVE_HORIZONTAL (1); ENDIF; LOOP temp_pos := MARK(NONE); lse_next_placeholder; EXITIF lse$is_overview; ! Check whether we actually found a placeholder - if not, there ! is an internal inconsistency. ! IF temp_pos = MARK(NONE) THEN sca$report_status_message('*** Expected placeholder not found ***'); RETURN; ENDIF; ENDLOOP; ! Create a range that encompasses this overview line and all the lines ! that it hides, excluding trailing blank lines. ! POSITION(LINE_BEGIN); overview_mark := MARK(NONE); lse$move_vertical(1); MOVE_HORIZONTAL (-1); fragment_range := CREATE_RANGE (overview_mark, MARK(NONE), NONE); sca$report_strip_blank_lines (fragment_range); ! Figure out what level this new overview line is, if we are limiting ! the levels being displayed. ! IF sca$report_option_overview_level > 0 THEN LOOP EXITIF overview_mark < overview_end_marks{overview_level-1}; overview_level := overview_level - 1; ENDLOOP; overview_end_marks{overview_level} := END_OF (fragment_range); ENDIF; ! Find out how many real source lines are hidden by this overview line. ! sca$report_get_size (fragment_range, fragment_size ); POSITION(overview_mark); IF fragment_size > sca$report_option_internals_maximum_fragment_size THEN ! EXPAND one level ! lse_expand (1); ELSE ! EXPAND the overview completely ! lse_expand (9999); ENDIF; ! Mark the first source line of the newly expanded source. ! start_position := MARK(NONE); ENDLOOP ENDPROCEDURE PROCEDURE sca$report_get_size (fragment_range, fragment_size) !++ ! FUNCTIONAL DESCRIPTION: ! ! This routine finds the number of source lines in a given range. ! ! FORMAL PARAMETERS: ! ! fragment_range ! ! The fragment range to be processed. IN parameter. ! ! fragment_size ! ! The number of source lines in the range. OUT parameter. !-- LOCAL line_count, saved_position; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_GET_SIZE'); ENDON_ERROR; saved_position := MARK(FREE_CURSOR); POSITION (BEGINNING_OF (fragment_range)); line_count := 0; ! Count source lines. ! LOOP IF NOT lse$is_overview THEN line_count := line_count + 1; ENDIF; MOVE_VERTICAL(1); EXITIF MARK(FREE_CURSOR) >= END_OF(fragment_range); ENDLOOP; fragment_size := line_count; POSITION(saved_position); RETURN ENDPROCEDURE ENDMODULE