Go to: Contents; Previous section; Beginning of section; Previous file in section.
Line Name
----- ----
216 rpt_calls_text_end
175 rpt_calls_text_entry
149 rpt_calls_text_hdr
69 rpt_defined_text_end
47 rpt_defined_text_entry
25 rpt_defined_text_hdr
387 rpt_tree_text_end
328 rpt_tree_text_entry
307 rpt_tree_text_hdr
129 rpt_undefined_text_end
109 rpt_undefined_text_entry
91 rpt_undefined_text_hdr
288 rpt_xref_text_end
257 rpt_xref_text_entry
239 rpt_xref_text_hdr
BEGINNING OF FILE
1: /****************************************************************************/
2: /* */
3: /* FACILITY: Routine Analyzer */
4: /* */
5: /* MODULE: Text Report Formatting Routines */
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 in plain text format. */
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 "ranalyzer.h"
23:
24: /*************************************************************************++*/
ROUTINE rpt_defined_text_hdr. Go to:
Next routine in file; Routines in this file.
25: void rpt_defined_text_hdr(
26: /* Writes plain text formatted report header for defined routines. */
27:
28: FILE *aRptFile
29: /* (READ, BY ADDR): */
30: /* Report output file. Must be opened by caller. */
31:
32: ) /* No return value. */
33: /*****************************************************************--*/
34:
35: {
36: fputs("Defined Routines Alphabetical\n", aRptFile);
37: fputs("-----------------------------\n", aRptFile);
38: fputs(
39: "Routine Defined In File Line Length Called Calls\n",
40: aRptFile);
41: fputs(
42: "------------------------- -------------------- ------ ------ ------ ------\n",
43: aRptFile);
44: }
END rpt_defined_text_hdr. Go to: Beginning of routine.
45:
46: /*************************************************************************++*/
ROUTINE rpt_defined_text_entry. Go to:
Next routine in file; Routines in this file.
47: void rpt_defined_text_entry(
48: /* Writes plain text formatted routine entry for a defined routine. */
49:
50: FILE *aRptFile,
51: /* (READ, BY ADDR): */
52: /* Report output file. Must be opened by caller. */
53:
54: DEFINITION
55: *aDef
56: /* (READ, BY ADDR): */
57: /* Routine definition entry to report. */
58:
59: ) /* No return value. */
60: /*****************************************************************--*/
61:
62: {
63: fprintf(aRptFile, "%25s %20s %6ld %6ld %6ld %6ld\n",
64: def_name(aDef), source_name(def_source(aDef)), def_begin(aDef),
65: def_length(aDef), def_num_calls(aDef), def_num_callers(aDef));
66: }
END rpt_defined_text_entry. Go to: Beginning of routine.
67:
68: /*************************************************************************++*/
ROUTINE rpt_defined_text_end. Go to:
Next routine in file; Routines in this file.
69: void rpt_defined_text_end(
70: /* Writes plain text formatted report end for defined routines. */
71:
72: FILE *aRptFile,
73: /* (READ, BY ADDR): */
74: /* Report output file. Must be opened by caller. */
75:
76: long vTotalDef
77: /* (READ, BY VAL): */
78: /* Total number of defined routines. */
79:
80: ) /* No return value. */
81: /*****************************************************************--*/
82:
83: {
84: fputs("\n", aRptFile);
85: fprintf(aRptFile,
86: "TOTAL ROUTINES: %6ld TOTAL DEF LINES: %6ld AVG LENGTH: %6ld\n",
87: vTotalDef, total_rlength(), total_avglen());
88: }
END rpt_defined_text_end. Go to: Beginning of routine.
89:
90: /*************************************************************************++*/
ROUTINE rpt_undefined_text_hdr. Go to:
Next routine in file; Routines in this file.
91: void rpt_undefined_text_hdr(
92: /* Writes plain text formatted report header for undefined routines. */
93:
94: FILE *aRptFile
95: /* (READ, BY ADDR): */
96: /* Report output file. Must be opened by caller. */
97:
98: ) /* No return value. */
99: /*****************************************************************--*/
100:
101: {
102: fputs("Undefined Routines Alphabetical\n", aRptFile);
103: fputs("-------------------------------\n", aRptFile);
104: fputs("Routine Called\n", aRptFile);
105: fputs("------------------------- ------\n", aRptFile);
106: }
END rpt_undefined_text_hdr. Go to: Beginning of routine.
107:
108: /*************************************************************************++*/
ROUTINE rpt_undefined_text_entry. Go to:
Next routine in file; Routines in this file.
109: void rpt_undefined_text_entry(
110: /* Writes plain text formatted routine entry for a undefined routine. */
111:
112: FILE *aRptFile,
113: /* (READ, BY ADDR): */
114: /* Report output file. Must be opened by caller. */
115:
116: DEFINITION
117: *aDef
118: /* (READ, BY ADDR): */
119: /* Routine definition entry to report. */
120:
121: ) /* No return value. */
122: /*****************************************************************--*/
123:
124: {
125: fprintf(aRptFile, "%25s %6ld\n", def_name(aDef), def_num_callers(aDef));
126: }
END rpt_undefined_text_entry. Go to: Beginning of routine.
127:
128: /*************************************************************************++*/
ROUTINE rpt_undefined_text_end. Go to:
Next routine in file; Routines in this file.
129: void rpt_undefined_text_end(
130: /* Writes plain text formatted report end for undefined routines. */
131:
132: FILE *aRptFile,
133: /* (READ, BY ADDR): */
134: /* Report output file. Must be opened by caller. */
135:
136: long vTotalUndef
137: /* (READ, BY VAL): */
138: /* Total number of undefined routines. */
139:
140: ) /* No return value. */
141: /*****************************************************************--*/
142:
143: {
144: fputs("\n", aRptFile);
145: fprintf(aRptFile, "TOTAL ROUTINES: %6ld\n", vTotalUndef);
146: }
END rpt_undefined_text_end. Go to: Beginning of routine.
147:
148: /*************************************************************************++*/
ROUTINE rpt_calls_text_hdr. Go to:
Next routine in file; Routines in this file.
149: void rpt_calls_text_hdr(
150: /* Writes plain text formatted report header for defined routine */
151: /* calls/callers table. */
152:
153: FILE *aRptFile,
154: /* (READ, BY ADDR): */
155: /* Report output file. Must be opened by caller. */
156:
157: DEFINITION
158: *aDef
159: /* (READ, BY ADDR): */
160: /* Routine definition entry to report. */
161:
162: ) /* No return value. */
163: /*****************************************************************--*/
164:
165: {
166: fprintf(aRptFile, "%s Calls/Caller Routines\n", def_name(aDef));
167: fputs("------------------------\n", aRptFile);
168: fputs("Calls Routine Line Caller Routine Line\n",
169: aRptFile);
170: fputs("------------------------- ------ -------------------- ------\n",
171: aRptFile);
172: }
END rpt_calls_text_hdr. Go to: Beginning of routine.
173:
174: /*************************************************************************++*/
ROUTINE rpt_calls_text_entry. Go to:
Next routine in file; Routines in this file.
175: void rpt_calls_text_entry(
176: /* Writes plain text formatted routine entry for a defined routine */
177: /* calls/caller entry. */
178:
179: FILE *aRptFile,
180: /* (READ, BY ADDR): */
181: /* Report output file. Must be opened by caller. */
182:
183: REFERENCE
184: *aCalled,
185: /* (READ, BY ADDR): */
186: /* Called routine reference entry to report. If NULL is passed, */
187: /* only a caller is being reported. */
188:
189: REFERENCE
190: *aCaller
191: /* (READ, BY ADDR): */
192: /* Caller routine reference entry to report. If NULL is passed, */
193: /* only a called routine is being reported. */
194:
195: ) /* No return value. */
196: /*****************************************************************--*/
197:
198: {
199: if (aCalled == NULL) {
200: fprintf(aRptFile, "%25c %6c ", ' ', ' ');
201: }
202: else {
203: fprintf(aRptFile, "%25s %6ld ", def_name(ref_definition(aCalled)),
204: ref_offset(aCalled));
205: }
206: if (aCaller == NULL) {
207: fprintf(aRptFile, "\n");
208: }
209: else {
210: fprintf(aRptFile, "%25s %6ld\n", def_name(ref_caller(aCaller)),
211: ref_offset(aCaller));
212: }
213: }
END rpt_calls_text_entry. Go to: Beginning of routine.
214:
215: /*************************************************************************++*/
ROUTINE rpt_calls_text_end. Go to:
Next routine in file; Routines in this file.
216: void rpt_calls_text_end(
217: /* Writes plain text formatted report end for defined routine calls/caller */
218: /* table. */
219:
220: FILE *aRptFile,
221: /* (READ, BY ADDR): */
222: /* Report output file. Must be opened by caller. */
223:
224: DEFINITION
225: *aDef
226: /* (READ, BY ADDR): */
227: /* Routine definition entry to report. */
228:
229: ) /* No return value. */
230: /*****************************************************************--*/
231:
232: {
233: fputs("\n", aRptFile);
234: fprintf(aRptFile, "TOTAL CALLS: %6ld ", def_num_calls(aDef));
235: fprintf(aRptFile, "TOTAL CALLERS: %6ld\n\n", def_num_callers(aDef));
236: }
END rpt_calls_text_end. Go to: Beginning of routine.
237:
238: /*************************************************************************++*/
ROUTINE rpt_xref_text_hdr. Go to:
Next routine in file; Routines in this file.
239: void rpt_xref_text_hdr(
240: /* Writes plain text-formatted report header for cross reference. */
241:
242: FILE *aRptFile
243: /* (READ, BY ADDR): */
244: /* Report output file. Must be opened by caller. */
245:
246: ) /* No return value. */
247: /*****************************************************************--*/
248:
249: {
250: fputs("Caller Cross-Reference\n", aRptFile);
251: fputs("----------------------\n", aRptFile);
252: fputs("Routine Callers\n", aRptFile);
253: fputs("--------------------------- -----------------------\n", aRptFile);
254: }
END rpt_xref_text_hdr. Go to: Beginning of routine.
255:
256: /*************************************************************************++*/
ROUTINE rpt_xref_text_entry. Go to:
Next routine in file; Routines in this file.
257: void rpt_xref_text_entry(
258: /* Writes plain text-formatted cross-reference sections for a routine. */
259:
260: FILE *aRptFile,
261: /* (READ, BY ADDR): */
262: /* Report output file. Must be opened by caller. */
263:
264: DEFINITION
265: *aDef
266: /* (READ, BY ADDR): */
267: /* Routine definition entry to report. */
268:
269: ) /* No return value. */
270: /*****************************************************************--*/
271:
272: {
273: REFERENCE /* Current caller ref. */
274: *caller;
275: /* Write section header. */
276: fprintf(aRptFile, "%25s Total callers: %ld\n", def_name(aDef),
277: def_num_callers(aDef));
278:
279: /* Write entry for each caller. */
280: for (caller = list_first(def_callers(aDef));
281: caller != NULL;
282: caller = next_entry(caller)) {
283: fprintf(aRptFile, "%25c %s\n", ' ', def_name(ref_caller(caller)));
284: }
285: }
END rpt_xref_text_entry. Go to: Beginning of routine.
286:
287: /*************************************************************************++*/
ROUTINE rpt_xref_text_end. Go to:
Next routine in file; Routines in this file.
288: void rpt_xref_text_end(
289: /* Writes plain text-formatted report end for caller cross-reference. */
290:
291: FILE *aRptFile,
292: /* (READ, BY ADDR): */
293: /* Report output file. Must be opened by caller. */
294:
295: long vTotalDef
296: /* (READ, BY VAL): */
297: /* Total number of routines. */
298:
299: ) /* No return value. */
300: /*****************************************************************--*/
301:
302: {
303: fprintf(aRptFile, "\nTOTAL ROUTINES: %ld\n", vTotalDef);
304: }
END rpt_xref_text_end. Go to: Beginning of routine.
305:
306: /*************************************************************************++*/
ROUTINE rpt_tree_text_hdr. Go to:
Next routine in file; Routines in this file.
307: void rpt_tree_text_hdr(
308: /* Writes plain text formatted report header for defined routine call tree. */
309:
310: FILE *aRptFile,
311: /* (READ, BY ADDR): */
312: /* Report output file. Must be opened by caller. */
313:
314: DEFINITION
315: *aDef
316: /* (READ, BY ADDR): */
317: /* Routine definition entry to report. */
318:
319: ) /* No return value. */
320: /*****************************************************************--*/
321:
322: {
323: fprintf(aRptFile, "%25s - Call Tree\n", def_ident(aDef));
324: fprintf(aRptFile, "%25c - %25c - ---------\n", '-', '-');
325: }
END rpt_tree_text_hdr. Go to: Beginning of routine.
326:
327: /*************************************************************************++*/
ROUTINE rpt_tree_text_entry. Go to:
Next routine in file; Routines in this file.
328: void rpt_tree_text_entry(
329: /* Writes plain text formatted call tree line for a defined routine. */
330:
331: FILE *aRptFile,
332: /* (READ, BY ADDR): */
333: /* Report output file. Must be opened by caller. */
334:
335: REFERENCE
336: *aRef,
337: /* (READ, BY ADDR): */
338: /* Reference to routine definition entry to report. */
339:
340: int vLevel,
341: /* (READ, BY VAL): */
342: /* Nesting level, used to space indentation. */
343:
344: int vExpanded,
345: /* (READ, BY VAL): */
346: /* Flag indicating whether or not routine has already been */
347: /* expanded in this call tree. */
348:
349: int vRecursive
350: /* (READ, BY VAL): */
351: /* Flag indicating whether or not routine is called */
352: /* recursively. */
353:
354: ) /* No return value. */
355: /*****************************************************************--*/
356:
357: {
358: int lcount; /* Level print count. */
359:
360: for (lcount = vLevel; lcount > 1; lcount--) {
361: fputs("| ", aRptFile);
362: }
363: if (lcount > 0) {
364: if (isend_of_list(aRef)) {
365: fputs("+ ", aRptFile);
366: }
367: else {
368: fputs("| ", aRptFile);
369: }
370: }
371: if (vLevel == 0) {
372: fprintf(aRptFile, "%s: %ld caller%s\n", def_name(ref_definition(aRef)),
373: def_num_callers(ref_definition(aRef)),
374: (def_num_callers(ref_definition(aRef)) == 1 ? "" : "s"));
375: }
376: else {
377: fprintf(aRptFile, "%s%s%s%s%s\n", def_name(ref_definition(aRef)),
378: (needs_tree(ref_definition(aRef)) &&
379: !tree_inline_disabled() ? " (Separate)" : ""),
380: (vExpanded ? " (Duplicate)" : ""),
381: (vRecursive ? " (Recursive)" : ""),
382: (isdefined_routine(ref_definition(aRef)) ? "" : " (External)"));
383: }
384: }
END rpt_tree_text_entry. Go to: Beginning of routine.
385:
386: /*************************************************************************++*/
ROUTINE rpt_tree_text_end. Go to:
Routines in this file.
387: void rpt_tree_text_end(
388: /* Writes plain text formatted section end for defined routine call tree. */
389:
390: FILE *aRptFile,
391: /* (READ, BY ADDR): */
392: /* Report output file. Must be opened by caller. */
393:
394: DEFINITION
395: *aDef
396: /* (READ, BY ADDR): */
397: /* Routine definition entry to report. */
398:
399: ) /* No return value. */
400: /*****************************************************************--*/
401:
402: {
403: fputs("END OF TREE\n", aRptFile);
404: }
END rpt_tree_text_end. Go to: Beginning of routine.
END OF FILE
TOTAL: 15 routines, 23 Avg Length
Go to: Contents; Previous section; Beginning of section; Previous file in section.