listfile.c Source Code

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

Routines In This File (Alphabetical)

 Line Name
----- ----
  184 list_analysis_complete
   42 list_char
  238 list_def_begin
  267 list_def_end
  104 list_file_begin
  131 list_file_end
  160 list_product_begin
  215 list_product_end
  300 list_ref
   24 new_list_line
   75 restore_list_column

BEGINNING OF FILE

     1: /****************************************************************************/
     2: /*									    */
     3: /*  FACILITY:	Routine Analyzer					    */
     4: /*									    */
     5: /*  MODULE:	List File Management					    */
     6: /*									    */
     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */
     8: /*		Equipment Corporation, Littleton, MA, USA.		    */
     9: /*									    */
    10: /*  DESCRIPTION: This module contains list file management routines	    */
    11: /*  for Routine Analyzer.						    */
    12: /*									    */
    13: /*  REVISION HISTORY:							    */
    14: /*									    */
    15: /*  V0.1-00 24-AUG-1994 Steve Branam					    */
    16: /*									    */
    17: /*	Original version.						    */
    18: /*									    */
    19: /****************************************************************************/
    20: 
    21: #include "ranalyzer.h"
    22: 
    23: /*************************************************************************++*/

ROUTINE new_list_line. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_char. Go to: Next routine in file; Routines in this file.

    42: void list_char(
    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.						    */
    51: 	/*****************************************************************--*/
    52: 
    53: {
    54:     /*+									    */
    55:     /*	If a listing file is being written, write the character to it. If   */
    56:     /*	it is a tab, compute the next tab position. If it is a newline,	    */
    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') {
    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: }
END list_char. Go to: Beginning of routine.


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

ROUTINE restore_list_column. Go to: Next routine in file; Routines in this file.

    75: void restore_list_column(
    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.						    */
    82: 	/*****************************************************************--*/
    83: 
    84: {
    85:     int	    count;			    /* Character counter.	    */
    86: 
    87:     /*+									    */
    88:     /*	Write the listing file line number spacing margin. Next write a	    */
    89:     /*	sufficient number of tabs to position it before the current column  */
    90:     /*	position. Then write the remaining number of blanks to go from the  */
    91:     /*	tab stop to the column position.				    */
    92:     /*-									    */
    93: 
    94:     fprintf(list_file(), LIST_LINE_SPACER, ' ');
    95:     for (count = list_column() / TAB_SIZE; count > 0; count--) {
    96: 	fputc('\t', list_file());
    97:     }
    98:     for (count = list_column() % TAB_SIZE; count > 0; count--) {
    99: 	fputc(' ', list_file());
   100:     }
   101: }
END restore_list_column. Go to: Beginning of routine.


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

ROUTINE list_file_begin. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_file_end. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_product_begin. Go to: Next routine in file; Routines in this file.

   160: void list_product_begin(
   161: /* Writes status messages indicating that analysis of a product file is	    */
   162: /* beginning.								    */
   163: 
   164:     char    *aProductName
   165: 		/* (READ, BY ADDR):					    */
   166: 		/* Product file name string.				    */
   167: 
   168: )	/* No return value.						    */
   169: 	/*****************************************************************--*/
   170: 
   171: {
   172:     if (list_enabled()) {
   173: 	fprintf(list_file(), "%s %s\n", PROGRAM_IDENT, PROGRAM_COPYRIGHT);
   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);
   178:         printf("PRODUCT %s\n", product_name());
   179: 	printf("        (in file %s) analysis started\n\n", aProductName);
   180:     }
   181: }
END list_product_begin. Go to: Beginning of routine.


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

ROUTINE list_analysis_complete. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_product_end. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_def_begin. Go to: Next routine in file; Routines in this file.

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


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

ROUTINE list_def_end. Go to: Next routine in file; Routines in this file.

   267: void list_def_end(
   268: /* Writes status messages indicating that the end of a routine definition   */
   269: /* has been found.							    */
   270: 
   271:     SOURCEFILE	*aSourceFile,
   272: 		/* (READ, BY ADDR):					    */
   273: 		/* Source file information record.			    */
   274: 
   275:     DEFINITION	*aRoutineDef
   276: 		/* (READ, BY ADDR):					    */
   277: 		/* Routine definition record.				    */
   278: 
   279: )	/* No return value.						    */
   280: 	/*****************************************************************--*/
   281: 
   282: {
   283:     if (list_enabled()) {
   284: 	fprintf(list_file(),
   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),
   288: 	    def_num_calls(aRoutineDef));
   289: 	restore_list_column();
   290:     }
   291:     if (log_def_enabled() && !log_brief_enabled()) {
   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),
   295: 	    def_num_calls(aRoutineDef));
   296:     }
   297: }
END list_def_end. Go to: Beginning of routine.


   298: 
   299: /*************************************************************************++*/

ROUTINE list_ref. Go to: Next routine in file; Routines in this file.

   300: void list_ref(
   301: /* Writes status messages indicating that a routine reference (call) has    */
   302: /* been found.								    */
   303: 
   304:     SOURCEFILE	*aSourceFile,
   305: 		/* (READ, BY ADDR):					    */
   306: 		/* Source file information record.			    */
   307: 
   308:     REFERENCE	*aRoutineRef
   309: 		/* (READ, BY ADDR):					    */
   310: 		/* Routine reference record.				    */
   311: 
   312: )	/* No return value.						    */
   313: 	/*****************************************************************--*/
   314: 
   315: {
   316:     if (list_enabled()) {
   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),
   320: 	    def_name(ref_caller(aRoutineRef)));
   321: 	restore_list_column();
   322:     }
   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),
   327: 	    def_name(ref_caller(aRoutineRef)));
   328:     }
   329: }
END list_ref. Go to: Beginning of routine.


   330: 

END OF FILE TOTAL: 11 routines, 26 Avg Length

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