ARoutine Analyzer Source File Analysis - listfile.c7

listfile.c Source Code

LGo to: Contents; Previous section; Beginning of section; Next file in section; Previous file in section.

Q

Routines In This File (Alphabetical)



 Line Name
----- ----5  184 list_analysis_complete(   42 list_char-  238 list_def_begin+  267 list_def_end.  104 list_file_begin,  131 list_file_end1  160 list_product_begin/  215 list_product_end'  300 list_ref,   24 new_list_line2   75 restore_list_column


BEGINNING OF FILE


V     1: /****************************************************************************/     2: /*									    */1     3: /*  FACILITY:	Routine Analyzer					    */     4: /*									    */3     5: /*  MODULE:	List File Management					    */     6: /*									    */O     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */>     8: /*		Equipment Corporation, Littleton, MA, USA.		    */     9: /*									    */R    10: /*  DESCRIPTION: This module contains list file management routines	    */-    11: /*  for Routine Analyzer.						    */    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 "ranalyzer.h"    22: V    23: /*************************************************************************++*/

fROUTINE new_list_line. Go to: mNext routine in file; Routines in this file.



    24: void new_list_line(9    25: /* Starts a new line in the list file.					    */    26:     27:     SOURCEFILE    28: 	    *aSourceRecord(    29: 		/* (READ, BY ADDR):					    */5    30: 		/* Source file information record.			    */    31: )    32: )	/* No return value.						    */O    33: 	/*****************************************************************--*/    34: 	    35: {!    36:     if (list_enabled()) {L    37: 	fprintf(list_file(), LIST_LINE_NUMBER, source_line(aSourceRecord));
    38:     }	    39: }
KEND new_list_line. Go to: Beginning of routine.





    40: V    41: /*************************************************************************++*/

bROUTINE list_char. Go to: mNext routine in file; Routines in this file.



    42: void list_char(V    43: /* Writes a character to the listing file and maintains the line character  */    44: /* count.								    */    45:     46:     char    vChar+    47: 	    /* (READ, BY VAL):						    */-    48: 	    /* Character to list.					    */    49: )    50: )	/* No return value.						    */O    51: 	/*****************************************************************--*/    52: 	    53: {    54:     /*+									    */U    55:     /*	If a listing file is being written, write the character to it. If   */U    56:     /*	it is a tab, compute the next tab position. If it is a newline,	    */U    57:     /*	reset the column position. Otherwise, just increment the column.    */    58:     /*-									    */    59: !    60:     if (list_enabled()) {#    61: 	fputc(vChar, list_file());    62: 	if (vChar == '\t') {J    63: 	    set_list_column(((list_column() / TAB_SIZE) + 1) * TAB_SIZE);
    64: 	}"    65: 	else if (vChar == '\n') {     66: 	    set_list_column(0);
    67: 	}    68: 	else {    69: 	    inc_list_column();
    70: 	}
    71:     }	    72: }
GEND list_char. Go to: Beginning of routine.





    73: V    74: /*************************************************************************++*/

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



!    75: void restore_list_column(V    76: /* Prints blanks out to the current listing column, restoring the column    */?    77: /* position after a message has been printed.				    */    78: )    79:     /* No arguments.							    */    80: )    81: )	/* No return value.						    */O    82: 	/*****************************************************************--*/    83: 	    84: {=    85:     int	    count;			    /* Character counter.	    */    86:     87:     /*+									    */U    88:     /*	Write the listing file line number spacing margin. Next write a	    */U    89:     /*	sufficient number of tabs to position it before the current column  */U    90:     /*	position. Then write the remaining number of blanks to go from the  */9    91:     /*	tab stop to the column position.				    */    92:     /*-									    */    93: 8    94:     fprintf(list_file(), LIST_LINE_SPACER, ' ');K    95:     for (count = list_column() / TAB_SIZE; count > 0; count--) {"    96: 	fputc('\t', list_file());
    97:     }K    98:     for (count = list_column() % TAB_SIZE; count > 0; count--) {!    99: 	fputc(' ', list_file());
   100:     }	   101: }
QEND restore_list_column. Go to: Beginning of routine.





   102: V   103: /*************************************************************************++*/

hROUTINE list_file_begin. Go to: mNext routine in file; Routines in this file.



   104: void list_file_begin(U   105: /* Writes status messages indicating that analysis of a source file is	    */#   106: /* beginning.								    */   107: $   108:     SOURCEFILE	*aSourceFile,(   109: 		/* (READ, BY ADDR):					    */5   110: 		/* Source file information record.			    */   111:    112:     char	*aLangName(   113: 		/* (READ, BY ADDR):					    */1   114: 		/* Source file language name.				    */   115: )   116: )	/* No return value.						    */O   117: 	/*****************************************************************--*/   118: 	   119: {!   120:     if (list_enabled()) {K   121: 	fprintf(list_file(), "FILE %s analysis started, language is %s\n",2   122: 	    source_name(aSourceFile), aLangName);
   123:     }    124:     if (log_enabled()) {=   125: 	printf("FILE %s analysis started, language is %s\n",2   126: 	    source_name(aSourceFile), aLangName);
   127:     }	   128: }
