@Routine Analyzer Source File Analysis - rpttext.c6

rpttext.c Source Code

Go to: Contents; Previous section; Beginning of section; Previous file in section.

Q

Routines In This File (Alphabetical)



 Line Name
----- ----1  216 rpt_calls_text_end3  175 rpt_calls_text_entry1  149 rpt_calls_text_hdr3   69 rpt_defined_text_end5   47 rpt_defined_text_entry3   25 rpt_defined_text_hdr0  387 rpt_tree_text_end2  328 rpt_tree_text_entry0  307 rpt_tree_text_hdr5  129 rpt_undefined_text_end7  109 rpt_undefined_text_entry5   91 rpt_undefined_text_hdr0  288 rpt_xref_text_end2  257 rpt_xref_text_entry0  239 rpt_xref_text_hdr


BEGINNING OF FILE


V     1: /****************************************************************************/     2: /*									    */1     3: /*  FACILITY:	Routine Analyzer					    */     4: /*									    */=     5: /*  MODULE:	Text Report Formatting Routines				    */     6: /*									    */O     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */>     8: /*		Equipment Corporation, Littleton, MA, USA.		    */     9: /*									    */V    10: /*  DESCRIPTION: This module contains the routines for generating Routine   */<    11: /*  Analyzer reports in plain text format.				    */    12: /*									    */*    13: /*  REVISION HISTORY:							    */    14: /*									    */7    15: /*  V0.1-00 24-AUG-1994 Steve Branam					    */    16: /*									    */(    17: /*	Original version.						    */    18: /*									    */V    19: /****************************************************************************/    20:      21: #include <stdio.h>    22: #include "ranalyzer.h"    23: V    24: /*************************************************************************++*/

mROUTINE rpt_defined_text_hdr. Go to: mNext routine in file; Routines in this file.



"    25: void rpt_defined_text_hdr(Q    26: /* Writes plain text formatted report header for defined routines.	    */    27:     28:     FILE    *aRptFile,    29: 	    /* (READ, BY ADDR):						    */E    30: 	    /* Report output file. Must be opened by caller.		    */    31: )    32: )	/* No return value.						    */O    33: 	/*****************************************************************--*/    34: 	    35: {?    36:     fputs("Defined Routines Alphabetical\n", aRptFile);?    37:     fputs("-----------------------------\n", aRptFile);    38:     fputs(V    39: "Routine                   Defined In File      Line   Length Called Calls\n",    40: 	aRptFile);    41:     fputs(W    42: "------------------------- -------------------- ------ ------ ------ ------\n",    43: 	aRptFile);	    44: }
REND rpt_defined_text_hdr. Go to: Beginning of routine.





    45: V    46: /*************************************************************************++*/

oROUTINE rpt_defined_text_entry. Go to: mNext routine in file; Routines in this file.



$    47: void rpt_defined_text_entry(R    48: /* Writes plain text formatted routine entry for a defined routine.	    */    49:     50:     FILE    *aRptFile,,    51: 	    /* (READ, BY ADDR):						    */E    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.						    */O    60: 	/*****************************************************************--*/    61: 	    62: {@    63:     fprintf(aRptFile, "%25s %20s %6ld %6ld %6ld %6ld\n",H    64: 	def_name(aDef), source_name(def_source(aDef)), def_begin(aDef),G    65: 	def_length(aDef), def_num_calls(aDef), def_num_callers(aDef));	    66: }
TEND rpt_defined_text_entry. Go to: Beginning of routine.





    67: V    68: /*************************************************************************++*/

mROUTINE rpt_defined_text_end. Go to: mNext routine in file; Routines in this file.



"    69: void rpt_defined_text_end(O    70: /* Writes plain text formatted report end for defined routines.		    */    71:     72:     FILE    *aRptFile,,    73: 	    /* (READ, BY ADDR):						    */E    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.						    */O    81: 	/*****************************************************************--*/    82: 	    83: {"    84:     fputs("\n", aRptFile);    85:     fprintf(aRptFile,K    86: 	"TOTAL ROUTINES: %6ld   TOTAL DEF LINES: %6ld AVG LENGTH: %6ld\n",5    87: 	vTotalDef, total_rlength(), total_avglen());	    88: }
REND rpt_defined_text_end. Go to: Beginning of routine.





    89: V    90: /*************************************************************************++*/

oROUTINE rpt_undefined_text_hdr. Go to: mNext routine in file; Routines in this file.



$    91: void rpt_undefined_text_hdr(S    92: /* Writes plain text formatted report header for undefined routines.	    */    93:     94:     FILE    *aRptFile,    95: 	    /* (READ, BY ADDR):						    */E    96: 	    /* Report output file. Must be opened by caller.		    */    97: )    98: )	/* No return value.						    */O    99: 	/*****************************************************************--*/   100: 	   101: {A   102:     fputs("Undefined Routines Alphabetical\n", aRptFile);A   103:     fputs("-------------------------------\n", aRptFile);B   104:     fputs("Routine                   Called\n", aRptFile);B   105:     fputs("------------------------- ------\n", aRptFile);	   106: }
TEND rpt_undefined_text_hdr. Go to: Beginning of routine.





   107: V   108: /*************************************************************************++*/

