!+ ! NAME ! disk_report_front_ends ! ! DESCRIPTION ! This file is a collection of SCAN front ends/drivers to C ! utilities that print some of the various disk reports. ! ! HISTORY ! 6/88 Bauer Initial version for disk_report tool. ! !- MODULE disk$reports_front_end IDENT 'v1.0'; ! ! Constant Declarations ! CONSTANT MAX_BLOCKS_PERCENT = 1; CONSTANT CUM_BLOCKS_PERCENT = 2; TYPE ROOT_DATA: ! Used to MAP master roots RECORD disk : INTEGER, ! Disk # index : INTEGER, ! Dir # - (both indicies into dir_list) from_table : BOOLEAN, ! From master mapping table or not END RECORD; ! ! Global Data Declarations ! DECLARE rootmap : EXTERNAL TREE (STRING, STRING) OF ROOT_DATA; ! Master Root map DECLARE table_only : EXTERNAL BOOLEAN; ! Print masters from table only !+ ! NAME ! is_this_master_from_table -- checks to see if this master gets printed ! ! DESCRIPTION ! ! RETURN VALUE ! ! HISTORY ! 6/88 Bauer Initial version for disk_report tool. ! !- PROCEDURE is_this_master_from_table ( master_P : TREEPTR (STRING) TO TREE (STRING) OF ROOT_DATA, master : STRING ) OF BOOLEAN; DECLARE root_dir_P : TREEPTR (STRING) TO ROOT_DATA; DECLARE root_dir : STRING; root_dir_P = FIRST (master_P); ! Get the root list corresponding to this master WHILE root_dir_P <> NIL; ! Process all roots for this master root_dir = SUBSCRIPT (root_dir_P); IF rootmap(master, root_dir).from_table ! In table! THEN return (TRUE); END IF; root_dir_P = NEXT (root_dir_P); ! Get next root directory END WHILE; return(FALSE); ! Nope - not in table END PROCEDURE; !+ ! NAME ! write_merged_complete_report -- drives the printing of the merged complete report ! ! DESCRIPTION ! This routine is the SCAN driver to the C routines that print the merged ! directories reoprt. ! ! RETURN VALUE ! ! HISTORY ! 6/88 Bauer Initial version for disk_report tool. ! !- PROCEDURE write_merged_complete_report; DECLARE master_root_P : TREEPTR (STRING) TO TREE (STRING) OF ROOT_DATA; DECLARE root_dir_P : TREEPTR (STRING) TO ROOT_DATA; DECLARE master_root : STRING; DECLARE root_dir : STRING; DECLARE dont_skip_master : BOOLEAN; DECLARE total_disk_space_available : EXTERNAL INTEGER; EXTERNAL PROCEDURE print_merged_report_header; EXTERNAL PROCEDURE print_merged_report_line ( STRING, STRING, VALUE INTEGER, VALUE INTEGER, VALUE INTEGER ); CALL print_merged_report_header; ! Print the report header first master_root_P = FIRST (rootmap); ! Process the master root list until empty WHILE master_root_P <> NIL; master_root = SUBSCRIPT (master_root_P); IF table_only ! See if we are printing this master out or not THEN dont_skip_master = is_this_master_from_table (master_root_P, master_root); ELSE dont_skip_master = TRUE; END IF; IF master_root <> '000000' AND dont_skip_master ! Process this master's roots? THEN root_dir_P = FIRST (master_root_P); ! Get the root list corresponding to this master WHILE root_dir_P <> NIL; ! Process all roots for this master root_dir = SUBSCRIPT (root_dir_P); IF NOT table_only OR rootmap(master_root,root_dir).from_table THEN CALL print_merged_report_line (master_root, root_dir, rootmap(master_root, root_dir).disk, rootmap(master_root, root_dir).index, total_disk_space_available ); END IF; root_dir_P = NEXT (root_dir_P); ! Get next root directory END WHILE; END IF; master_root_P = NEXT (master_root_P); ! Get next master root END WHILE; CALL print_merged_report_line ( '', ! Kludge to print totals for last entry in report '', 0, 0, total_disk_space_available ); END PROCEDURE; !+ ! NAME ! write_master_summary_report -- drives the calculating/printing of this report ! ! DESCRIPTION ! ! RETURN VALUE ! ! HISTORY ! 6/88 Bauer Initial version for disk_report tool. ! !- PROCEDURE write_master_summary_report; DECLARE master_root_P : TREEPTR (STRING) TO TREE (STRING) OF ROOT_DATA; DECLARE root_dir_P : TREEPTR (STRING) TO ROOT_DATA; DECLARE master_root : STRING; DECLARE root_dir : STRING; DECLARE dont_skip_master : BOOLEAN; DECLARE total_disk_space_available : EXTERNAL INTEGER; DECLARE print_line : INTEGER; EXTERNAL PROCEDURE print_master_sum_report_hdr; EXTERNAL PROCEDURE print_master_sum_line (STRING, VALUE INTEGER, VALUE INTEGER, VALUE INTEGER, VALUE INTEGER ); CALL print_master_sum_report_hdr; ! Print the report header first master_root_P = FIRST (rootmap); ! Process the master root list until empty WHILE master_root_P <> NIL; master_root = SUBSCRIPT (master_root_P); IF table_only ! See if we are printing this master out or not THEN dont_skip_master = is_this_master_from_table (master_root_P, master_root); ELSE dont_skip_master = TRUE; END IF; IF master_root <> '000000' AND dont_skip_master ! Process this master's roots? THEN print_line = 0; root_dir_P = FIRST (master_root_P); ! Get the root list corresponding to this master WHILE root_dir_P <> NIL; ! Process all roots for this master root_dir = SUBSCRIPT (root_dir_P); IF NOT table_only OR rootmap(master_root,root_dir).from_table THEN CALL print_master_sum_line ( master_root, rootmap(master_root, root_dir).disk, rootmap(master_root, root_dir).index, total_disk_space_available, print_line ); END IF; root_dir_P = NEXT (root_dir_P); ! Get next root directory END WHILE; print_line = 1; CALL print_master_sum_line ( master_root, 0, 0, total_disk_space_available, print_line ); END IF; master_root_P = NEXT (master_root_P); ! Get next master root END WHILE; END PROCEDURE; END MODULE;