MEND list_file_begin. Go to: Beginning of routine.





   129: V   130: /*************************************************************************++*/

fROUTINE list_file_end. Go to: mNext routine in file; Routines in this file.



   131: void list_file_end(U   132: /* Writes status messages indicating that analysis of a source file is	    */"   133: /* complete.								    */   134: #   135:     SOURCEFILE	*aSourceFileN(   136: 		/* (READ, BY ADDR):					    */5   137: 		/* Source file information record.			    */o   138: )   139: )	/* No return value.						    */lO   140: 	/*****************************************************************--*/>   141: 	   142: {s!   143:     if (list_enabled()) {n>   144: 	fprintf(list_file(), "\nFILE %s analysis complete\n",'   145: 	    source_name(aSourceFile));r   146: 	fprintf(list_file(),II   147: 	    "     %ld lines, %ld routines (avg len %ld), %ld calls\n\n", E   148: 	    source_lines(aSourceFile), source_routines(aSourceFile),5D   149: 	    source_avglen(aSourceFile), source_calls(aSourceFile));
   150:     }1%   151:     if (log_full_enabled()) {EI   152: 	printf("FILE %s analysis complete\n", source_name(aSourceFile));dL   153: 	printf("     %ld lines, %ld routines (avg len %ld), %ld calls\n\n",E   154: 	    source_lines(aSourceFile), source_routines(aSourceFile),D   155: 	    source_avglen(aSourceFile), source_calls(aSourceFile));
   156:     }_	   157: }
KEND list_file_end. Go to: Beginning of routine.

*



*   158: V   159: /*************************************************************************++*/

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



n    160: void list_product_begin(V   161: /* Writes status messages indicating that analysis of a product file is	    */#   162: /* beginning.								    */    163: !   164:     char    *aProductName (   165: 		/* (READ, BY ADDR):					    */0   166: 		/* Product file name string.				    */   167: )   168: )	/* No return value.						    */	O   169: 	/*****************************************************************--*/    170: 	   171: {*!   172:     if (list_enabled()) {*K   173: 	fprintf(list_file(), "%s %s\n", PROGRAM_IDENT, PROGRAM_COPYRIGHT);cQ   174: 	fprintf(list_file(), "\nPRODUCT %s analysis started\n\n", aProductName);*
   175:     }*    176:     if (log_enabled()) {=   177: 	printf("%s %s\n", PROGRAM_IDENT, PROGRAM_COPYRIGHT);07   178:         printf("PRODUCT %s\n", product_name());NK   179: 	printf("        (in file %s) analysis started\n\n", aProductName);l
   180:     }E	   181: } 
PEND list_product_begin. Go to: Beginning of routine.





    182: V   183: /*************************************************************************++*/

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



f$   184: void list_analysis_complete(V   185: /* Writes status messages indicating that analysis of all source files is   */"   186: /* complete.								    */   187: !   188:     char    *aProductName (   189: 		/* (READ, BY ADDR):					    */0   190: 		/* Product file name string.				    */   191: )   192: )	/* No return value.						    */zO   193: 	/*****************************************************************--*/t   194: 	   195: {R!   196:     if (list_enabled()) {sQ   197: 	fprintf(list_file(), "\nPRODUCT %s all source file analysis complete\n",c   198: 	    aProductName);a   199: 	fprintf(list_file(),V   200:     "        %ld files, %ld lines, %ld routines (avg len %ld), %ld calls\n\n",L   201: 	    total_files(), total_lines(), total_routines(), total_avglen(),   202: 	    total_calls());
   203:     } %   204:     if (log_full_enabled()) {*C   205: 	printf("\nPRODUCT %s all source file analysis complete\n",   206: 	    aProductName);    207: 	printf(V   208:     "        %ld files, %ld lines, %ld routines (avg len %ld), %ld calls\n\n",L   209: 	    total_files(), total_lines(), total_routines(), total_avglen(),   210: 	    total_calls());
   211:     }s	   212: }r
TEND list_analysis_complete. Go to: Beginning of routine.





    213: V   214: /*************************************************************************++*/

iROUTINE list_product_end. Go to: nmNext routine in file; Routines in this file.

/

N   215: void list_product_end(T   216: /* Writes status messages indicating that analysis and reporting of a	    */,   217: /* product is complete.							    */   218: !   219:     char    *aProductName2(   220: 		/* (READ, BY ADDR):					    */0   221: 		/* Product file name string.				    */   222: )   223: )	/* No return value.						    */ O   224: 	/*****************************************************************--*/d   225: 	   226: {!   227:     if (list_enabled()) {h   228: 	fprintf(list_file(),rQ   229: 	    "\nPRODUCT %s all analysis and reporting complete\n", aProductName);*
   230:     } %   231:     if (log_full_enabled()) {C   232: 	printf("PRODUCT %s all analysis and reporting complete\n",*   233: 	aProductName);*
   234:     }*	   235: }*