qROUTINE rpt_undefined_text_entry. Go to: mNext routine in file; Routines in this file.



&   109: void rpt_undefined_text_entry(T   110: /* Writes plain text formatted routine entry for a undefined routine.	    */   111:    112:     FILE    *aRptFile,,   113: 	    /* (READ, BY ADDR):						    */E   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.						    */rO   122: 	/*****************************************************************--*/<   123: 	   124: {eT   125:     fprintf(aRptFile, "%25s %6ld\n", def_name(aDef), def_num_callers(aDef));	   126: }A
VEND rpt_undefined_text_entry. Go to: Beginning of routine.





s   127: V   128: /*************************************************************************++*/

oROUTINE rpt_undefined_text_end. Go to: tmNext routine in file; Routines in this file.

n

_$   129: void rpt_undefined_text_end(P   130: /* Writes plain text formatted report end for undefined routines.	    */   131:    132:     FILE    *aRptFile,,   133: 	    /* (READ, BY ADDR):						    */E   134: 	    /* Report output file. Must be opened by caller.		    */A   135:    136:     long    vTotalUndefA+   137: 	    /* (READ, BY VAL):						    */t<   138: 	    /* Total number of undefined routines.			    */   139: )   140: )	/* No return value.						    */dO   141: 	/*****************************************************************--*/0   142: 	   143: {/"   144:     fputs("\n", aRptFile);E   145:     fprintf(aRptFile, "TOTAL ROUTINES: %6ld\n", vTotalUndef);*	   146: }*
TEND rpt_undefined_text_end. Go to: Beginning of routine.





*   147: V   148: /*************************************************************************++*/

kROUTINE rpt_calls_text_hdr. Go to: qmNext routine in file; Routines in this file.

u

a    149: void rpt_calls_text_hdr(O   150: /* Writes plain text formatted report header for defined routine	    */ ,   151: /* calls/callers table.							    */   152:    153:     FILE    *aRptFile,,   154: 	    /* (READ, BY ADDR):						    */E   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.						    */ O   163: 	/*****************************************************************--*//   164: 	   165: {=L   166:     fprintf(aRptFile, "%s Calls/Caller Routines\n", def_name(aDef));:   167:     fputs("------------------------\n", aRptFile);Q   168:     fputs("Calls Routine             Line   Caller Routine       Line\n",   169: 	aRptFile);fS   170:     fputs("------------------------- ------ -------------------- ------\n",i   171: 	aRptFile); 	   172: } 
PEND rpt_calls_text_hdr. Go to: Beginning of routine.





    173: V   174: /*************************************************************************++*/

mROUTINE rpt_calls_text_entry. Go to: RmNext routine in file; Routines in this file.



t"   175: void rpt_calls_text_entry(Q   176: /* Writes plain text formatted routine entry for a defined routine	    */1+   177: /* calls/caller entry.							    */-   178:    179:     FILE    *aRptFile,,   180: 	    /* (READ, BY ADDR):						    */E   181: 	    /* Report output file. Must be opened by caller.		    */n   182:    183:     REFERENCEE   184: 	    *aCalled,,   185: 	    /* (READ, BY ADDR):						    */O   186: 	    /* Called routine reference entry to report. If NULL is passed, */E:   187: 	    /* only a caller is being reported.				    */   188:        189:     REFERENCEN   190: 	    *aCaller;,   191: 	    /* (READ, BY ADDR):						    */O   192: 	    /* Caller routine reference entry to report. If NULL is passed, */eA   193: 	    /* only a called routine is being reported.			    */   194:     )   195: )	/* No return value.						    */ O   196: 	/*****************************************************************--*/b   197: 	   198: { "   199:     if (aCalled == NULL) {2   200: 	fprintf(aRptFile, "%25c %6c ", ' ', ' ');
   201:     }7   202:     else {K   203: 	fprintf(aRptFile, "%25s %6ld ", def_name(ref_definition(aCalled)),e"   204: 	    ref_offset(aCalled));
   205:     }*"   206:     if (aCaller == NULL) {!   207: 	fprintf(aRptFile, "\n"); 
   208:     }(   209:     else {H   210: 	fprintf(aRptFile, "%25s %6ld\n", def_name(ref_caller(aCaller)),"   211: 	    ref_offset(aCaller));
   212:     },	   213: }l
REND rpt_calls_text_entry. Go to: Beginning of routine.





5   214: V   215: /*************************************************************************++*/

kROUTINE rpt_calls_text_end. Go to: .mNext routine in file; Routines in this file.

u

n    216: void rpt_calls_text_end(V   217: /* Writes plain text formatted report end for defined routine calls/caller  */   218: /* table.								    */n   219:    220:     FILE    *aRptFile,,   221: 	    /* (READ, BY ADDR):						    */E   222: 	    /* Report output file. Must be opened by caller.		    */l   223:    224:     DEFINITION   225: 	    *aDef,   226: 	    /* (READ, BY ADDR):						    */<   227: 	    /* Routine definition entry to report.			    */   228:     )   229: )	/* No return value.						    */ O   230: 	/*****************************************************************--*/    231: 	   232: { "   233:     fputs("\n", aRptFile);N   234:     fprintf(aRptFile, "TOTAL CALLS: %6ld      ", def_num_calls(aDef));P   235:     fprintf(aRptFile, "TOTAL CALLERS: %6ld\n\n", def_num_callers(aDef));	   236: }
PEND rpt_calls_text_end. Go to: Beginning of routine.





   237: V   238: /*************************************************************************++*/

jROUTINE rpt_xref_text_hdr. Go to: mNext routine in file; Routines in this file.

A

   239: void rpt_xref_text_hdr(dP   240: /* Writes plain text-formatted report header for cross reference.	    */   241:    242:     FILE    *aRptFileE,   243: 	    /* (READ, BY ADDR):						    */E   244: 	    /* Report output file. Must be opened by caller.		    */a   245: )   246: )	/* No return value.						    */eO   247: 	/*****************************************************************--*/*   248: 	   249: {08   250:     fputs("Caller Cross-Reference\n", aRptFile);8   251:     fputs("----------------------\n", aRptFile);E   252:     fputs("Routine                     Callers\n", aRptFile); U   253:     fputs("--------------------------- -----------------------\n", aRptFile); 	   254: }
OEND rpt_xref_text_hdr. Go to: Beginning of routine.

r



>   255: V   256: /*************************************************************************++*/

lROUTINE rpt_xref_text_entry. Go to: mNext routine in file; Routines in this file.

i

f!   257: void rpt_xref_text_entry(rU   258: /* Writes plain text-formatted cross-reference sections for a routine.	    */d   259:    260:     FILE    *aRptFile,,   261: 	    /* (READ, BY ADDR):						    */E   262: 	    /* Report output file. Must be opened by caller.		    */n   263:    264:     DEFINITION   265: 	    *aDef,   266: 	    /* (READ, BY ADDR):						    */<   267: 	    /* Routine definition entry to report.			    */   268:     )   269: )	/* No return value.						    */uO   270: 	/*****************************************************************--*/*   271: 	   272: {<:   273:     REFERENCE				    /* Current caller ref.	    */   274: 	    *caller;,0   275: 					    /* Write section header.	    */K   276:     fprintf(aRptFile, "%25s  Total callers: %ld\n", def_name(aDef),>    277: 	def_num_callers(aDef));   278: 3   279: 					    /* Write entry for each caller. */*8   280:     for (caller = list_first(def_callers(aDef));   281: 	caller != NULL;'   282: 	caller = next_entry(caller)) {tK   283: 	fprintf(aRptFile, "%25c %s\n", ' ', def_name(ref_caller(caller)));r
   284:     }_	   285: }n
QEND rpt_xref_text_entry. Go to: Beginning of routine.

l



a   286: V   287: /*************************************************************************++*/

jROUTINE rpt_xref_text_end. Go to: mNext routine in file; Routines in this file.



e   288: void rpt_xref_text_end( T   289: /* Writes plain text-formatted report end for caller cross-reference.	    */   290:    291:     FILE    *aRptFile,,   292: 	    /* (READ, BY ADDR):						    */E   293: 	    /* Report output file. Must be opened by caller.		    */n   294:    295:     long    vTotalDefi+   296: 	    /* (READ, BY VAL):						    */i3   297: 	    /* Total number of routines.				    */1   298: )   299: )	/* No return value.						    */*O   300: 	/*****************************************************************--*/=   301: 	   302: {tD   303:     fprintf(aRptFile, "\nTOTAL ROUTINES: %ld\n", vTotalDef);	   304: } 
OEND rpt_xref_text_end. Go to: Beginning of routine.

