MODULE sca$report_format_text IDENT "T4.0" !************************************************************************* ! * ! © 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 contains routines that deal with the formatting of text ! (.TXT) source files. ! ! All of the dependencies on text files are isolated into this module. !- PROCEDURE sca$report_post_process_text !++ ! FUNCTIONAL DESCRIPTION: ! ! This procedure performs post processing on the output file generated for ! TEXT output. ! ! FORMAL PARAMETERS: ! ! None !-- LOCAL cmd, local_pid, runoff_error, runoff_file_name, saved_position, success_state, temp_name; ON_ERROR [OTHERWISE] : sca$report_common_error_cleanup('SCA$REPORT_POST_PROCESS_TEXT'); ENDON_ERROR; ! Check for empty report ! IF sca$report_work_file_spec = '' THEN MESSAGE (''); MESSAGE ('Empty report - no output file written'); MESSAGE (''); RETURN; ENDIF; saved_position := MARK(NONE); success_state := GET_INFO (SYSTEM, 'success'); ! Fabricate a unique file name for the RUNOFF output, since we have no way ! of getting its complete file spec. ! ! Issue a DCL command to get the PID and then read the response in from ! the DCL buffer. ! saved_position := MARK(NONE); SEND ('$ WRITE SYS$OUTPUT F$GETJPI("","PID")', sca$report_subprocess_id); position(end_of (sca$report_subprocess_buffer)); move_vertical(-1); local_pid := CURRENT_LINE; position (saved_position); ! Get the node, device, and directory portion of the output file name, ! so that the runoff output file goes to that same directory. ! temp_name := FILE_PARSE (sca$report_output_file_name, '', '', NODE, DEVICE, DIRECTORY, NAME); ! Build the runoff output file name ! runoff_file_name := temp_name + '_' + local_pid + '.TMP'; ! Start RUNOFF working on the file ! SEND ('RUNOFF/NOBOLD/NOUNDERLINE/MESSAGES=(OUTPUT) -' , sca$report_subprocess_id); SEND (sca$report_work_file_name + ' - ', sca$report_subprocess_id); SEND (' /OUTPUT=' + runoff_file_name, sca$report_subprocess_id); ! Read the resulting file into the output buffer ! position (beginning_of (sca$report_output_buffer)); ERASE(sca$report_output_buffer); SET (success, off); READ_FILE (runoff_file_name); IF success_state = 1 THEN SET (success, on); ENDIF; ! Remove all the trailing CR/LF characters ! sca$report_remove_crlf; ! Check to see if any RUNOFF errors appear in the buffer ! position (BUFFER_BEGIN); LOOP runoff_error := SEARCH_QUIETLY ("%RUNOFF-", FORWARD, EXACT); EXITIF runoff_error = 0; ! Remove any line feed errors detected by RUNOFF ! position (runoff_error); ERASE_LINE; ERASE_LINE; ENDLOOP; ! Write the cleaned-up file to the final output file ! SET (success, off); sca$report_output_file_spec := WRITE_FILE (sca$report_output_buffer, sca$report_output_file_name); IF success_state = 1 THEN SET (success, on); ENDIF; ! Notify the user of the location and name of the final output file ! MESSAGE (''); MESSAGE ('Report written to file ' + sca$report_output_file_spec); MESSAGE (''); ! Delete the work and temp files used to generate the report ! SEND ('DELETE/NOCONFIRM/NOLOG -', sca$report_subprocess_id); SEND (sca$report_work_file_spec, sca$report_subprocess_id); SEND ('DELETE/NOCONFIRM/NOLOG -', sca$report_subprocess_id); SEND (runoff_file_name + ';', sca$report_subprocess_id); position (saved_position); RETURN; ENDPROCEDURE ENDMODULE