NEND list_product_end. Go to: Beginning of routine.





    236: V   237: /*************************************************************************++*/

gROUTINE list_def_begin. Go to: mNext routine in file; Routines in this file.



c   238: void list_def_begin(S   239: /* Writes status messages indicating that the beginning of a routine	    */A1   240: /* definition has been found.						    *//   241: $   242:     SOURCEFILE	*aSourceFile,(   243: 		/* (READ, BY ADDR):					    */5   244: 		/* Source file information record.			    */t   245: #   246:     DEFINITION	*aRoutineDeff(   247: 		/* (READ, BY ADDR):					    */1   248: 		/* Routine definition record.				    */5   249: )   250: )	/* No return value.						    */1O   251: 	/*****************************************************************--*/*   252: 	   253: {>!   254:     if (list_enabled()) {AC   255: 	fprintf(list_file(), "\nBEGIN %s in %s at line %ld/%ld\n", =   256: 	    def_name(aRoutineDef), source_name(aSourceFile),i?   257: 	    def_begin(aRoutineDef), source_line(aSourceFile));    258: 	restore_list_column();*
   259:     }m$   260:     if (log_def_enabled()) {F   261: 	printf("BEGIN %s in %s at line %ld\n", def_name(aRoutineDef),A   262: 	    source_name(aSourceFile), source_line(aSourceFile));	
   263:     }1	   264: }u
LEND list_def_begin. Go to: Beginning of routine.





    265: V   266: /*************************************************************************++*/

eROUTINE list_def_end. Go to: 1mNext routine in file; Routines in this file.

l

    267: void list_def_end(V   268: /* Writes status messages indicating that the end of a routine definition   */'   269: /* has been found.							    */l   270: $   271:     SOURCEFILE	*aSourceFile,(   272: 		/* (READ, BY ADDR):					    */5   273: 		/* Source file information record.			    */#   274: #   275:     DEFINITION	*aRoutineDef(   276: 		/* (READ, BY ADDR):					    */1   277: 		/* Routine definition record.				    */*   278: )   279: )	/* No return value.						    */AO   280: 	/*****************************************************************--*/=   281: 	   282: {t!   283:     if (list_enabled()) {_   284: 	fprintf(list_file(),fF   285: 	    "\nEND %s in %s at line %ld\n    %ld lines, %ld calls\n",=   286: 	    def_name(aRoutineDef), source_name(aSourceFile),*?   287: 	    source_line(aSourceFile), def_length(aRoutineDef),R)   288: 	    def_num_calls(aRoutineDef));Y   289: 	restore_list_column();S
   290:     }rD   291:     if (log_def_enabled() && !log_brief_enabled()) {M   292: 	printf("END   %s in %s at line %ld\n      %ld lines, %ld calls\n\n",*=   293: 	    def_name(aRoutineDef), source_name(aSourceFile),)?   294: 	    source_line(aSourceFile), def_length(aRoutineDef),n)   295: 	    def_num_calls(aRoutineDef));r
   296:     }n	   297: }e
JEND list_def_end. Go to: Beginning of routine.





u   298: V   299: /*************************************************************************++*/

aROUTINE list_ref. Go to: amNext routine in file; Routines in this file.

d

n   300: void list_ref(V   301: /* Writes status messages indicating that a routine reference (call) has    */$   302: /* been found.								    */   303: $   304:     SOURCEFILE	*aSourceFile,(   305: 		/* (READ, BY ADDR):					    */5   306: 		/* Source file information record.			    */*   307: "   308:     REFERENCE	*aRoutineRef(   309: 		/* (READ, BY ADDR):					    */0   310: 		/* Routine reference record.				    */   311: )   312: )	/* No return value.						    */oO   313: 	/*****************************************************************--*/_   314: 	   315: {s!   316:     if (list_enabled()) {dN   317: 	fprintf(list_file(), "\nCALL %s in %s at line %ld, line %ld of %s\n",=   318: 	    ref_name(aRoutineRef), source_name(aSourceFile),*?   319: 	    source_line(aSourceFile), ref_offset(aRoutineRef),E0   320: 	    def_name(ref_caller(aRoutineRef)));   321: 	restore_list_column(); 
   322:     }N$   323:     if (log_ref_enabled()) {?   324: 	printf("CALL  %s in %s at line %ld, line %ld of %s\n",*=   325: 	    ref_name(aRoutineRef), source_name(aSourceFile),*?   326: 	    source_line(aSourceFile), ref_offset(aRoutineRef),_0   327: 	    def_name(ref_caller(aRoutineRef)));
   328:     }s	   329: }n
FEND list_ref. Go to: Beginning of routine.





n   330: 
END OF FILEY!TOTAL: 11 routines, 26 Avg LengthD

LGo to: Contents; Previous section; Beginning of section; Next file in section; Previous file in section.