1



c   305: V   306: /*************************************************************************++*/

jROUTINE rpt_tree_text_hdr. Go to: mNext routine in file; Routines in this file.

I

   307: void rpt_tree_text_hdr(/V   308: /* Writes plain text formatted report header for defined routine call tree. */   309:    310:     FILE    *aRptFile,,   311: 	    /* (READ, BY ADDR):						    */E   312: 	    /* Report output file. Must be opened by caller.		    */1   313:    314:     DEFINITION   315: 	    *aDef,   316: 	    /* (READ, BY ADDR):						    */<   317: 	    /* Routine definition entry to report.			    */   318:     )   319: )	/* No return value.						    */LO   320: 	/*****************************************************************--*/-   321: 	   322: {-E   323:     fprintf(aRptFile, "%25s - Call Tree\n", def_ident(aDef));eE   324:     fprintf(aRptFile, "%25c - %25c - ---------\n", '-', '-');	   325: }1
OEND rpt_tree_text_hdr. Go to: Beginning of routine.

+



>   326: V   327: /*************************************************************************++*/

lROUTINE rpt_tree_text_entry. Go to: mNext routine in file; Routines in this file.

f

u!   328: void rpt_tree_text_entry(eS   329: /* Writes plain text formatted call tree line for a defined routine.	    */A   330:    331:     FILE    *aRptFile,,   332: 	    /* (READ, BY ADDR):						    */E   333: 	    /* Report output file. Must be opened by caller.		    */1   334:    335:     REFERENCE	   336: 	    *aRef,/,   337: 	    /* (READ, BY ADDR):						    */N   338: 	    /* Reference to routine definition entry to report.       	    */   339:    340:     int	    vLevel,+   341: 	    /* (READ, BY VAL):						    */,A   342: 	    /* Nesting level, used to space indentation.		    */t   343:    344:     int	    vExpanded,+   345: 	    /* (READ, BY VAL):						    */pN   346: 	    /* Flag indicating whether or not routine has already been	    */5   347: 	    /* expanded in this call tree.				    */*   348:    349:     int	    vRecursive+   350: 	    /* (READ, BY VAL):						    */ H   351: 	    /* Flag indicating whether or not routine is called		    */(   352: 	    /* recursively.						    */   353: )   354: )	/* No return value.						    */ O   355: 	/*****************************************************************--*/7   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)) {u%   365: 	    fputs("+   ", aRptFile); 
   366: 	}   367: 	else {*%   368: 	    fputs("|   ", aRptFile);*
   369: 	}
   370:     }   371:     if (vLevel == 0) {P   372: 	fprintf(aRptFile, "%s: %ld caller%s\n", def_name(ref_definition(aRef)),3   373: 	    def_num_callers(ref_definition(aRef)),rF   374: 	    (def_num_callers(ref_definition(aRef)) == 1 ? "" : "s"));
   375:     }x   376:     else {J   377: 	fprintf(aRptFile, "%s%s%s%s%s\n", def_name(ref_definition(aRef)),9   378: 	    (needs_tree(ref_definition(aRef)) &&E8   379: 		!tree_inline_disabled() ? " (Separate)" : ""),/   380: 	    (vExpanded ? " (Duplicate)" : ""),p0   381: 	    (vRecursive ? " (Recursive)" : ""),M   382: 	    (isdefined_routine(ref_definition(aRef)) ? "" : " (External)"));2
   383:     }t	   384: }i
QEND rpt_tree_text_entry. Go to: Beginning of routine.

2



*   385: V   386: /*************************************************************************++*/

jROUTINE rpt_tree_text_end. Go to: >Routines in this file.



6   387: void rpt_tree_text_end(eV   388: /* Writes plain text formatted section end for defined routine call tree.   */   389:    390:     FILE    *aRptFile,,   391: 	    /* (READ, BY ADDR):						    */E   392: 	    /* Report output file. Must be opened by caller.		    */t   393:    394:     DEFINITION   395: 	    *aDef,   396: 	    /* (READ, BY ADDR):						    */<   397: 	    /* Routine definition entry to report.			    */   398:     )   399: )	/* No return value.						    */lO   400: 	/*****************************************************************--*/    401: 	   402: {-   403:     fputs("END OF TREE\n", aRptFile); 	   404: }/
OEND rpt_tree_text_end. Go to: Beginning of routine.

n



 
END OF FILE*!TOTAL: 15 routines, 23 Avg Length*


Go to: Contents; Previous section; Beginning of section; Previous file in section.