Line Name ----- ---- 402 fold_string 547 isfirst_in_file 572 islast_in_file 784 needs_tree 649 next_defined 495 next_defining_file 597 next_tree 701 next_undefined 675 prev_defined 521 prev_defining_file 623 prev_tree 727 prev_undefined 1448 report_by_file 995 report_calls 849 report_defined 284 report_end_routine 283 report_entry_routine 1560 report_files 476 report_filext 282 report_hdr_routine 1627 report_source 1202 report_tree 922 report_undefined 1084 report_xrefs 88 rpt_byfile_rtf_end 87 rpt_byfile_rtf_entry 86 rpt_byfile_rtf_hdr 85 rpt_byfile_text_end 84 rpt_byfile_text_entry 83 rpt_byfile_text_hdr 94 rpt_byfile_vmshelp_end 93 rpt_byfile_vmshelp_entry 92 rpt_byfile_vmshelp_hdr 91 rpt_byfile_winhelp_end 90 rpt_byfile_winhelp_entry 89 rpt_byfile_winhelp_hdr 55 rpt_calls_rtf_end 54 rpt_calls_rtf_entry 53 rpt_calls_rtf_hdr 61 rpt_calls_vmshelp_end 60 rpt_calls_vmshelp_entry 59 rpt_calls_vmshelp_hdr 58 rpt_calls_winhelp_end 57 rpt_calls_winhelp_entry 56 rpt_calls_winhelp_hdr 35 rpt_defined_rtf_end 34 rpt_defined_rtf_entry 33 rpt_defined_rtf_hdr 41 rpt_defined_vmshelp_end 40 rpt_defined_vmshelp_entry 39 rpt_defined_vmshelp_hdr 38 rpt_defined_winhelp_end 37 rpt_defined_winhelp_entry 36 rpt_defined_winhelp_hdr 101 rpt_file_rtf_end 100 rpt_file_rtf_entry 99 rpt_file_rtf_hdr 98 rpt_file_text_end 97 rpt_file_text_entry 96 rpt_file_text_hdr 107 rpt_file_vmshelp_end 106 rpt_file_vmshelp_entry 105 rpt_file_vmshelp_hdr 104 rpt_file_winhelp_end 103 rpt_file_winhelp_entry 102 rpt_file_winhelp_hdr 114 rpt_source_rtf_end 113 rpt_source_rtf_entry 112 rpt_source_rtf_hdr 111 rpt_source_text_end 110 rpt_source_text_entry 109 rpt_source_text_hdr 120 rpt_source_vmshelp_end 119 rpt_source_vmshelp_entry 118 rpt_source_vmshelp_hdr 117 rpt_source_winhelp_end 116 rpt_source_winhelp_entry 115 rpt_source_winhelp_hdr 75 rpt_tree_rtf_end 74 rpt_tree_rtf_entry 73 rpt_tree_rtf_hdr 81 rpt_tree_vmshelp_end 80 rpt_tree_vmshelp_entry 79 rpt_tree_vmshelp_hdr 78 rpt_tree_winhelp_end 77 rpt_tree_winhelp_entry 76 rpt_tree_winhelp_hdr 45 rpt_undefined_rtf_end 44 rpt_undefined_rtf_entry 43 rpt_undefined_rtf_hdr 51 rpt_undefined_vmshelp_end 50 rpt_undefined_vmshelp_entry 49 rpt_undefined_vmshelp_hdr 48 rpt_undefined_winhelp_end 47 rpt_undefined_winhelp_entry 46 rpt_undefined_winhelp_hdr 65 rpt_xref_rtf_end 64 rpt_xref_rtf_entry 63 rpt_xref_rtf_hdr 71 rpt_xref_vmshelp_end 70 rpt_xref_vmshelp_entry 69 rpt_xref_vmshelp_hdr 68 rpt_xref_winhelp_end 67 rpt_xref_winhelp_entry 66 rpt_xref_winhelp_hdr 753 separate_tree 28 tree_greater_than 361 tree_size
BEGINNING OF FILE
1: /****************************************************************************/ 2: /* */ 3: /* FACILITY: Routine Analyzer */ 4: /* */ 5: /* MODULE: Report Generation */ 6: /* */ 7: /* AUTHOR: Steve Branam, Network Product Support Group, Digital */ 8: /* Equipment Corporation, Littleton, MA, USA. */ 9: /* */ 10: /* DESCRIPTION: This module contains the routines for generating Routine */ 11: /* Analyzer reports, for all output formats. */ 12: /* */ 13: /* REVISION HISTORY: */ 14: /* */ 15: /* V0.1-00 24-AUG-1994 Steve Branam */ 16: /* */ 17: /* Original version. */ 18: /* */ 19: /****************************************************************************/ 20: 21: #include <stdio.h> 22: #include <ctype.h> 23: #include "ranalyzer.h" 24: #include "reports.h" 25: 26: extern GLOBAL_DATABASE gGlobalDatabase; 27:
28: int tree_greater_than(){return 1;} /* dummy */END tree_greater_than. Go to: Beginning of routine.
29: 30: 31: /* dummy routines for currently unimplemented report formats */ 32:
33: void rpt_defined_rtf_hdr(){}END rpt_defined_rtf_hdr. Go to: Beginning of routine.
34: void rpt_defined_rtf_entry(){}END rpt_defined_rtf_entry. Go to: Beginning of routine.
35: void rpt_defined_rtf_end(){}END rpt_defined_rtf_end. Go to: Beginning of routine.
36: void rpt_defined_winhelp_hdr(){}END rpt_defined_winhelp_hdr. Go to: Beginning of routine.
37: void rpt_defined_winhelp_entry(){}END rpt_defined_winhelp_entry. Go to: Beginning of routine.
38: void rpt_defined_winhelp_end(){}END rpt_defined_winhelp_end. Go to: Beginning of routine.
39: void rpt_defined_vmshelp_hdr(){}END rpt_defined_vmshelp_hdr. Go to: Beginning of routine.
40: void rpt_defined_vmshelp_entry(){}END rpt_defined_vmshelp_entry. Go to: Beginning of routine.
41: void rpt_defined_vmshelp_end(){}END rpt_defined_vmshelp_end. Go to: Beginning of routine.
42:
43: void rpt_undefined_rtf_hdr(){}END rpt_undefined_rtf_hdr. Go to: Beginning of routine.
44: void rpt_undefined_rtf_entry(){}END rpt_undefined_rtf_entry. Go to: Beginning of routine.
45: void rpt_undefined_rtf_end(){}END rpt_undefined_rtf_end. Go to: Beginning of routine.
46: void rpt_undefined_winhelp_hdr(){}END rpt_undefined_winhelp_hdr. Go to: Beginning of routine.
47: void rpt_undefined_winhelp_entry(){}END rpt_undefined_winhelp_entry. Go to: Beginning of routine.
48: void rpt_undefined_winhelp_end(){}END rpt_undefined_winhelp_end. Go to: Beginning of routine.
49: void rpt_undefined_vmshelp_hdr(){}END rpt_undefined_vmshelp_hdr. Go to: Beginning of routine.
50: void rpt_undefined_vmshelp_entry(){}END rpt_undefined_vmshelp_entry. Go to: Beginning of routine.
51: void rpt_undefined_vmshelp_end(){}END rpt_undefined_vmshelp_end. Go to: Beginning of routine.
52:
53: void rpt_calls_rtf_hdr(){}END rpt_calls_rtf_hdr. Go to: Beginning of routine.
54: void rpt_calls_rtf_entry(){}END rpt_calls_rtf_entry. Go to: Beginning of routine.
55: void rpt_calls_rtf_end(){}END rpt_calls_rtf_end. Go to: Beginning of routine.
56: void rpt_calls_winhelp_hdr(){}END rpt_calls_winhelp_hdr. Go to: Beginning of routine.
57: void rpt_calls_winhelp_entry(){}END rpt_calls_winhelp_entry. Go to: Beginning of routine.
58: void rpt_calls_winhelp_end(){}END rpt_calls_winhelp_end. Go to: Beginning of routine.
59: void rpt_calls_vmshelp_hdr(){}END rpt_calls_vmshelp_hdr. Go to: Beginning of routine.
60: void rpt_calls_vmshelp_entry(){}END rpt_calls_vmshelp_entry. Go to: Beginning of routine.
61: void rpt_calls_vmshelp_end(){}END rpt_calls_vmshelp_end. Go to: Beginning of routine.
62:
63: void rpt_xref_rtf_hdr(){}END rpt_xref_rtf_hdr. Go to: Beginning of routine.
64: void rpt_xref_rtf_entry(){}END rpt_xref_rtf_entry. Go to: Beginning of routine.
65: void rpt_xref_rtf_end(){}END rpt_xref_rtf_end. Go to: Beginning of routine.
66: void rpt_xref_winhelp_hdr(){}END rpt_xref_winhelp_hdr. Go to: Beginning of routine.
67: void rpt_xref_winhelp_entry(){}END rpt_xref_winhelp_entry. Go to: Beginning of routine.
68: void rpt_xref_winhelp_end(){}END rpt_xref_winhelp_end. Go to: Beginning of routine.
69: void rpt_xref_vmshelp_hdr(){}END rpt_xref_vmshelp_hdr. Go to: Beginning of routine.
70: void rpt_xref_vmshelp_entry(){}END rpt_xref_vmshelp_entry. Go to: Beginning of routine.
71: void rpt_xref_vmshelp_end(){}END rpt_xref_vmshelp_end. Go to: Beginning of routine.
72:
73: void rpt_tree_rtf_hdr(){}END rpt_tree_rtf_hdr. Go to: Beginning of routine.
74: void rpt_tree_rtf_entry(){}END rpt_tree_rtf_entry. Go to: Beginning of routine.
75: void rpt_tree_rtf_end(){}END rpt_tree_rtf_end. Go to: Beginning of routine.
76: void rpt_tree_winhelp_hdr(){}END rpt_tree_winhelp_hdr. Go to: Beginning of routine.
77: void rpt_tree_winhelp_entry(){}END rpt_tree_winhelp_entry. Go to: Beginning of routine.
78: void rpt_tree_winhelp_end(){}END rpt_tree_winhelp_end. Go to: Beginning of routine.
79: void rpt_tree_vmshelp_hdr(){}END rpt_tree_vmshelp_hdr. Go to: Beginning of routine.
80: void rpt_tree_vmshelp_entry(){}END rpt_tree_vmshelp_entry. Go to: Beginning of routine.
81: void rpt_tree_vmshelp_end(){}END rpt_tree_vmshelp_end. Go to: Beginning of routine.
82:
83: void rpt_byfile_text_hdr(){}END rpt_byfile_text_hdr. Go to: Beginning of routine.
84: void rpt_byfile_text_entry(){}END rpt_byfile_text_entry. Go to: Beginning of routine.
85: void rpt_byfile_text_end(){}END rpt_byfile_text_end. Go to: Beginning of routine.
86: void rpt_byfile_rtf_hdr(){}END rpt_byfile_rtf_hdr. Go to: Beginning of routine.
87: void rpt_byfile_rtf_entry(){}END rpt_byfile_rtf_entry. Go to: Beginning of routine.
88: void rpt_byfile_rtf_end(){}END rpt_byfile_rtf_end. Go to: Beginning of routine.
89: void rpt_byfile_winhelp_hdr(){}END rpt_byfile_winhelp_hdr. Go to: Beginning of routine.
90: void rpt_byfile_winhelp_entry(){}END rpt_byfile_winhelp_entry. Go to: Beginning of routine.
91: void rpt_byfile_winhelp_end(){}END rpt_byfile_winhelp_end. Go to: Beginning of routine.
92: void rpt_byfile_vmshelp_hdr(){}END rpt_byfile_vmshelp_hdr. Go to: Beginning of routine.
93: void rpt_byfile_vmshelp_entry(){}END rpt_byfile_vmshelp_entry. Go to: Beginning of routine.
94: void rpt_byfile_vmshelp_end(){}END rpt_byfile_vmshelp_end. Go to: Beginning of routine.
95:
96: void rpt_file_text_hdr(){}END rpt_file_text_hdr. Go to: Beginning of routine.
97: void rpt_file_text_entry(){}END rpt_file_text_entry. Go to: Beginning of routine.
98: void rpt_file_text_end(){}END rpt_file_text_end. Go to: Beginning of routine.
99: void rpt_file_rtf_hdr(){}END rpt_file_rtf_hdr. Go to: Beginning of routine.
100: void rpt_file_rtf_entry(){}END rpt_file_rtf_entry. Go to: Beginning of routine.
101: void rpt_file_rtf_end(){}END rpt_file_rtf_end. Go to: Beginning of routine.
102: void rpt_file_winhelp_hdr(){}END rpt_file_winhelp_hdr. Go to: Beginning of routine.
103: void rpt_file_winhelp_entry(){}END rpt_file_winhelp_entry. Go to: Beginning of routine.
104: void rpt_file_winhelp_end(){}END rpt_file_winhelp_end. Go to: Beginning of routine.
105: void rpt_file_vmshelp_hdr(){}END rpt_file_vmshelp_hdr. Go to: Beginning of routine.
106: void rpt_file_vmshelp_entry(){}END rpt_file_vmshelp_entry. Go to: Beginning of routine.
107: void rpt_file_vmshelp_end(){}END rpt_file_vmshelp_end. Go to: Beginning of routine.
108:
109: void rpt_source_text_hdr(){}END rpt_source_text_hdr. Go to: Beginning of routine.
110: void rpt_source_text_entry(){}END rpt_source_text_entry. Go to: Beginning of routine.
111: void rpt_source_text_end(){}END rpt_source_text_end. Go to: Beginning of routine.
112: void rpt_source_rtf_hdr(){}END rpt_source_rtf_hdr. Go to: Beginning of routine.
113: void rpt_source_rtf_entry(){}END rpt_source_rtf_entry. Go to: Beginning of routine.
114: void rpt_source_rtf_end(){}END rpt_source_rtf_end. Go to: Beginning of routine.
115: void rpt_source_winhelp_hdr(){}END rpt_source_winhelp_hdr. Go to: Beginning of routine.
116: void rpt_source_winhelp_entry(){}END rpt_source_winhelp_entry. Go to: Beginning of routine.
117: void rpt_source_winhelp_end(){}END rpt_source_winhelp_end. Go to: Beginning of routine.
118: void rpt_source_vmshelp_hdr(){}END rpt_source_vmshelp_hdr. Go to: Beginning of routine.
119: void rpt_source_vmshelp_entry(){}END rpt_source_vmshelp_entry. Go to: Beginning of routine.
120: void rpt_source_vmshelp_end(){}END rpt_source_vmshelp_end. Go to: Beginning of routine.
121: 122: /* */ 123: /* Formatter routines forward declarations. */ 124: /* */ 125: 126: void rpt_defined_text_hdr(); 127: void rpt_defined_text_entry(); 128: void rpt_defined_text_end(); 129: void rpt_defined_sdml_hdr(); 130: void rpt_defined_sdml_entry(); 131: void rpt_defined_sdml_end(); 132: void rpt_defined_html_hdr(); 133: void rpt_defined_html_entry(); 134: void rpt_defined_html_end(); 135: void rpt_defined_rtf_hdr(); 136: void rpt_defined_rtf_entry(); 137: void rpt_defined_rtf_end(); 138: void rpt_defined_winhelp_hdr(); 139: void rpt_defined_winhelp_entry(); 140: void rpt_defined_winhelp_end(); 141: void rpt_defined_vmshelp_hdr(); 142: void rpt_defined_vmshelp_entry(); 143: void rpt_defined_vmshelp_end(); 144: 145: void rpt_undefined_text_hdr(); 146: void rpt_undefined_text_entry(); 147: void rpt_undefined_text_end(); 148: void rpt_undefined_sdml_hdr(); 149: void rpt_undefined_sdml_entry(); 150: void rpt_undefined_sdml_end(); 151: void rpt_undefined_html_hdr(); 152: void rpt_undefined_html_entry(); 153: void rpt_undefined_html_end(); 154: void rpt_undefined_rtf_hdr(); 155: void rpt_undefined_rtf_entry(); 156: void rpt_undefined_rtf_end(); 157: void rpt_undefined_winhelp_hdr(); 158: void rpt_undefined_winhelp_entry(); 159: void rpt_undefined_winhelp_end(); 160: void rpt_undefined_vmshelp_hdr(); 161: void rpt_undefined_vmshelp_entry(); 162: void rpt_undefined_vmshelp_end(); 163: 164: void rpt_calls_text_hdr(); 165: void rpt_calls_text_entry(); 166: void rpt_calls_text_end(); 167: void rpt_calls_sdml_hdr(); 168: void rpt_calls_sdml_entry(); 169: void rpt_calls_sdml_end(); 170: void rpt_calls_html_hdr(); 171: void rpt_calls_html_entry(); 172: void rpt_calls_html_end(); 173: void rpt_calls_rtf_hdr(); 174: void rpt_calls_rtf_entry(); 175: void rpt_calls_rtf_end(); 176: void rpt_calls_winhelp_hdr(); 177: void rpt_calls_winhelp_entry(); 178: void rpt_calls_winhelp_end(); 179: void rpt_calls_vmshelp_hdr(); 180: void rpt_calls_vmshelp_entry(); 181: void rpt_calls_vmshelp_end(); 182: 183: void rpt_xref_text_hdr(); 184: void rpt_xref_text_entry(); 185: void rpt_xref_text_end(); 186: void rpt_xref_sdml_hdr(); 187: void rpt_xref_sdml_entry(); 188: void rpt_xref_sdml_end(); 189: void rpt_xref_html_hdr(); 190: void rpt_xref_html_entry(); 191: void rpt_xref_html_end(); 192: void rpt_xref_rtf_hdr(); 193: void rpt_xref_rtf_entry(); 194: void rpt_xref_rtf_end(); 195: void rpt_xref_winhelp_hdr(); 196: void rpt_xref_winhelp_entry(); 197: void rpt_xref_winhelp_end(); 198: void rpt_xref_vmshelp_hdr(); 199: void rpt_xref_vmshelp_entry(); 200: void rpt_xref_vmshelp_end(); 201: 202: void rpt_tree_text_hdr(); 203: void rpt_tree_text_entry(); 204: void rpt_tree_text_end(); 205: void rpt_tree_sdml_hdr(); 206: void rpt_tree_sdml_entry(); 207: void rpt_tree_sdml_end(); 208: void rpt_tree_html_hdr(); 209: void rpt_tree_html_entry(); 210: void rpt_tree_html_end(); 211: void rpt_tree_rtf_hdr(); 212: void rpt_tree_rtf_entry(); 213: void rpt_tree_rtf_end(); 214: void rpt_tree_winhelp_hdr(); 215: void rpt_tree_winhelp_entry(); 216: void rpt_tree_winhelp_end(); 217: void rpt_tree_vmshelp_hdr(); 218: void rpt_tree_vmshelp_entry(); 219: void rpt_tree_vmshelp_end(); 220: 221: void rpt_byfile_text_hdr(); 222: void rpt_byfile_text_entry(); 223: void rpt_byfile_text_end(); 224: void rpt_byfile_sdml_hdr(); 225: void rpt_byfile_sdml_entry(); 226: void rpt_byfile_sdml_end(); 227: void rpt_byfile_html_hdr(); 228: void rpt_byfile_html_entry(); 229: void rpt_byfile_html_end(); 230: void rpt_byfile_rtf_hdr(); 231: void rpt_byfile_rtf_entry(); 232: void rpt_byfile_rtf_end(); 233: void rpt_byfile_winhelp_hdr(); 234: void rpt_byfile_winhelp_entry(); 235: void rpt_byfile_winhelp_end(); 236: void rpt_byfile_vmshelp_hdr(); 237: void rpt_byfile_vmshelp_entry(); 238: void rpt_byfile_vmshelp_end(); 239: 240: void rpt_file_text_hdr(); 241: void rpt_file_text_entry(); 242: void rpt_file_text_end(); 243: void rpt_file_sdml_hdr(); 244: void rpt_file_sdml_entry(); 245: void rpt_file_sdml_end(); 246: void rpt_file_html_hdr(); 247: void rpt_file_html_entry(); 248: void rpt_file_html_end(); 249: void rpt_file_rtf_hdr(); 250: void rpt_file_rtf_entry(); 251: void rpt_file_rtf_end(); 252: void rpt_file_winhelp_hdr(); 253: void rpt_file_winhelp_entry(); 254: void rpt_file_winhelp_end(); 255: void rpt_file_vmshelp_hdr(); 256: void rpt_file_vmshelp_entry(); 257: void rpt_file_vmshelp_end(); 258: 259: void rpt_source_text_hdr(); 260: void rpt_source_text_entry(); 261: void rpt_source_text_end(); 262: void rpt_source_sdml_hdr(); 263: void rpt_source_sdml_entry(); 264: void rpt_source_sdml_end(); 265: void rpt_source_html_hdr(); 266: void rpt_source_html_entry(); 267: void rpt_source_html_end(); 268: void rpt_source_rtf_hdr(); 269: void rpt_source_rtf_entry(); 270: void rpt_source_rtf_end(); 271: void rpt_source_winhelp_hdr(); 272: void rpt_source_winhelp_entry(); 273: void rpt_source_winhelp_end(); 274: void rpt_source_vmshelp_hdr(); 275: void rpt_source_vmshelp_entry(); 276: void rpt_source_vmshelp_end(); 277: 278: /* */ 279: /* Report formatting dispatch tables. */ 280: /* */ 281:
282: #define report_hdr_routine(t) ((t)[report_format()][0])END report_hdr_routine. Go to: Beginning of routine.
283: #define report_entry_routine(t) ((t)[report_format()][1])END report_entry_routine. Go to: Beginning of routine.
284: #define report_end_routine(t) ((t)[report_format()][2])END report_end_routine. Go to: Beginning of routine.
285: 286: typedef void (*FORMATTER)(); 287: 288: static FORMATTER rpt_defined_routines[][3] = { 289: {rpt_defined_text_hdr, rpt_defined_text_entry, rpt_defined_text_end}, 290: {rpt_defined_sdml_hdr, rpt_defined_sdml_entry, rpt_defined_sdml_end}, 291: {rpt_defined_html_hdr, rpt_defined_html_entry, rpt_defined_html_end}, 292: {rpt_defined_rtf_hdr, rpt_defined_rtf_entry, rpt_defined_rtf_end}, 293: {rpt_defined_winhelp_hdr, rpt_defined_winhelp_entry, rpt_defined_winhelp_end}, 294: {rpt_defined_vmshelp_hdr, rpt_defined_vmshelp_entry, rpt_defined_vmshelp_end} 295: }; 296: 297: static FORMATTER rpt_undefined_routines[][3] = { 298: {rpt_undefined_text_hdr, rpt_undefined_text_entry, rpt_undefined_text_end}, 299: {rpt_undefined_sdml_hdr, rpt_undefined_sdml_entry, rpt_undefined_sdml_end}, 300: {rpt_undefined_html_hdr, rpt_undefined_html_entry, rpt_undefined_html_end}, 301: {rpt_undefined_rtf_hdr, rpt_undefined_rtf_entry, rpt_undefined_rtf_end}, 302: {rpt_undefined_winhelp_hdr, rpt_undefined_winhelp_entry, rpt_undefined_winhelp_end}, 303: {rpt_undefined_vmshelp_hdr, rpt_undefined_vmshelp_entry, rpt_undefined_vmshelp_end} 304: }; 305: 306: static FORMATTER rpt_calls_routines[][3] = { 307: {rpt_calls_text_hdr, rpt_calls_text_entry, rpt_calls_text_end}, 308: {rpt_calls_sdml_hdr, rpt_calls_sdml_entry, rpt_calls_sdml_end}, 309: {rpt_calls_html_hdr, rpt_calls_html_entry, rpt_calls_html_end}, 310: {rpt_calls_rtf_hdr, rpt_calls_rtf_entry, rpt_calls_rtf_end}, 311: {rpt_calls_winhelp_hdr, rpt_calls_winhelp_entry, rpt_calls_winhelp_end}, 312: {rpt_calls_vmshelp_hdr, rpt_calls_vmshelp_entry, rpt_calls_vmshelp_end} 313: }; 314: 315: static FORMATTER rpt_xref_routines[][3] = { 316: {rpt_xref_text_hdr, rpt_xref_text_entry, rpt_xref_text_end}, 317: {rpt_xref_sdml_hdr, rpt_xref_sdml_entry, rpt_xref_sdml_end}, 318: {rpt_xref_html_hdr, rpt_xref_html_entry, rpt_xref_html_end}, 319: {rpt_xref_rtf_hdr, rpt_xref_rtf_entry, rpt_xref_rtf_end}, 320: {rpt_xref_winhelp_hdr, rpt_xref_winhelp_entry, rpt_xref_winhelp_end}, 321: {rpt_xref_vmshelp_hdr, rpt_xref_vmshelp_entry, rpt_xref_vmshelp_end} 322: }; 323: 324: static FORMATTER rpt_tree_routines[][3] = { 325: {rpt_tree_text_hdr, rpt_tree_text_entry, rpt_tree_text_end}, 326: {rpt_tree_sdml_hdr, rpt_tree_sdml_entry, rpt_tree_sdml_end}, 327: {rpt_tree_html_hdr, rpt_tree_html_entry, rpt_tree_html_end}, 328: {rpt_tree_rtf_hdr, rpt_tree_rtf_entry, rpt_tree_rtf_end}, 329: {rpt_tree_winhelp_hdr, rpt_tree_winhelp_entry, rpt_tree_winhelp_end}, 330: {rpt_tree_vmshelp_hdr, rpt_tree_vmshelp_entry, rpt_tree_vmshelp_end} 331: }; 332: 333: static FORMATTER rpt_byfile_routines[][3] = { 334: {rpt_byfile_text_hdr, rpt_byfile_text_entry, rpt_byfile_text_end}, 335: {rpt_byfile_sdml_hdr, rpt_byfile_sdml_entry, rpt_byfile_sdml_end}, 336: {rpt_byfile_html_hdr, rpt_byfile_html_entry, rpt_byfile_html_end}, 337: {rpt_byfile_rtf_hdr, rpt_byfile_rtf_entry, rpt_byfile_rtf_end}, 338: {rpt_byfile_winhelp_hdr, rpt_byfile_winhelp_entry, rpt_byfile_winhelp_end}, 339: {rpt_byfile_vmshelp_hdr, rpt_byfile_vmshelp_entry, rpt_byfile_vmshelp_end} 340: }; 341: 342: static FORMATTER rpt_file_routines[][3] = { 343: {rpt_file_text_hdr, rpt_file_text_entry, rpt_file_text_end}, 344: {rpt_file_sdml_hdr, rpt_file_sdml_entry, rpt_file_sdml_end}, 345: {rpt_file_html_hdr, rpt_file_html_entry, rpt_file_html_end}, 346: {rpt_file_rtf_hdr, rpt_file_rtf_entry, rpt_file_rtf_end}, 347: {rpt_file_winhelp_hdr, rpt_file_winhelp_entry, rpt_file_winhelp_end}, 348: {rpt_file_vmshelp_hdr, rpt_file_vmshelp_entry, rpt_file_vmshelp_end} 349: }; 350: 351: static FORMATTER rpt_source_routines[][3] = { 352: {rpt_source_text_hdr, rpt_source_text_entry, rpt_source_text_end}, 353: {rpt_source_sdml_hdr, rpt_source_sdml_entry, rpt_source_sdml_end}, 354: {rpt_source_html_hdr, rpt_source_html_entry, rpt_source_html_end}, 355: {rpt_source_rtf_hdr, rpt_source_rtf_entry, rpt_source_rtf_end}, 356: {rpt_source_winhelp_hdr, rpt_source_winhelp_entry, rpt_source_winhelp_end}, 357: {rpt_source_vmshelp_hdr, rpt_source_vmshelp_entry, rpt_source_vmshelp_end} 358: }; 359: 360: /*************************************************************************++*/
361: int tree_size( 362: /* Computes the size (number of nodes) of a routine's call tree. The */ 363: /* current implementation is only an approximation, showing a minimal */ 364: /* tree size, since it only looks down one level; deep trees will throw it */ 365: /* off. */ 366: 367: DEFINITION 368: *aDef 369: /* (MODIFY, BY ADDR): */ 370: /* Definition to check. The tree size will be cached in this */ 371: /* definition. */ 372: 373: ) /* Returns size of tree. */ 374: /*****************************************************************--*/ 375: 376: { 377: int nodes; /* Node counter. */ 378: REFERENCE /* Current reference entry. */ 379: *called; 380: DEFINITION /* Definition for current */ 381: *curdef; /* reference entry. */ 382: 383: if (def_tree_size(aDef) != 0) { /* Already been computed. */ 384: return def_tree_size(aDef); 385: } 386: else if (!needs_tree(aDef)) { /* No tree for routine. */ 387: return 0; 388: } 389: else { /* Check called routines. */ 390: for (nodes = 0, called = list_first(def_refs(aDef)); 391: called != NULL; nodes++, called = next_entry(called)) { 392: if (needs_tree(ref_definition(called))) { 393: nodes += def_num_calls(ref_definition(called)); 394: } 395: } 396: set_def_tree_size(aDef, nodes); 397: return nodes; 398: } 399: }END tree_size. Go to: Beginning of routine.
400: 401: /*************************************************************************++*/
402: int fold_string( 403: /* Folds a string at the non-alphanumeric nearest the right margin. A */ 404: /* whitespace is removed; anything else is left in front of the fold. */ 405: 406: char *aSrc, 407: /* (READ, BY ADDR): */ 408: /* Source string to be folded. */ 409: 410: int vPos, 411: /* (READ, BY VAL): */ 412: /* Position in source string where characters should be copied */ 413: /* from. When repeatedly folding a long string, this should */ 414: /* be the return value from a previous call to fold_string. It */ 415: /* is assumed to be less than the length of aSrc. */ 416: 417: char *aPrefix, 418: /* (READ, BY VAL): */ 419: /* Optional prefix string to be written to aDest before */ 420: /* characters from aSrc. Must be shorter than vLength, or it */ 421: /* will be ignored. If NULL ptr is passed, no prefix is used. */ 422: 423: char *aDest, 424: /* (WRITE, BY ADDR): */ 425: /* Destination buffer into which string is to be folded. It is */ 426: /* assumed to be at least vLength + 1 characters long. */ 427: 428: int vLength 429: /* (READ, BY VAL): */ 430: /* Maximum length of string to be written into aDest. */ 431: 432: ) /* Returns position in aStr where copying stopped. It will be equal */ 433: /* to the length of aSrc when all characters have been copied from */ 434: /* aSrc. This may be used as the vPos value on a successive call */ 435: /* to fold_string. */ 436: /*****************************************************************--*/ 437: 438: { 439: int curlen = 0; /* Length accumulator. */ 440: int remlen; /* Remaining length of string. */ 441: int fold; /* Point at which to fold it. */ 442: int spaceflag = 0; /* Flag: fold at space. */ 443: 444: if (aPrefix != NULL && (curlen = strlen(aPrefix)) < vLength) { 445: strcpy(aDest, aPrefix); /* Copy prefix first. */ 446: } 447: 448: remlen = strlen(&aSrc[vPos]); 449: if (curlen + remlen <= vLength) { /* Remainder of string fits */ 450: strcpy(&aDest[curlen], &aSrc[vPos]);/* without folding. */ 451: return vPos + remlen; 452: } 453: else { /* Need to fold it, find fold */ 454: /* point. */ 455: for (fold = vPos + vLength - curlen - 1; 456: fold > vPos && isalnum(aSrc[fold]); 457: fold--); 458: if (fold == vPos) { /* Fold point not found, fold */ 459: fold = vPos + vLength - 1; /* it at right margin. */ 460: } 461: else if (!(spaceflag = isspace(aSrc[fold]))) { 462: /* Folding at non-alphanum, */ 463: fold++; /* non-space, fold after it. */ 464: } 465: /* Copy folded part of string. */ 466: strncpy(&aDest[curlen], &aSrc[vPos], fold - vPos); 467: aDest[fold - vPos] = '\0'; 468: if (spaceflag) { /* Remove whitespace at fold. */ 469: fold++; 470: } 471: return fold; /* Next fold will start after */ 472: } /* this one. */ 473: }END fold_string. Go to: Beginning of routine.
474: 475: /*************************************************************************++*/
476: char *report_filext( 477: /* Returns the file extension string to be used for report files, based on */ 478: /* the type of report output requested. */ 479: 480: /* No arguments. */ 481: 482: ) /* Returns ptr to file name extension string. */ 483: /*****************************************************************--*/ 484: 485: { 486: if (rpt_sdml_enabled()) return OUTFILE_EXT_SDML; 487: if (rpt_html_enabled()) return OUTFILE_EXT_HTML; 488: if (rpt_rtf_enabled()) return OUTFILE_EXT_RTF; 489: if (rpt_winhelp_enabled()) return OUTFILE_EXT_WINHELP; 490: if (rpt_vmshelp_enabled()) return OUTFILE_EXT_VMSHELP; 491: return OUTFILE_EXT_TEXT; /* Default output format. */ 492: }END report_filext. Go to: Beginning of routine.
493: 494: /*************************************************************************++*/
495: SOURCEFILE *next_defining_file( 496: /* Returns next source file containing routine definitions. */ 497: 498: SOURCEFILE 499: *aSourceFile 500: /* (READ, BY ADDR): */ 501: /* Source file to check. */ 502: 503: ) /* Returns ptr to source file, or NULL if one not found. */ 504: /*****************************************************************--*/ 505: 506: { 507: SOURCEFILE /* Current file being checked. */ 508: *curfile; 509: 510: for (curfile = next_entry(aSourceFile); /* Scan rest of file list. */ 511: curfile != NULL; 512: curfile = next_entry(curfile)) { 513: if (source_routines(curfile) > 0) { 514: return curfile; /* Found another with defs. */ 515: } 516: } 517: return NULL; /* No more with defs. */ 518: }END next_defining_file. Go to: Beginning of routine.
519: 520: /*************************************************************************++*/
521: SOURCEFILE *prev_defining_file( 522: /* Returns previous source file containing routine definitions. */ 523: 524: SOURCEFILE 525: *aSourceFile 526: /* (READ, BY ADDR): */ 527: /* Source file to check. */ 528: 529: ) /* Returns ptr to source file, or NULL if one not found. */ 530: /*****************************************************************--*/ 531: 532: { 533: SOURCEFILE /* Current file being checked. */ 534: *curfile; 535: 536: for (curfile = prev_entry(aSourceFile); /* Scan prior file list. */ 537: curfile != NULL; 538: curfile = prev_entry(curfile)) { 539: if (source_routines(curfile) > 0) { 540: return curfile; /* Found another with defs. */ 541: } 542: } 543: return NULL; /* No prior with defs. */ 544: }END prev_defining_file. Go to: Beginning of routine.
545: 546: /*************************************************************************++*/
547: int isfirst_in_file( 548: /* Determines whether a definition entry is the first one in its source */ 549: /* file, assuming the definitions are currently sorted in file order. */ 550: 551: DEFINITION 552: *aDef 553: /* (READ, BY ADDR): */ 554: /* Definition to check. */ 555: 556: ) /* Returns flag indicating whether definition is first: */ 557: /* 1 - Definition is first in file. */ 558: /* 0 - Definition is not first in file. */ 559: /*****************************************************************--*/ 560: 561: { 562: DEFINITION /* Ptr to prev def. */ 563: *prevdef; 564: 565: if ((prevdef = prev_entry(aDef)) != NULL) { 566: return (def_source(aDef) != def_source(prevdef)); 567: } 568: return 1; 569: }END isfirst_in_file. Go to: Beginning of routine.
570: 571: /*************************************************************************++*/
572: int islast_in_file( 573: /* Determines whether a definition entry is the last one in its source */ 574: /* file, assuming the definitions are currently sorted in file order. */ 575: 576: DEFINITION 577: *aDef 578: /* (READ, BY ADDR): */ 579: /* Definition to check. */ 580: 581: ) /* Returns flag indicating whether definition is last: */ 582: /* 1 - Definition is lasst in file. */ 583: /* 0 - Definition is not last in file. */ 584: /*****************************************************************--*/ 585: 586: { 587: DEFINITION /* Ptr to next def. */ 588: *nextdef; 589: 590: if ((nextdef = next_entry(aDef)) != NULL) { 591: return (def_source(aDef) != def_source(nextdef)); 592: } 593: return 1; 594: }END islast_in_file. Go to: Beginning of routine.
595: 596: /*************************************************************************++*/
597: DEFINITION *next_tree( 598: /* Returns next definition that needs a call tree. */ 599: 600: DEFINITION 601: *aDef 602: /* (READ, BY ADDR): */ 603: /* Definition to check. */ 604: 605: ) /* Returns ptr to definition, or NULL if none found. */ 606: /*****************************************************************--*/ 607: 608: { 609: DEFINITION /* Current def being checked. */ 610: *curdef; 611: 612: for (curdef = next_entry(aDef); /* Scan rest of def list. */ 613: curdef != NULL; 614: curdef = next_entry(curdef)) { 615: if (needs_tree(curdef)) { 616: return curdef; /* Found another needing tree. */ 617: } 618: } 619: return NULL; /* No more needing tree. */ 620: }END next_tree. Go to: Beginning of routine.
621: 622: /*************************************************************************++*/
623: DEFINITION *prev_tree( 624: /* Returns previous definition that needs a call tree. */ 625: 626: DEFINITION 627: *aDef 628: /* (READ, BY ADDR): */ 629: /* Definition to check. */ 630: 631: ) /* Returns ptr to definition, or NULL if none found. */ 632: /*****************************************************************--*/ 633: 634: { 635: DEFINITION /* Current def being checked. */ 636: *curdef; 637: 638: for (curdef = prev_entry(aDef); /* Scan prior def list. */ 639: curdef != NULL; 640: curdef = prev_entry(curdef)) { 641: if (needs_tree(curdef)) { 642: return curdef; /* Found another needing tree. */ 643: } 644: } 645: return NULL; /* No prior needing tree. */ 646: }END prev_tree. Go to: Beginning of routine.
647: 648: /*************************************************************************++*/
649: DEFINITION *next_defined( 650: /* Returns next definition for a defined routine. */ 651: 652: DEFINITION 653: *aDef 654: /* (READ, BY ADDR): */ 655: /* Definition to check. */ 656: 657: ) /* Returns ptr to definition, or NULL if none found. */ 658: /*****************************************************************--*/ 659: 660: { 661: DEFINITION /* Current def being checked. */ 662: *curdef; 663: 664: for (curdef = next_entry(aDef); /* Scan rest of def list. */ 665: curdef != NULL; 666: curdef = next_entry(curdef)) { 667: if (isdefined_routine(curdef)) { 668: return curdef; /* Found another defined one. */ 669: } 670: } 671: return NULL; /* No more. */ 672: }END next_defined. Go to: Beginning of routine.
673: 674: /*************************************************************************++*/
675: DEFINITION *prev_defined( 676: /* Returns previous definition of a defined routine. */ 677: 678: DEFINITION 679: *aDef 680: /* (READ, BY ADDR): */ 681: /* Definition to check. */ 682: 683: ) /* Returns ptr to definition, or NULL if none found. */ 684: /*****************************************************************--*/ 685: 686: { 687: DEFINITION /* Current def being checked. */ 688: *curdef; 689: 690: for (curdef = prev_entry(aDef); /* Scan prior def list. */ 691: curdef != NULL; 692: curdef = prev_entry(curdef)) { 693: if (isdefined_routine(curdef)) { 694: return curdef; /* Found another defined one. */ 695: } 696: } 697: return NULL; /* No prior one. */ 698: }END prev_defined. Go to: Beginning of routine.
699: 700: /*************************************************************************++*/
701: DEFINITION *next_undefined( 702: /* Returns next definition for an undefined routine. */ 703: 704: DEFINITION 705: *aDef 706: /* (READ, BY ADDR): */ 707: /* Definition to check. */ 708: 709: ) /* Returns ptr to definition, or NULL if none found. */ 710: /*****************************************************************--*/ 711: 712: { 713: DEFINITION /* Current def being checked. */ 714: *curdef; 715: 716: for (curdef = next_entry(aDef); /* Scan rest of def list. */ 717: curdef != NULL; 718: curdef = next_entry(curdef)) { 719: if (!isdefined_routine(curdef)) { 720: return curdef; /* Found another undefined one. */ 721: } 722: } 723: return NULL; /* No more. */ 724: }END next_undefined. Go to: Beginning of routine.
725: 726: /*************************************************************************++*/
727: DEFINITION *prev_undefined( 728: /* Returns previous definition of an undefined routine. */ 729: 730: DEFINITION 731: *aDef 732: /* (READ, BY ADDR): */ 733: /* Definition to check. */ 734: 735: ) /* Returns ptr to definition, or NULL if none found. */ 736: /*****************************************************************--*/ 737: 738: { 739: DEFINITION /* Current def being checked. */ 740: *curdef; 741: 742: for (curdef = prev_entry(aDef); /* Scan prior def list. */ 743: curdef != NULL; 744: curdef = prev_entry(curdef)) { 745: if (!isdefined_routine(curdef)) { 746: return curdef; /* Found another undefined one. */ 747: } 748: } 749: return NULL; /* No prior one. */ 750: }END prev_undefined. Go to: Beginning of routine.
751: 752: /*************************************************************************++*/
753: int separate_tree( 754: /* Determines whether or not the user has requested a separate call tree */ 755: /* for a routine. */ 756: 757: DEFINITION 758: *aDef 759: /* (READ, BY ADDR): */ 760: /* Routine definition to check. */ 761: 762: ) /* Returns status flag: */ 763: /* 1 - User has requested separate tree for this routine. */ 764: /* 0 - User has not requested separate tree for this routine. */ 765: /*****************************************************************--*/ 766: 767: { 768: char **rlist; /* Routine name list ptr. */ 769: 770: if ((rlist = separate_list()) == NULL) { 771: return 0; /* No list to worry about. */ 772: } 773: else { /* Otherwise, check each name */ 774: while (*rlist != NULL) { /* in list. */ 775: if (strcmp(*rlist++, def_name(aDef)) == 0) { 776: return 1; /* Found it, separate tree. */ 777: } 778: } 779: return 0; /* Routine is not in list. */ 780: } 781: }END separate_tree. Go to: Beginning of routine.
782: 783: /*************************************************************************++*/
784: int needs_tree( 785: /* Determines whether or not a routine definition needs a separate call */ 786: /* tree. See the description of report_call_trees for details. */ 787: 788: DEFINITION 789: *aDef 790: /* (MODIFY, BY ADDR): */ 791: /* Routine definition entry to check. If the routine has not */ 792: /* already been checked, the results of the */ 793: /* evalution are cached in the definition. */ 794: 795: ) /* Returns flag indicating whether or not tree is needed: */ 796: /* 1 - Separate tree is needed. */ 797: /* 0 - Separate tree is not needed, routine should be expanded */ 798: /* in callers. */ 799: /*****************************************************************--*/ 800: 801: { 802: int status; /* Evaluation status. */ 803: DEFINITION /* Current definition ptr. */ 804: *curdef; 805: 806: curdef = next_entry(aDef); 807: if (def_tree_required(aDef) != NOT_YET_EVALUATED) { 808: return (def_tree_required(aDef) == TREE_REQUIRED); 809: } 810: else if (def_num_calls(aDef) == 0) { /* Does not call anything, no */ 811: status = 0; /* tree to worry about. */ 812: } 813: else if (tree_inline_disabled()) { /* User says separate tree for */ 814: status = 1; /* all routines. */ 815: } 816: else if (separate_tree(aDef)) { /* User says make this one */ 817: status = 1; /* separate. */ 818: } 819: else if (!isend_of_list(aDef) && 820: strcmp(def_name(aDef), def_name(curdef)) == 0) { 821: status = 1; /* Multiply-defined routine, */ 822: curdef = aDef; /* all versions of it need a */ 823: for (curdef = aDef; /* tree. */ 824: curdef != NULL && strcmp(def_name(aDef), def_name(curdef)) == 0; 825: curdef = next_entry(curdef)) { 826: set_def_tree_req(curdef, TREE_REQUIRED); 827: } 828: } 829: else if (def_num_callers(aDef) >= 1 && 830: def_num_callers(aDef) <= max_callers()) { 831: status = 0; /* Too few callers for separate */ 832: } /* tree. */ 833: else if (!tree_greater_than(aDef, MIN_TREE_SIZE)) { 834: status = 0; /* Tree is trivial. */ 835: } 836: else { 837: status = 1; /* Generate separate tree! */ 838: } 839: if (status) { /* Cache evaluation result. */ 840: set_def_tree_req(aDef, TREE_REQUIRED); 841: } 842: else { 843: set_def_tree_req(aDef, TREE_NOT_REQUIRED); 844: } 845: return status; 846: }END needs_tree. Go to: Beginning of routine.
847: 848: /*************************************************************************++*/
849: void report_defined( 850: /* Reports the defined routines in alphabetical order to a file. */ 851: 852: char *aFileName 853: /* (READ, BY ADDR): */ 854: /* Report output file name. */ 855: 856: ) /* No return value. */ 857: /*****************************************************************--*/ 858: 859: { 860: void (*report_hdr)(); /* Ptr to report header */ 861: /* routine. */ 862: void (*report_entry)(); /* Ptr to report line routine. */ 863: void (*report_end)(); /* Ptr to report end routine. */ 864: FILE *rptfile; /* Report file ptr. */ 865: DEFINITION /* Current routine entry. */ 866: *curdef; 867: long total; /* Total defined routines. */ 868: 869: /*+ */ 870: /* Select appropriate set of output formatter routines. Then open file */ 871: /* and write report header. Next, for each defined routine (i.e. each */ 872: /* routine for which the source file is known), write a report line. */ 873: /* Finally, write report trailer and close file. */ 874: /*- */ 875: 876: report_hdr = report_hdr_routine(rpt_defined_routines); 877: report_entry = report_entry_routine(rpt_defined_routines); 878: report_end = report_end_routine(rpt_defined_routines); 879: 880: if ((rptfile = fopen(aFileName, "w")) == NULL) { 881: printf("ERROR: Unable to open %s for report output\n", aFileName); 882: } 883: else { 884: if (list_enabled()) { 885: fprintf(list_file(), "\nREPORT Defined routines in file %s\n", 886: aFileName); 887: } 888: if (log_enabled()) { 889: printf("REPORT Defined routines in file %s\n", aFileName); 890: } 891: (*report_hdr)(rptfile); /* Write header. */ 892: for (total = 0, curdef = list_first(global_deflist()); curdef != NULL; 893: curdef = next_entry(curdef)) { 894: if (isdefined_routine(curdef)) { 895: /* Write entry line. */ 896: if (trace_rpt_enabled()) { 897: printf("TRACE: Report defined routine %s @ %lxh\n", 898: def_name(curdef), curdef); 899: } 900: (*report_entry)(rptfile, curdef, (total == 0), 901: islast_defined(curdef)); 902: total++; 903: } 904: else if (trace_rpt_enabled()) { 905: printf( 906: "TRACE: Report defined, skipping undefined routine %s @ %lxh\n", 907: def_name(curdef), curdef); 908: } 909: } 910: (*report_end)(rptfile, total); /* Write trailer. */ 911: fclose(rptfile); 912: if (list_enabled()) { 913: fprintf(list_file(), " %ld Defined routines\n", total); 914: } 915: if (log_full_enabled()) { 916: printf(" %ld Defined routines\n\n", total); 917: } 918: } 919: }END report_defined. Go to: Beginning of routine.
920: 921: /*************************************************************************++*/
922: void report_undefined( 923: /* Reports the undefined routines in alphabetical order to a file. */ 924: 925: char *aFileName 926: /* (READ, BY ADDR): */ 927: /* Report output file name. */ 928: 929: ) /* No return value. */ 930: /*****************************************************************--*/ 931: 932: { 933: void (*report_hdr)(); /* Ptr to report header */ 934: /* routine. */ 935: void (*report_entry)(); /* Ptr to report line routine. */ 936: void (*report_end)(); /* Ptr to report end routine. */ 937: FILE *rptfile; /* Report file ptr. */ 938: DEFINITION /* Current routine entry. */ 939: *curdef; 940: long total; /* Total undefined routines. */ 941: 942: /*+ */ 943: /* Select appropriate set of output formatter routines. Then open file */ 944: /* and write report header. Next, for each undefined routine (i.e. */ 945: /* each routine for which the source file is not known), write a */ 946: /* report line. Finally, write report trailer and close file. */ 947: /*- */ 948: 949: report_hdr = report_hdr_routine(rpt_undefined_routines); 950: report_entry = report_entry_routine(rpt_undefined_routines); 951: report_end = report_end_routine(rpt_undefined_routines); 952: 953: if ((rptfile = fopen(aFileName, "w")) == NULL) { 954: printf("ERROR: Unable to open %s for report output\n", aFileName); 955: } 956: else { 957: if (list_enabled()) { 958: fprintf(list_file(), "\nREPORT External routines in file %s\n", 959: aFileName); 960: } 961: if (log_enabled()) { 962: printf("REPORT External routines in file %s\n", aFileName); 963: } 964: (*report_hdr)(rptfile); /* Write header. */ 965: for (total = 0, curdef = list_first(global_deflist()); curdef != NULL; 966: curdef = next_entry(curdef)) { 967: if (!isdefined_routine(curdef)) { 968: /* Write entry line. */ 969: if (trace_rpt_enabled()) { 970: printf("TRACE: Report external routine %s @ %lxh\n", 971: def_name(curdef), curdef); 972: } 973: (*report_entry)(rptfile, curdef, (total == 0), 974: islast_undefined(curdef)); 975: total++; 976: } 977: else if (trace_rpt_enabled()) { 978: printf( 979: "TRACE: Report external, skipping defined routine %s @ %lxh\n", 980: def_name(curdef), curdef); 981: } 982: } 983: (*report_end)(rptfile, total); /* Write trailer. */ 984: fclose(rptfile); 985: if (list_enabled()) { 986: fprintf(list_file(), " %ld External routines\n", total); 987: } 988: if (log_full_enabled()) { 989: printf(" %ld External routines\n\n", total); 990: } 991: } 992: }END report_undefined. Go to: Beginning of routine.
993: 994: /*************************************************************************++*/
995: void report_calls( 996: /* Reports the calls and callers of the defined routines in alphabetical */ 997: /* order to a file. */ 998: 999: char *aFileName 1000: /* (READ, BY ADDR): */ 1001: /* Report output file name. */ 1002: 1003: ) /* No return value. */ 1004: /*****************************************************************--*/ 1005: 1006: { 1007: void (*report_hdr)(); /* Ptr to section header */ 1008: /* routine. */ 1009: void (*report_entry)(); /* Ptr to report line routine. */ 1010: void (*report_end)(); /* Ptr to section end routine. */ 1011: FILE *rptfile; /* Report file ptr. */ 1012: DEFINITION /* Current routine entry. */ 1013: *curdef; 1014: REFERENCE /* Current caller ref. */ 1015: *caller; 1016: REFERENCE /* Current called ref. */ 1017: *called; 1018: long total; /* Total defined routines. */ 1019: 1020: /*+ */ 1021: /* Select appropriate set of output formatter routines and open file. */ 1022: /* For each defined routine, write a header section. For each */ 1023: /* reference and caller in a routine definition, write a report line */ 1024: /* (they are output in side-by-side pairs until both lists are */ 1025: /* exhausted, although there is no relationship implied by the */ 1026: /* pairing). Then write a trailer section for the defined routine. */ 1027: /* Last, close the file. */ 1028: /*- */ 1029: 1030: report_hdr = report_hdr_routine(rpt_calls_routines); 1031: report_entry = report_entry_routine(rpt_calls_routines); 1032: report_end = report_end_routine(rpt_calls_routines); 1033: 1034: if ((rptfile = fopen(aFileName, "w")) == NULL) { 1035: printf("ERROR: Unable to open %s for report output\n", aFileName); 1036: } 1037: else { 1038: if (list_enabled()) { 1039: fprintf(list_file(), 1040: "\nREPORT Defined routine calls/callers in file %s\n", 1041: aFileName); 1042: } 1043: if (log_enabled()) { 1044: printf("REPORT Defined routine calls/callers in file %s\n", 1045: aFileName); 1046: } 1047: for (total = 0, curdef = list_first(global_deflist()); curdef != NULL; 1048: curdef = next_entry(curdef)) { 1049: if (isdefined_routine(curdef)) { 1050: /* Write header section. */ 1051: if (trace_rpt_enabled()) { 1052: printf( 1053: "TRACE: Report calls/callers for routine %s @ %lxh\n", 1054: def_name(curdef), curdef); 1055: } 1056: (*report_hdr)(rptfile, curdef); 1057: for (called = list_first(def_refs(curdef)), 1058: caller = list_first(def_callers(curdef)); 1059: called != NULL || caller != NULL; 1060: caller = next_entry(caller), called = next_entry(called)) { 1061: /* Write calls/caller line. */ 1062: (*report_entry)(rptfile, called, caller); 1063: } /* Write trailer section. */ 1064: (*report_end)(rptfile, curdef); 1065: total++; 1066: } 1067: else if (trace_rpt_enabled()) { 1068: printf( 1069: "TRACE: Report calls/callers, skipping external routine %s @ %lxh\n", 1070: def_name(curdef), curdef); 1071: } 1072: } 1073: fclose(rptfile); 1074: if (list_enabled()) { 1075: fprintf(list_file(), " %ld Defined routines\n", total); 1076: } 1077: if (log_full_enabled()) { 1078: printf(" %ld Defined routines\n\n", total); 1079: } 1080: } 1081: }END report_calls. Go to: Beginning of routine.
1082: 1083: /*************************************************************************++*/
1084: void report_xrefs( 1085: /* Reports caller cross references for all routines (defined and undefined) */ 1086: /* in alphabetical order to a file. */ 1087: 1088: char *aFileName 1089: /* (READ, BY ADDR): */ 1090: /* Report output file name. */ 1091: 1092: ) /* No return value. */ 1093: /*****************************************************************--*/ 1094: 1095: { 1096: void report_tree(); 1097: 1098: void (*report_hdr)(); /* Ptr to report header */ 1099: /* routine. */ 1100: void (*report_entry)(); /* Ptr to report line routine. */ 1101: void (*report_entry_tree)(); /* Ptr to report line routine. */ 1102: void (*report_end)(); /* Ptr to report end routine. */ 1103: void (*report_end_tree)(); /* Ptr to report end routine. */ 1104: FILE *rptfile; /* Report file ptr. */ 1105: DEFINITION /* Current routine entry. */ 1106: *curdef; 1107: DEFINITION /* Temporary def to hold call */ 1108: *treedef; /* tree. */ 1109: REFERENCE /* Temporary ref to current */ 1110: *curref; /* definition. */ 1111: long total; /* Total defined routines. */ 1112: int xreffile = 0; /* Xref report file number. */ 1113: 1114: /*+ */ 1115: /* Select appropriate set of output formatter routines. Then open file */ 1116: /* and write report header. Next, for each routine, write a report */ 1117: /* line. Finally, write report trailer and close file. */ 1118: /* */ 1119: 1120: report_hdr = report_hdr_routine(rpt_xref_routines); 1121: report_entry = report_entry_routine(rpt_xref_routines); 1122: report_entry_tree = report_entry_routine(rpt_tree_routines); 1123: report_end_tree = report_end_routine(rpt_tree_routines); 1124: report_end = report_end_routine(rpt_xref_routines); 1125: 1126: if ((rptfile = fopen(aFileName, "w")) == NULL) { 1127: printf("ERROR: Unable to open %s for report output\n", aFileName); 1128: } 1129: else { 1130: if (list_enabled()) { 1131: fprintf(list_file(), 1132: "\nREPORT Caller cross references in file %s\n", 1133: aFileName); 1134: } 1135: if (log_enabled()) { 1136: printf("REPORT Caller cross references in file %s\n", aFileName); 1137: } 1138: (*report_hdr)(rptfile); /* Write header. */ 1139: for (total = 0, curdef = list_first(global_deflist()); 1140: curdef != NULL; 1141: curdef = next_entry(curdef)) { 1142: if (rpt_html_enabled() && def_xreffile(curdef) != xreffile) { 1143: xreffile = rpt_html_continue(&rptfile, CALLER_XREF_SECTION, 1144: curdef, xreffile, def_xreffile(curdef)); 1145: } 1146: /* Write entry line. */ 1147: if (trace_rpt_enabled()) { 1148: printf("TRACE: Report caller xref for routine %s @ %lxh\n", 1149: def_name(curdef), curdef); 1150: } 1151: (*report_entry)(rptfile, curdef, !total, isend_of_list(curdef)); 1152: 1153: if (def_num_calls(curdef) != 0) { 1154: 1155: /******* The following code adapted from report_call_trees ********/ 1156: 1157: curref = new_ref(0, curdef, NULL); 1158: if (trace_rpt_enabled()) { 1159: printf("TRACE: Report call tree for routine %s @ %lxh\n", 1160: def_name(curdef), curdef); 1161: } 1162: (*report_entry_tree)(rptfile, curref, 0, 0); 1163: free_ref(curref); 1164: 1165: /*+ */ 1166: /* Generate the subtree. Create a temporary def to serve as */ 1167: /* the tree root and set its tree root to the current */ 1168: /* definition as a context value. This is used in detection */ 1169: /* of duplicate and recursive expansions. Use the ref list */ 1170: /* of this tree to build a stack of caller refs. Push a ref */ 1171: /* for the current routine to this stack, reflecting the */ 1172: /* fact that it is the first caller, then report the tree. */ 1173: /* Then pop the reference and free the root definition. */ 1174: /*- */ 1175: 1176: treedef = new_def(def_name(curdef), def_source(curdef)); 1177: set_def_root(treedef, curdef); 1178: push_ref(treedef, new_ref(0, curdef, NULL)); 1179: report_tree(rptfile, report_entry_tree, curdef, 1, treedef); 1180: free_ref(pop_ref(treedef)); 1181: free_def(treedef); 1182: /* Write trailer section. */ 1183: (*report_end_tree)(rptfile, curdef, (total == 0), 1); 1184: 1185: /****** The preceding code adapted from report_call_trees *********/ 1186: 1187: } 1188: total++; 1189: } 1190: (*report_end)(rptfile, total); /* Write trailer. */ 1191: fclose(rptfile); 1192: if (list_enabled()) { 1193: fprintf(list_file(), " %ld Routines\n", total); 1194: } 1195: if (log_full_enabled()) { 1196: printf(" %ld Routines\n\n", total); 1197: } 1198: } 1199: }END report_xrefs. Go to: Beginning of routine.
1200: 1201: /*************************************************************************++*/
1202: void report_tree( 1203: /* Recursively reports one line for each routine in the call tree. The */ 1204: /* recursion is depth first (i.e. expanding each referenced routine before */ 1205: /* showing the next at the same level). The recursion nesting level */ 1206: /* controls indentation of the called routine names. */ 1207: 1208: FILE *aRptFile, 1209: /* (READ, BY ADDR): */ 1210: /* Report output file. Must be opened by caller. */ 1211: 1212: void (*aReportEntry)(), 1213: /* (EXEC, BY ADDR): */ 1214: /* Report line formatter routine. */ 1215: 1216: DEFINITION 1217: *aDef, 1218: /* (MODIFY, BY ADDR): */ 1219: /* Routine definition entry to report. The tree root for the */ 1220: /* definition will be set to aTreeRoot. */ 1221: 1222: int vLevel, 1223: /* (READ, BY VAL): */ 1224: /* Recursion nesting level. Level 0 is the top level. */ 1225: 1226: DEFINITION 1227: *aTreeRoot 1228: /* (MODIFY, BY ADDR): */ 1229: /* Routine definition entry that acts as root of this call */ 1230: /* tree. References to the routines in the call tree will be */ 1231: /* added to this definition. Its root field is used as the */ 1232: /* context value for this tree expansion. */ 1233: 1234: ) /* No return value. */ 1235: /*****************************************************************--*/ 1236: 1237: { 1238: REFERENCE /* Current reference entry. */ 1239: *called; 1240: DEFINITION /* Definition for current */ 1241: *curdef; /* reference entry. */ 1242: int expanded; /* Flag indicating routine */ 1243: /* has already been reported. */ 1244: int recursive; /* Flag indicating routine is */ 1245: /* called recursively. */ 1246: char errmsg[256]; /* Error message buffer. */ 1247: 1248: /*+ */ 1249: /* For each referenced routine, report the routine. If the routine has */ 1250: /* not already been expanded in this tree, is defined, and does not */ 1251: /* have a separate tree (and we have not exceeded max tree depth), */ 1252: /* generate its subtree recursively. */ 1253: /*- */ 1254: 1255: for (called = list_first(def_refs(aDef)); 1256: called != NULL; called = next_entry(called)) { 1257: 1258: /* Get current def ptr and find */ 1259: /* out expanded/recursive */ 1260: curdef = ref_definition(called); /* conditions. */ 1261: recursive = isrecursive_ref(called, aTreeRoot); 1262: expanded = (!recursive && !needs_tree(curdef) && 1263: isalready_expanded(curdef, def_root(aTreeRoot))); 1264: 1265: (*aReportEntry)(aRptFile, called, vLevel, expanded, recursive); 1266: 1267: /* Mark def as part of tree. */ 1268: set_def_root(curdef, def_root(aTreeRoot)); 1269: 1270: if (!expanded && !recursive && 1271: isdefined_routine(curdef) && !needs_tree(curdef)) { 1272: if (vLevel < max_tree_depth()) { 1273: 1274: /*+ */ 1275: /* A subtree needs to be generated. Push a reference to */ 1276: /* the current routine to the call stack for recursion */ 1277: /* detection at lower levels, do the lower level subtree, */ 1278: /* and discard the added reference. */ 1279: /*- */ 1280: 1281: push_ref(aTreeRoot, new_ref(0, curdef, NULL)); 1282: report_tree(aRptFile, aReportEntry, curdef, vLevel + 1, 1283: aTreeRoot); 1284: free_ref(pop_ref(aTreeRoot)); 1285: } 1286: else if (vLevel == MAX_TREE_DEPTH) { 1287: sprintf(errmsg, 1288: "\nWARNING: %s tree depth exceeds %d levels, halting expansion\n", 1289: def_name(aTreeRoot), MAX_TREE_DEPTH); 1290: fputs(errmsg, aRptFile); 1291: if (list_enabled()) { 1292: fputs(errmsg, list_file()); 1293: } 1294: puts(errmsg); 1295: break; 1296: } 1297: } 1298: } 1299: }END report_tree. Go to: Beginning of routine.
1300: 1301: #if 0 1302: /*************************************************************************++*/ 1303: void report_call_trees( 1304: /* Reports the call trees for the defined routines in alphabetical order to */ 1305: /* a file. The report attempts to minimize the number of trivial trees */ 1306: /* generated and maximize tree depth, while limiting the amount of */ 1307: /* repetitive subtree expansion. To meet this goal, a separate call tree */ 1308: /* will not be generated in the following cases: */ 1309: /* */ 1310: /* 1) a routine that calls no other routines (this eliminates empty */ 1311: /* call trees); */ 1312: /* */ 1313: /* 2) a routine that calls one or more other routines, but is called */ 1314: /* from only 1-x other routines, where x is a user-settable limit */ 1315: /* (this eliminates low-usage routines that can be better shown */ 1316: /* as subtrees of their callers); */ 1317: /* */ 1318: /* 3) a routine that is called from more than x other routines, but */ 1319: /* that has a total tree expansion of only 1-4 nodes (this */ 1320: /* eliminates very simple call trees that can be easily shown as */ 1321: /* subtrees of their callers). */ 1322: /* */ 1323: /* In these cases, any call relationships will be shown in the call trees */ 1324: /* of any caller. There is one special exception to cases 2 and 3, where a */ 1325: /* routine is multiply-defined. This indicates multiple, alternate */ 1326: /* implementations of the same routine, possibly with different call */ 1327: /* structures. Until the product is linked, it cannot be determined which */ 1328: /* version of the routine will be called; therefore a separate tree will be */ 1329: /* generated for each version of the routine. */ 1330: /* */ 1331: /* In all other cases, a separate call tree will be generated for a */ 1332: /* routine. Specifically, this means routines that are not called from any */ 1333: /* other, and frequently-used routines with complex call trees. There are */ 1334: /* also two user-selectable overrides to this behavior. The "separate" */ 1335: /* option allows the user to specify a file containing a list of routine */ 1336: /* names for which separate trees must be generated if they call anything. */ 1337: /* The "noinline" option forces separate trees for all routines that call */ 1338: /* anything. */ 1339: 1340: char *aFileName 1341: /* (READ, BY ADDR): */ 1342: /* Report output file name. */ 1343: 1344: ) /* No return value. */ 1345: /*****************************************************************--*/ 1346: 1347: { 1348: void (*report_hdr)(); /* Ptr to section header */ 1349: /* routine. */ 1350: void (*report_entry)(); /* Ptr to report line routine. */ 1351: void (*report_end)(); /* Ptr to section end routine. */ 1352: FILE *rptfile; /* Report file ptr. */ 1353: DEFINITION /* Current routine entry. */ 1354: *curdef; 1355: DEFINITION /* Temporary def to hold call */ 1356: *treedef; /* tree. */ 1357: int lastdef; /* Flag indicating last def */ 1358: /* with separate call tree. */ 1359: REFERENCE /* Temporary ref to current */ 1360: *curref; /* definition. */ 1361: long total; /* Total defined routines. */ 1362: int treefile = 0; /* Tree report file number. */ 1363: 1364: /*+ */ 1365: /* Select appropriate set of output formatter routines and open file. */ 1366: /* For each defined routine that warrants a separate call tree, write */ 1367: /* a header section. Then do a depth-first recursive traversal of the */ 1368: /* routine references and write a report line for each reference. */ 1369: /* Then write a trailer section for the defined routine. Last, close */ 1370: /* the file. */ 1371: /*- */ 1372: 1373: report_hdr = report_hdr_routine(rpt_tree_routines); 1374: report_entry = report_entry_routine(rpt_tree_routines); 1375: report_end = report_end_routine(rpt_tree_routines); 1376: 1377: if ((rptfile = fopen(aFileName, "w")) == NULL) { 1378: printf("ERROR: Unable to open %s for report output\n", aFileName); 1379: } 1380: else { 1381: if (list_enabled()) { 1382: fprintf(list_file(), 1383: "\nREPORT Defined routine call trees in file %s\n", 1384: aFileName); 1385: } 1386: if (log_enabled()) { 1387: printf("REPORT Defined routine call trees in file %s\n", 1388: aFileName); 1389: } 1390: for (total = 0, curdef = list_first(global_deflist()); curdef != NULL; 1391: curdef = next_entry(curdef)) { 1392: if (needs_tree(curdef)) { /* If routine needs tree, write */ 1393: /* header section and toplevel */ 1394: /* line. */ 1395: if (rpt_html_enabled() && def_treefile(curdef) != treefile) { 1396: treefile = rpt_html_continue(&rptfile, CALL_TREE_SECTION, 1397: curdef, treefile, def_treefile(curdef)); 1398: } 1399: lastdef = islast_tree(curdef); 1400: (*report_hdr)(rptfile, curdef, (total == 0), lastdef); 1401: curref = new_ref(0, curdef, NULL); 1402: if (trace_rpt_enabled()) { 1403: printf("TRACE: Report call tree for routine %s @ %lxh\n", 1404: def_name(curdef), curdef); 1405: } 1406: (*report_entry)(rptfile, curref, 0, 0); 1407: free_ref(curref); 1408: 1409: /*+ */ 1410: /* Generate the subtree. Create a temporary def to serve as */ 1411: /* the tree root and set its tree root to the current */ 1412: /* definition as a context value. This is used in detection */ 1413: /* of duplicate and recursive expansions. Use the ref list */ 1414: /* of this tree to build a stack of caller refs. Push a ref */ 1415: /* for the current routine to this stack, reflecting the */ 1416: /* fact that it is the first caller, then report the tree. */ 1417: /* Then pop the reference and free the root definition. */ 1418: /*- */ 1419: 1420: treedef = new_def(def_name(curdef), def_source(curdef)); 1421: set_def_root(treedef, curdef); 1422: push_ref(treedef, new_ref(0, curdef, NULL)); 1423: report_tree(rptfile, report_entry, curdef, 1, treedef); 1424: free_ref(pop_ref(treedef)); 1425: free_def(treedef); 1426: /* Write trailer section. */ 1427: (*report_end)(rptfile, curdef, (total == 0), lastdef); 1428: total++; 1429: } 1430: else if (trace_rpt_enabled()) { 1431: printf("TRACE: Report call tree, skipping routine %s @ %lxh\n", 1432: def_name(curdef), curdef); 1433: } 1434: 1435: } 1436: fclose(rptfile); 1437: if (list_enabled()) { 1438: fprintf(list_file(), " %ld Trees generated\n", total); 1439: } 1440: if (log_full_enabled()) { 1441: printf(" %ld Trees generated\n\n", total); 1442: } 1443: } 1444: } 1445: #endif 1446: 1447: /*************************************************************************++*/
1448: void report_by_file( 1449: /* Reports the defined routines in the order in which they occurred in the */ 1450: /* source files to a file. The files themselves are ordered alphabetically. */ 1451: /* Since this report is driven by the list of defined routines, if a file */ 1452: /* contains no routine definitions, it will not be reported here. */ 1453: 1454: char *aFileName 1455: /* (READ, BY ADDR): */ 1456: /* Report output file name. */ 1457: 1458: ) /* No return value. */ 1459: /*****************************************************************--*/ 1460: 1461: { 1462: void (*report_hdr)(); /* Ptr to section header */ 1463: /* routine. */ 1464: void (*report_entry)(); /* Ptr to report line routine. */ 1465: void (*report_end)(); /* Ptr to section end routine. */ 1466: FILE *rptfile; /* Report file ptr. */ 1467: DEFINITION /* Current routine entry. */ 1468: *curdef; 1469: SOURCEFILE /* Current file entry. */ 1470: *curfile; 1471: long total; /* Total defined routines. */ 1472: int totfiles; /* Total number of files. */ 1473: int lastfile; /* Flag indicating last file */ 1474: /* with defs. */ 1475: int byfilefile = 0; /* By-file report file number. */ 1476: 1477: /*+ */ 1478: /* Select appropriate set of output formatter routines and open file. */ 1479: /* For each source file, write a header section. For each routine in */ 1480: /* that file, write a report list. Then write a trailer section for */ 1481: /* the file. Last, close the file. */ 1482: /*- */ 1483: 1484: report_hdr = report_hdr_routine(rpt_byfile_routines); 1485: report_entry = report_entry_routine(rpt_byfile_routines); 1486: report_end = report_end_routine(rpt_byfile_routines); 1487: 1488: if ((rptfile = fopen(aFileName, "w")) == NULL) { 1489: printf("ERROR: Unable to open %s for report output\n", aFileName); 1490: } 1491: else { 1492: if (list_enabled()) { 1493: fprintf(list_file(), 1494: "\nREPORT Routines by source file in file %s\n", 1495: aFileName); 1496: } 1497: if (log_enabled()) { 1498: printf("REPORT Routines by source file in file %s\n", aFileName); 1499: } 1500: /* Skip past undefined */ 1501: /* routines. */ 1502: for (curdef = list_first(global_deflist()); 1503: curdef != NULL && !isdefined_routine(curdef); 1504: curdef = next_entry(curdef)) { 1505: if (trace_rpt_enabled()) { 1506: printf( 1507: "TRACE: Report file, skipping external routine %s @ %lxh\n", 1508: def_name(curdef), curdef); 1509: } 1510: } 1511: /* Report each file's routines. */ 1512: for (total = totfiles = 0, 1513: curdef != NULL ? curfile = def_source(curdef) : NULL; 1514: curdef != NULL; 1515: curdef != NULL ? curfile = def_source(curdef) : NULL) { 1516: lastfile = islast_defining_file(curfile); 1517: 1518: if (rpt_html_enabled() 1519: && source_byfilefile(curfile) != byfilefile) { 1520: byfilefile = rpt_html_continue(&rptfile, 1521: ROUTINES_BY_FILE_SECTION, curfile, byfilefile, 1522: source_byfilefile(curfile)); 1523: } 1524: /* Write header section. */ 1525: (*report_hdr)(rptfile, curfile, (totfiles == 0), lastfile); 1526: if (trace_rpt_enabled()) { 1527: printf("TRACE: Report routines in file %s @ %lxh\n", 1528: source_name(curfile), curfile); 1529: } 1530: do { 1531: /* Write entry line. */ 1532: if (trace_rpt_enabled()) { 1533: printf("TRACE: Report file %s routine %s @ %lxh\n", 1534: source_name(def_source(curdef)), def_name(curdef), 1535: curdef); 1536: } 1537: (*report_entry)(rptfile, curdef, isfirst_in_file(curdef), 1538: islast_in_file(curdef)); 1539: total++; 1540: curdef = next_entry(curdef); 1541: } while (curdef != NULL && def_source(curdef) == curfile); 1542: 1543: /* Write trailer section. */ 1544: (*report_end)(rptfile, curfile, (totfiles == 0), lastfile); 1545: totfiles++; 1546: } 1547: fclose(rptfile); 1548: if (list_enabled()) { 1549: fprintf(list_file(), " %ld Defined routines in %d files\n", 1550: total, totfiles); 1551: } 1552: if (log_full_enabled()) { 1553: printf(" %ld Defined routines in %d files\n\n", total, 1554: totfiles); 1555: } 1556: } 1557: }END report_by_file. Go to: Beginning of routine.
1558: 1559: /*************************************************************************++*/
1560: void report_files( 1561: /* Reports the source files in alphabetical order to a file. */ 1562: 1563: char *aFileName 1564: /* (READ, BY ADDR): */ 1565: /* Report output file name. */ 1566: 1567: ) /* No return value. */ 1568: /*****************************************************************--*/ 1569: 1570: { 1571: void (*report_hdr)(); /* Ptr to report header */ 1572: /* routine. */ 1573: void (*report_entry)(); /* Ptr to report line routine. */ 1574: void (*report_end)(); /* Ptr to report end routine. */ 1575: FILE *rptfile; /* Report file ptr. */ 1576: SOURCEFILE /* Current file entry. */ 1577: *curfile; 1578: int total; /* Total defined routines. */ 1579: 1580: /*+ */ 1581: /* Select appropriate set of output formatter routines. Open file and */ 1582: /* write a header section. For each source file, write a report line. */ 1583: /* Then write a trailer section and close the file. */ 1584: /*- */ 1585: 1586: report_hdr = report_hdr_routine(rpt_file_routines); 1587: report_entry = report_entry_routine(rpt_file_routines); 1588: report_end = report_end_routine(rpt_file_routines); 1589: 1590: if ((rptfile = fopen(aFileName, "w")) == NULL) { 1591: printf("ERROR: Unable to open %s for report output\n", aFileName); 1592: } 1593: else { 1594: if (list_enabled()) { 1595: fprintf(list_file(), 1596: "\nREPORT Source files in file %s\n", aFileName); 1597: } 1598: if (log_enabled()) { 1599: printf("REPORT Source files in file %s\n", aFileName); 1600: } 1601: 1602: (*report_hdr)(rptfile); /* Write header. */ 1603: for (total = 0, curfile = list_first(global_filelist()); 1604: curfile != NULL; 1605: curfile = next_entry(curfile)) { 1606: /* Write entry line. */ 1607: if (trace_rpt_enabled()) { 1608: printf("TRACE: Report source file %s @ %lxh\n", 1609: source_name(curfile), curfile); 1610: } 1611: (*report_entry)(rptfile, curfile, isbegin_of_list(curfile), 1612: isend_of_list(curfile)); 1613: total++; 1614: } 1615: (*report_end)(rptfile, total); /* Write trailer. */ 1616: fclose(rptfile); 1617: if (list_enabled()) { 1618: fprintf(list_file(), " %d files\n", total); 1619: } 1620: if (log_full_enabled()) { 1621: printf(" %d files\n\n", total); 1622: } 1623: } 1624: }END report_files. Go to: Beginning of routine.
1625: 1626: /*************************************************************************++*/
1627: void report_source( 1628: /* Reports annotated source files with line numbers. The sources are */ 1629: /* reported in separate files. */ 1630: 1631: char *aFileName 1632: /* (READ, BY ADDR): */ 1633: /* Report output file name format string. */ 1634: 1635: ) /* No return value. */ 1636: /*****************************************************************--*/ 1637: 1638: { 1639: void (*report_hdr)(); /* Ptr to section header */ 1640: /* routine. */ 1641: void (*report_entry)(); /* Ptr to report line routine. */ 1642: void (*report_end)(); /* Ptr to section end routine. */ 1643: char rptname[MAX_FILE_NAME + 1]; /* Report file name prefix. */ 1644: char outputname[MAX_FILE_NAME + 1]; /* Report file name buffer. */ 1645: char srcline[MAX_FILE_NAME * 2]; /* Source line buffer. */ 1646: FILE *rptfile; /* Report file ptr. */ 1647: FILE *srcfile; /* Source file ptr. */ 1648: DEFINITION /* Current routine entry. */ 1649: *curdef; 1650: SOURCEFILE /* Current file entry. */ 1651: *curfile; 1652: long line; /* Current line number in file. */ 1653: long total; /* Total source lines. */ 1654: int totfiles; /* Total number of files. */ 1655: 1656: /*+ */ 1657: /* Select appropriate set of output formatter routines. For each */ 1658: /* source file, open source and report files and write a header */ 1659: /* section. Write each line in the file, merging with the routine */ 1660: /* definitions. Then write a trailer section for the file and close */ 1661: /* the source and report files. */ 1662: /*- */ 1663: 1664: report_hdr = report_hdr_routine(rpt_source_routines); 1665: report_entry = report_entry_routine(rpt_source_routines); 1666: report_end = report_end_routine(rpt_source_routines); 1667: 1668: if (list_enabled()) { 1669: fputs("\nREPORT Annotated source files\n", list_file()); 1670: } 1671: if (log_enabled()) { 1672: puts("REPORT Annotated source files"); 1673: } 1674: /* Skip past undefined */ 1675: /* routines. */ 1676: for (curdef = list_first(global_deflist()); 1677: curdef != NULL && !isdefined_routine(curdef); 1678: curdef = next_entry(curdef)) { 1679: if (trace_rpt_enabled()) { 1680: printf( 1681: "TRACE: Report sources, skipping external routine %s @ %lxh\n", 1682: def_name(curdef), curdef); 1683: } 1684: } 1685: /* Report each file's contents. */ 1686: for (total = totfiles = 0, curfile = list_first(global_filelist()); 1687: curfile != NULL; curfile = next_entry(curfile)) { 1688: 1689: line = 0; 1690: sprintf(rptname, aFileName, source_seq(curfile)); 1691: if ((srcfile = fopen(source_name(curfile), "r")) == NULL) { 1692: printf("ERROR: Unable to open %s for input\n", 1693: source_name(curfile)); 1694: } 1695: else if ((rptfile = fopen(make_filename(outfile_prefix(), rptname, 1696: report_filext(), outputname), "w")) == NULL) { 1697: printf("ERROR: Unable to open %s for report output\n", rptname); 1698: } 1699: else { /* Write header section. */ 1700: (*report_hdr)(rptfile, curfile, (totfiles == 0), 1701: isend_of_list(curfile)); 1702: if (trace_rpt_enabled()) { 1703: printf("TRACE: Report annotated source in file %s @ %lxh\n", 1704: source_name(curfile), curfile); 1705: } 1706: /* Report lines through last */ 1707: /* routine defined in this */ 1708: /* file. */ 1709: while (curdef != NULL && def_source(curdef) == curfile) { 1710: while (line < def_end(curdef)) { 1711: /* Copy source line. */ 1712: fgets(srcline, sizeof(srcline), srcfile); 1713: (*report_entry)(rptfile, curdef, srcline, ++line, 1714: source_tabsize(curfile)); 1715: total++; 1716: } 1717: curdef = next_entry(curdef); 1718: } 1719: /* Report rest of file. */ 1720: while (fgets(srcline, sizeof(srcline), srcfile) != NULL) { 1721: (*report_entry)(rptfile, NULL, srcline, ++line, 1722: source_tabsize(curfile)); 1723: total++; 1724: } 1725: /* Write trailer section. */ 1726: (*report_end)(rptfile, curfile, (totfiles == 0), 1727: isend_of_list(curfile)); 1728: totfiles++; 1729: fclose(srcfile); 1730: fclose(rptfile); 1731: } 1732: } 1733: if (list_enabled()) { 1734: fprintf(list_file(), " %ld Lines in %d files\n", 1735: total, totfiles); 1736: } 1737: if (log_full_enabled()) { 1738: printf(" %ld Lines in %d files\n\n", total, totfiles); 1739: } 1740: }END report_source. Go to: Beginning of routine.
1741:
END OF FILE TOTAL: 108 routines, 12 Avg Length