rptsdml.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
----- ----
  537 rpt_byfile_sdml_end
  515 rpt_byfile_sdml_entry
  491 rpt_byfile_sdml_hdr
  226 rpt_calls_sdml_end
  185 rpt_calls_sdml_entry
  159 rpt_calls_sdml_hdr
   71 rpt_defined_sdml_end
   49 rpt_defined_sdml_entry
   29 rpt_defined_sdml_hdr
  607 rpt_file_sdml_end
  582 rpt_file_sdml_entry
  562 rpt_file_sdml_hdr
  768 rpt_source_sdml_end
  696 rpt_source_sdml_entry
  643 rpt_source_sdml_hdr
  469 rpt_tree_sdml_end
  397 rpt_tree_sdml_entry
  378 rpt_tree_sdml_hdr
  137 rpt_undefined_sdml_end
  116 rpt_undefined_sdml_entry
   98 rpt_undefined_sdml_hdr
  360 rpt_xref_sdml_end
  266 rpt_xref_sdml_entry
  252 rpt_xref_sdml_hdr

BEGINNING OF FILE

     1: /****************************************************************************/
     2: /*									    */
     3: /*  FACILITY:	Routine Analyzer					    */
     4: /*									    */
     5: /*  MODULE:	SDML 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 SDML format, suitable for input to VAX DOCUMENT.    */
    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: #define MAX_VALID_BREAK	    60			/* Lines between breaks.    */
    25: 
    26: static int mLastValidBreak;			/* Last source break line.  */
    27: 
    28: /*************************************************************************++*/

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

    29: void rpt_defined_sdml_hdr(
    30: /* Writes SDML-formatted report header for defined routines.		    */
    31: 
    32:     FILE    *aRptFile
    33: 	    /* (READ, BY ADDR):						    */
    34: 	    /* Report output file. Must be opened by caller.		    */
    35: 
    36: )	/* No return value.						    */
    37: 	/*****************************************************************--*/
    38: 
    39: {
    40:     fputs("<TABLE>(Defined Routines Alphabetical\\defined_routines_table)\n", aRptFile);
    41:     fputs("<TABLE_ATTRIBUTES>(MULTIPAGE\\WIDE)\n", aRptFile);
    42:     fputs("<TABLE_SETUP>(6\\20\\20\\7\\5\\5)\n", aRptFile);
    43:     fputs(
    44: "<TABLE_HEADS>(Routine\\Defined In File\\Line\\Length\\# Calls\\Times Called)\n",
    45: 	aRptFile);
    46: }
END rpt_defined_sdml_hdr. Go to: Beginning of routine.


    47: 
    48: /*************************************************************************++*/

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

    49: void rpt_defined_sdml_entry(
    50: /* Writes SDML-formatted routine entry for a defined routine.		    */
    51: 
    52:     FILE    *aRptFile,
    53: 	    /* (READ, BY ADDR):						    */
    54: 	    /* Report output file. Must be opened by caller.		    */
    55: 
    56:     DEFINITION
    57: 	    *aDef
    58: 	    /* (READ, BY ADDR):						    */
    59: 	    /* Routine definition entry to report.			    */
    60:     
    61: )	/* No return value.						    */
    62: 	/*****************************************************************--*/
    63: 
    64: {
    65:     fprintf(aRptFile, "<TABLE_ROW>(%s\\%s\\%ld\\%ld\\%ld\\%ld)\n",
    66: 	def_name(aDef), source_name(def_source(aDef)), def_begin(aDef),
    67: 	def_length(aDef), def_num_calls(aDef), def_num_callers(aDef));
    68: }
END rpt_defined_sdml_entry. Go to: Beginning of routine.


    69: 
    70: /*************************************************************************++*/

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

    71: void rpt_defined_sdml_end(
    72: /* Writes SDML-formatted report end for defined routines.		    */
    73: 
    74:     FILE    *aRptFile,
    75: 	    /* (READ, BY ADDR):						    */
    76: 	    /* Report output file. Must be opened by caller.		    */
    77: 
    78:     long    vTotalDef
    79: 	    /* (READ, BY VAL):						    */
    80: 	    /* Total number of defined routines.			    */
    81: 
    82: )	/* No return value.						    */
    83: 	/*****************************************************************--*/
    84: 
    85: {
    86:     fputs("<TABLE_ROW>(<SPAN>(6)<RULE>)\n", aRptFile);
    87:     fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL ROUTINES: %ld\\BOLD)\\\n",
    88: 	vTotalDef);
    89:     fprintf(aRptFile, "            <EMPHASIS>(TOTAL DEF LINES: %ld\\BOLD)\\\n",
    90: 	total_rlength());
    91:     fprintf(aRptFile, "            <EMPHASIS>(AVG LEN:\\BOLD)\\\n");
    92:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\\)\n",
    93: 	total_avglen());
    94:     fputs("<ENDTABLE>\n", aRptFile);
    95: }
END rpt_defined_sdml_end. Go to: Beginning of routine.


    96: 
    97: /*************************************************************************++*/

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

    98: void rpt_undefined_sdml_hdr(
    99: /* Writes SDML-formatted report header for undefined routines.		    */
   100: 
   101:     FILE    *aRptFile
   102: 	    /* (READ, BY ADDR):						    */
   103: 	    /* Report output file. Must be opened by caller.		    */
   104: 
   105: )	/* No return value.						    */
   106: 	/*****************************************************************--*/
   107: 
   108: {
   109:     fputs("<TABLE>(External Routines Alphabetical\\external_routines_table)\n", aRptFile);
   110:     fputs("<TABLE_ATTRIBUTES>(MULTIPAGE)\n", aRptFile);
   111:     fputs("<TABLE_SETUP>(2\\20)\n", aRptFile);
   112:     fputs("<TABLE_HEADS>(Routine\\Times Called)\n", aRptFile);
   113: }
END rpt_undefined_sdml_hdr. Go to: Beginning of routine.


   114: 
   115: /*************************************************************************++*/

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

   116: void rpt_undefined_sdml_entry(
   117: /* Writes SDML-formatted routine entry for a undefined routine.		    */
   118: 
   119:     FILE    *aRptFile,
   120: 	    /* (READ, BY ADDR):						    */
   121: 	    /* Report output file. Must be opened by caller.		    */
   122: 
   123:     DEFINITION
   124: 	    *aDef
   125: 	    /* (READ, BY ADDR):						    */
   126: 	    /* Routine definition entry to report.			    */
   127:     
   128: )	/* No return value.						    */
   129: 	/*****************************************************************--*/
   130: 
   131: {
   132:     fprintf(aRptFile, "<TABLE_ROW>(%s\\%ld)\n",
   133: 	def_name(aDef), def_num_callers(aDef));
   134: }
END rpt_undefined_sdml_entry. Go to: Beginning of routine.


   135: 
   136: /*************************************************************************++*/

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

   137: void rpt_undefined_sdml_end(
   138: /* Writes SDML-formatted report end for undefined routines.		    */
   139: 
   140:     FILE    *aRptFile,
   141: 	    /* (READ, BY ADDR):						    */
   142: 	    /* Report output file. Must be opened by caller.		    */
   143: 
   144:     long    vTotalUndef
   145: 	    /* (READ, BY VAL):						    */
   146: 	    /* Total number of undefined routines.			    */
   147: 
   148: )	/* No return value.						    */
   149: 	/*****************************************************************--*/
   150: 
   151: {
   152:     fputs("<TABLE_ROW>(<SPAN>(2)<RULE>)\n", aRptFile);
   153:     fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL ROUTINES: %ld\\BOLD)\\)\n",
   154: 	vTotalUndef);
   155:     fputs("<ENDTABLE>\n", aRptFile);
   156: }
END rpt_undefined_sdml_end. Go to: Beginning of routine.


   157: 
   158: /*************************************************************************++*/

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

   159: void rpt_calls_sdml_hdr(
   160: /* Writes SDML-formatted report header for defined routine calls/callers    */
   161: /* table.								    */
   162: 
   163:     FILE    *aRptFile,
   164: 	    /* (READ, BY ADDR):						    */
   165: 	    /* Report output file. Must be opened by caller.		    */
   166: 
   167:     DEFINITION
   168: 	    *aDef
   169: 	    /* (READ, BY ADDR):						    */
   170: 	    /* Routine definition entry to report.			    */
   171:     
   172: )	/* No return value.						    */
   173: 	/*****************************************************************--*/
   174: 
   175: {
   176:     fprintf(aRptFile,
   177:     "<TABLE>(%s Calls/Caller Routines)\n", def_ident(aDef));
   178:     fputs("<TABLE_ATTRIBUTES>(MULTIPAGE)\n", aRptFile);
   179:     fputs("<TABLE_SETUP>(4\\20\\5\\20)\n", aRptFile);
   180:     fputs("<TABLE_HEADS>(Calls Routine\\Line\\Caller Routine\\Line)\n",
   181: 	aRptFile);
   182: }
END rpt_calls_sdml_hdr. Go to: Beginning of routine.


   183: 
   184: /*************************************************************************++*/

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

   185: void rpt_calls_sdml_entry(
   186: /* Writes SDML-formatted calls/caller entry for a defined routine.	    */
   187: 
   188:     FILE    *aRptFile,
   189: 	    /* (READ, BY ADDR):						    */
   190: 	    /* Report output file. Must be opened by caller.		    */
   191: 
   192:     REFERENCE
   193: 	    *aCalled,
   194: 	    /* (READ, BY ADDR):						    */
   195: 	    /* Called routine reference entry to report. If NULL is passed, */
   196: 	    /* only a caller is being reported.				    */
   197:     
   198:     REFERENCE
   199: 	    *aCaller
   200: 	    /* (READ, BY ADDR):						    */
   201: 	    /* Caller routine reference entry to report. If NULL is passed, */
   202: 	    /* only a called routine is being reported.			    */
   203:     
   204: )	/* No return value.						    */
   205: 	/*****************************************************************--*/
   206: 
   207: {
   208:     fprintf(aRptFile, "<TABLE_ROW>(");
   209:     if (aCalled == NULL) {
   210: 	fprintf(aRptFile, "\\\\");
   211:     }
   212:     else {
   213: 	fprintf(aRptFile, "%s\\%ld\\", def_name(ref_definition(aCalled)),
   214: 	    ref_offset(aCalled));
   215:     }
   216:     if (aCaller == NULL) {
   217: 	fprintf(aRptFile, "\\)\n");
   218:     }
   219:     else {
   220: 	fprintf(aRptFile, "%s\\%ld)\n", def_name(ref_caller(aCaller)),
   221: 	    ref_offset(aCaller));
   222:     }
   223: }
END rpt_calls_sdml_entry. Go to: Beginning of routine.


   224: 
   225: /*************************************************************************++*/

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

   226: void rpt_calls_sdml_end(
   227: /* Writes SDML-formatted report end for defined routine calls/caller	    */
   228: /* table.								    */
   229: 
   230:     FILE    *aRptFile,
   231: 	    /* (READ, BY ADDR):						    */
   232: 	    /* Report output file. Must be opened by caller.		    */
   233: 
   234:     DEFINITION
   235: 	    *aDef
   236: 	    /* (READ, BY ADDR):						    */
   237: 	    /* Routine definition entry to report.			    */
   238:     
   239: )	/* No return value.						    */
   240: 	/*****************************************************************--*/
   241: 
   242: {
   243:     fputs("<TABLE_ROW>(<SPAN>(4)<RULE>)\n", aRptFile);
   244:     fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL CALLS: %ld\\BOLD)\\\\\n",
   245: 	def_num_calls(aDef));
   246:     fprintf(aRptFile, "            <EMPHASIS>(TOTAL CALLERS: %ld\\BOLD)\\)\n",
   247: 	def_num_callers(aDef));
   248:     fputs("<ENDTABLE>\n\n", aRptFile);
   249: }
END rpt_calls_sdml_end. Go to: Beginning of routine.


   250: 
   251: /*************************************************************************++*/

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

   252: void rpt_xref_sdml_hdr(
   253: /* Writes SDML-formatted report header for cross reference.		    */
   254: 
   255:     FILE    *aRptFile
   256: 	    /* (READ, BY ADDR):						    */
   257: 	    /* Report output file. Must be opened by caller.		    */
   258: 
   259: )	/* No return value.						    */
   260: 	/*****************************************************************--*/
   261: 
   262: {
   263: }
END rpt_xref_sdml_hdr. Go to: Beginning of routine.


   264: 
   265: /*************************************************************************++*/

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

   266: void rpt_xref_sdml_entry(
   267: /* Writes SDML-formatted cross-reference sections for a routine.	    */
   268: 
   269:     FILE    *aRptFile,
   270: 	    /* (READ, BY ADDR):						    */
   271: 	    /* Report output file. Must be opened by caller.		    */
   272: 
   273:     DEFINITION
   274: 	    *aDef,
   275: 	    /* (READ, BY ADDR):						    */
   276: 	    /* Routine definition entry to report.			    */
   277: 
   278:     int	    vFirst
   279: 	    /* (READ, BY VAL):						    */
   280: 	    /* Flag indicating this is first entry being reported.	    */
   281:     
   282: )	/* No return value.						    */
   283: 	/*****************************************************************--*/
   284: 
   285: {
   286:     REFERENCE				    /* Current caller ref.	    */
   287: 	    *caller;
   288:     char    fullname[MAX_ROUTINE_IDENT + 1];/* Routine fullname buffer.	    */
   289: 					    /* Routine name folding buffer. */
   290:     char    rname[RPT_HTML_ROUTINE_WIDE_LEN + 1]; 
   291:     int	    rpos;			    /* Pos in routine name to print.*/
   292: 
   293:     fprintf(aRptFile, "<FIGURE>(%s Cross Reference)\n", def_ident(aDef));
   294: #if 0
   295:     fputs("<FIGURE_ATTRIBUTES>(KEEP\\WIDE)\n", aRptFile);
   296: #endif    
   297:     fputs("<FIGURE_ATTRIBUTES>(MULTIPAGE)", aRptFile);
   298:     fputs("<LINE_ART>(WIDE)\n", aRptFile);
   299:     fputs("CALLERS:", aRptFile);
   300:     if (def_num_callers(aDef) == 0) {
   301: 	fputs(" No callers\n", aRptFile);
   302:     }
   303:     else {
   304: 	fprintf(aRptFile, "\n\n%3c%ld caller%s\n", ' ',
   305: 	    def_num_callers(aDef), (def_num_callers(aDef) == 1 ? "" : "s"));
   306: 
   307: 					    /* Write entry for each caller. */
   308: 	for (caller = list_first(def_callers(aDef));
   309: 	    caller != NULL;
   310: 	    caller = next_entry(caller)) {
   311: 	    strcpy(fullname, def_ident(ref_caller(caller)));
   312: 	    
   313: 					    /* Get first part of rout name. */
   314: 	    rpos = fold_string(fullname, 0, NULL, rname,
   315: 		RPT_HTML_ROUTINE_WIDE_LEN);
   316: 	    fprintf(aRptFile, "%8c+ %-48s\n", ' ', rname);
   317: 	    while (rpos < strlen(fullname)) {/* Write rest of routine name.  */
   318: 		rpos = fold_string(fullname, rpos, "    ", rname,
   319: 		    RPT_HTML_ROUTINE_WIDE_LEN);
   320: 		fprintf(aRptFile, "%8c%s\n", ' ', rname);
   321: 	    }
   322: 	}
   323:     }
   324:     if (isdefined_routine(aDef)) {
   325: 	fputs("\nCALL TREE:", aRptFile);
   326: 	if (def_num_calls(aDef) == 0) {
   327: 	    fputs(" No calls\n", aRptFile);
   328: 	}
   329: 	else {
   330: 	    fputs("\n\n", aRptFile);
   331: 	}
   332:     }
   333:     if (def_num_calls(aDef) == 0) {
   334: 	fputs("<ENDLINE_ART>\n", aRptFile);
   335: 	fputs("<ENDFIGURE>\n\n", aRptFile);
   336:     }
   337:         
   338: #if 0					    /* Write section header.	    */
   339:     fprintf(aRptFile, "<TABLE>(%s Callers\\WIDE)\n", def_ident(aDef));
   340:     fputs("<TABLE_SETUP>(2\\20)\n", aRptFile);
   341:     fputs("<TABLE_HEADS>(Routine\\Callers)\n", aRptFile);
   342:     if (def_num_callers(aDef) == 0) {
   343: 	fprintf(aRptFile, "<TABLE_ROW>(%s\\- No callers)\n", def_ident(aDef));
   344:     }
   345:     else {				    /* Write entry for each caller. */
   346: 	fprintf(aRptFile, "<TABLE_ROW>(%s\\<LIST>(UNNUMBERED)\n",
   347: 	    def_ident(aDef));
   348: 	for (caller = list_first(def_callers(aDef));
   349: 	    caller != NULL;
   350: 	    caller = next_entry(caller)) {
   351: 	    fprintf(aRptFile, "<LE>%s\n", def_ident(ref_caller(caller)));
   352: 	}
   353: 	fputs("<ENDLIST>)\n", aRptFile);
   354:     }
   355:     fputs("<ENDTABLE>\n", aRptFile);
   356: #endif
   357: }
END rpt_xref_sdml_entry. Go to: Beginning of routine.


   358: 
   359: /*************************************************************************++*/

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

   360: void rpt_xref_sdml_end(
   361: /* Writes SDML-formatted report end for caller cross-reference.		    */
   362: 
   363:     FILE    *aRptFile,
   364: 	    /* (READ, BY ADDR):						    */
   365: 	    /* Report output file. Must be opened by caller.		    */
   366: 
   367:     long    vTotalDef
   368: 	    /* (READ, BY VAL):						    */
   369: 	    /* Total number of routines.				    */
   370: 
   371: )	/* No return value.						    */
   372: 	/*****************************************************************--*/
   373: 
   374: {
   375: }
END rpt_xref_sdml_end. Go to: Beginning of routine.


   376: 
   377: /*************************************************************************++*/

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

   378: void rpt_tree_sdml_hdr(
   379: /* Writes SDML-formatted report header for defined routine call tree.	    */
   380: 
   381:     FILE    *aRptFile,
   382: 	    /* (READ, BY ADDR):						    */
   383: 	    /* Report output file. Must be opened by caller.		    */
   384: 
   385:     DEFINITION
   386: 	    *aDef
   387: 	    /* (READ, BY ADDR):						    */
   388: 	    /* Routine definition entry to report.			    */
   389:     
   390: )	/* No return value.						    */
   391: 	/*****************************************************************--*/
   392: 
   393: {
   394: }
END rpt_tree_sdml_hdr. Go to: Beginning of routine.


   395: 
   396: /*************************************************************************++*/

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

   397: void rpt_tree_sdml_entry(
   398: /* Writes SDML-formatted call tree line for a defined routine.		    */
   399: 
   400:     FILE    *aRptFile,
   401: 	    /* (READ, BY ADDR):						    */
   402: 	    /* Report output file. Must be opened by caller.		    */
   403: 
   404:     REFERENCE
   405: 	    *aRef,
   406: 	    /* (READ, BY ADDR):						    */
   407: 	    /* Reference to routine definition entry to report.       	    */
   408: 
   409:     int	    vLevel,
   410: 	    /* (READ, BY VAL):						    */
   411: 	    /* Nesting level, used to space indentation.		    */
   412: 
   413:     int	    vExpanded,
   414: 	    /* (READ, BY VAL):						    */
   415: 	    /* Flag indicating whether or not routine has already been	    */
   416: 	    /* expanded in this call tree.				    */
   417: 
   418:     int	    vRecursive
   419: 	    /* (READ, BY VAL):						    */
   420: 	    /* Flag indicating whether or not routine is called		    */
   421: 	    /* recursively.						    */
   422: 
   423: )	/* No return value.						    */
   424: 	/*****************************************************************--*/
   425: 
   426: {
   427:     int	    lcount;			    /* Level print count.	    */
   428: 
   429:     fputs("   ", aRptFile);
   430:     for (lcount = vLevel; lcount > 1; lcount--) {
   431: 	fputs("|   ", aRptFile);
   432:     }
   433:     if (lcount > 0) {
   434: 	if (isend_of_list(aRef)) {
   435: 	    fputs("+   ", aRptFile);
   436: 	}
   437: 	else {
   438: 	    fputs("|   ", aRptFile);
   439: 	}
   440:     }
   441:     if (vLevel == 0) {
   442: 	fprintf(aRptFile, "%s\n", def_name(ref_definition(aRef)));
   443:     }
   444: 					    /* If routine is not going to   */
   445: 					    /* be expanded here, format it  */
   446: 					    /* in italics and add an	    */
   447:     else if (vExpanded || vRecursive ||	    /* explanation code.	    */
   448: 	(needs_tree(ref_definition(aRef)) && !tree_inline_disabled()) ||
   449: 	!isdefined_routine(ref_definition(aRef))) {
   450: 	fprintf(aRptFile, "<EMPHASIS>(%s\\italic) (%s%s%s%s)\n",
   451: 	    def_name(ref_definition(aRef)),
   452: 	    (vExpanded ? "Duplicate" : ""),
   453: 	    (vRecursive ? "Recursive" : ""),
   454: 	    (needs_tree(ref_definition(aRef)) && !vRecursive && !vExpanded
   455: 		&& !tree_inline_disabled() ? "Separate" : ""),
   456: 	    (!isdefined_routine(ref_definition(aRef)) ? "External" : ""));
   457:     }
   458:     else if (vLevel == max_tree_depth()	    /* Reached expansion limit?	    */
   459: 	&& def_num_calls(ref_definition(aRef)) > 0) {
   460: 	fprintf(aRptFile, "<EMPHASIS>(%s\\italic) (Separate)\n",
   461: 	    def_name(ref_definition(aRef)));
   462:     }
   463:     else {				    /* Otherwise, format plain.	    */
   464: 	fprintf(aRptFile, "%s\n", def_name(ref_definition(aRef)));
   465:     }
   466: }
END rpt_tree_sdml_entry. Go to: Beginning of routine.


   467: 
   468: /*************************************************************************++*/

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

   469: void rpt_tree_sdml_end(
   470: /* Writes SDML-formatted section end for defined routine call tree.	    */
   471: 
   472:     FILE    *aRptFile,
   473: 	    /* (READ, BY ADDR):						    */
   474: 	    /* Report output file. Must be opened by caller.		    */
   475: 
   476:     DEFINITION
   477: 	    *aDef
   478: 	    /* (READ, BY ADDR):						    */
   479: 	    /* Routine definition entry to report.			    */
   480:     
   481: )	/* No return value.						    */
   482: 	/*****************************************************************--*/
   483: 
   484: {
   485:     fputs("   END OF TREE\n", aRptFile);
   486:     fputs("<ENDLINE_ART>\n", aRptFile);
   487:     fputs("<ENDFIGURE>\n\n", aRptFile);
   488: }
END rpt_tree_sdml_end. Go to: Beginning of routine.


   489: 
   490: /*************************************************************************++*/

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

   491: void rpt_byfile_sdml_hdr(
   492: /* Writes SDML-formatted report header for defined routines by file table.  */
   493: 
   494:     FILE    *aRptFile,
   495: 	    /* (READ, BY ADDR):						    */
   496: 	    /* Report output file. Must be opened by caller.		    */
   497: 
   498:     SOURCEFILE
   499: 	    *aSourceFile
   500: 	    /* (READ, BY ADDR):						    */
   501: 	    /* Source file entry to report.				    */
   502:     
   503: )	/* No return value.						    */
   504: 	/*****************************************************************--*/
   505: 
   506: {
   507:     fprintf(aRptFile, "<TABLE>(%s Routines)\n", source_name(aSourceFile));
   508:     fputs("<TABLE_ATTRIBUTES>(MULTIPAGE)\n", aRptFile);
   509:     fputs("<TABLE_SETUP>(5\\20\\7\\5\\5)\n", aRptFile);
   510:     fputs("<TABLE_HEADS>(Routine\\Line\\Length\\# Calls\\Times Called)\n",
   511: 	aRptFile);
   512: }
END rpt_byfile_sdml_hdr. Go to: Beginning of routine.


   513: 
   514: /*************************************************************************++*/

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

   515: void rpt_byfile_sdml_entry(
   516: /* Writes SDML-formatted entry for a defined routine by file.		    */
   517: 
   518:     FILE    *aRptFile,
   519: 	    /* (READ, BY ADDR):						    */
   520: 	    /* Report output file. Must be opened by caller.		    */
   521: 
   522:     DEFINITION
   523: 	    *aDef
   524: 	    /* (READ, BY ADDR):						    */
   525: 	    /* Routine definition entry to report.			    */
   526:     
   527: )	/* No return value.						    */
   528: 	/*****************************************************************--*/
   529: 
   530: {
   531:     fprintf(aRptFile, "<TABLE_ROW>(%s\\%ld\\%ld\\%ld\\%ld)\n", def_name(aDef),
   532: 	def_begin(aDef), def_length(aDef), def_num_calls(aDef),
   533: 	def_num_callers(aDef));
   534: }
END rpt_byfile_sdml_entry. Go to: Beginning of routine.


   535: 
   536: /*************************************************************************++*/

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

   537: void rpt_byfile_sdml_end(
   538: /* Writes SDML-formatted report end for defined routine by file table.	    */
   539: 
   540:     FILE    *aRptFile,
   541: 	    /* (READ, BY ADDR):						    */
   542: 	    /* Report output file. Must be opened by caller.		    */
   543: 
   544:     SOURCEFILE
   545: 	    *aSourceFile
   546: 	    /* (READ, BY ADDR):						    */
   547: 	    /* Source file entry to report.				    */
   548:     
   549: )	/* No return value.						    */
   550: 	/*****************************************************************--*/
   551: 
   552: {
   553:     fputs("<TABLE_ROW>(<SPAN>(5)<RULE>)\n", aRptFile);
   554:     fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL: %ld ROUTINES\\BOLD)\\\\\n",
   555: 	source_routines(aSourceFile));
   556:     fprintf(aRptFile, "            <EMPHASIS>(%ld AVG\\BOLD)\\\\)\n",
   557: 	source_avglen(aSourceFile));
   558:     fputs("<ENDTABLE>\n\n", aRptFile);
   559: }
END rpt_byfile_sdml_end. Go to: Beginning of routine.


   560: 
   561: /*************************************************************************++*/

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

   562: void rpt_file_sdml_hdr(
   563: /* Writes SDML-formatted report header for source files.		    */
   564: 
   565:     FILE    *aRptFile
   566: 	    /* (READ, BY ADDR):						    */
   567: 	    /* Report output file. Must be opened by caller.		    */
   568: 
   569: )	/* No return value.						    */
   570: 	/*****************************************************************--*/
   571: 
   572: {
   573:     fputs("<TABLE>(Source Files Alphabetical\\source_files_table)\n", aRptFile);
   574:     fputs("<TABLE_ATTRIBUTES>(MULTIPAGE\\WIDE)\n", aRptFile);
   575:     fputs("<TABLE_SETUP>(8\\20\\6\\5\\6\\4\\6\\4)\n", aRptFile);
   576:     fputs(
   577: "<TABLE_HEADS>(File\\Lines\\Com- mented\\State- ment\\Rou- tines\\Length\\Avg Len\\# Calls)\n",
   578: 	aRptFile);
   579: }
END rpt_file_sdml_hdr. Go to: Beginning of routine.


   580: 
   581: /*************************************************************************++*/

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

   582: void rpt_file_sdml_entry(
   583: /* Writes SDML-formatted source file entry.				    */
   584: 
   585:     FILE    *aRptFile,
   586: 	    /* (READ, BY ADDR):						    */
   587: 	    /* Report output file. Must be opened by caller.		    */
   588: 
   589:     SOURCEFILE
   590: 	    *aSourceFile
   591: 	    /* (READ, BY ADDR):						    */
   592: 	    /* Source file entry to report.				    */
   593:     
   594: )	/* No return value.						    */
   595: 	/*****************************************************************--*/
   596: 
   597: {
   598:     fprintf(aRptFile, "<TABLE_ROW>(%s\\%ld\\%ld\\%ld\\%ld\\%ld\\%ld\\%ld)\n",
   599: 	source_name(aSourceFile), source_lines(aSourceFile),
   600: 	source_comments(aSourceFile) + source_mixed(aSourceFile),
   601: 	source_statements(aSourceFile) + source_mixed(aSourceFile),
   602: 	source_routines(aSourceFile), source_rlength(aSourceFile),
   603: 	source_avglen(aSourceFile), source_calls(aSourceFile));
   604: }
END rpt_file_sdml_entry. Go to: Beginning of routine.


   605: 
   606: /*************************************************************************++*/

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

   607: void rpt_file_sdml_end(
   608: /* Writes SDML-formatted report end for source files.			    */
   609: 
   610:     FILE    *aRptFile,
   611: 	    /* (READ, BY ADDR):						    */
   612: 	    /* Report output file. Must be opened by caller.		    */
   613: 
   614:     long    vTotalFiles
   615: 	    /* (READ, BY VAL):						    */
   616: 	    /* Total number of source files.				    */
   617: 
   618: )	/* No return value.						    */
   619: 	/*****************************************************************--*/
   620: 
   621: {
   622:     fputs("<TABLE_ROW>(<SPAN>(8)<RULE>)\n", aRptFile);
   623:     fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL: %ld files\\BOLD)\\\n",
   624: 	vTotalFiles);
   625:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   626: 	total_lines());
   627:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   628: 	total_comments() + total_mixed());
   629:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   630: 	total_statements() + total_mixed());
   631:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   632: 	total_routines());
   633:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   634: 	total_rlength());
   635:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD)\\\n",
   636: 	total_avglen());
   637:     fprintf(aRptFile, "            <EMPHASIS>(%ld\\BOLD))\n",
   638: 	total_calls());
   639:     fputs("<ENDTABLE>\n", aRptFile);
   640: }
END rpt_file_sdml_end. Go to: Beginning of routine.


   641: 
   642: /*************************************************************************++*/

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

   643: void rpt_source_sdml_hdr(
   644: /* Writes SDML-formatted report header for annotated source file.	    */
   645: 
   646:     FILE    *aRptFile,
   647: 	    /* (READ, BY ADDR):						    */
   648: 	    /* Report output file. Must be opened by caller.		    */
   649: 
   650:     SOURCEFILE
   651: 	    *aSourceFile,
   652: 	    /* (READ, BY ADDR):						    */
   653: 	    /* Source file entry to report.				    */
   654: 
   655:     int	    vFirst,
   656: 	    /* (READ, BY VAL):						    */
   657: 	    /* Flag indicating whether this is first table.		    */
   658: 
   659:     int	    vLast
   660: 	    /* (READ, BY VAL):						    */
   661: 	    /* Flag indicating whether this is last table.		    */
   662:     
   663: )	/* No return value.						    */
   664: 	/*****************************************************************--*/
   665: 
   666: {
   667:     REFERENCE				    /* Current routine reference.   */
   668: 	    *curref;
   669: 
   670:     mLastValidBreak = 0;
   671:     fprintf(aRptFile, "<DEFINE_SYMBOL>(source_%d_name\\%s)\n",
   672: 	source_seq(aSourceFile), source_name(aSourceFile));
   673:     fprintf(aRptFile, "<FIGURE>(%s Source Code\\source_%d_figure)\n",
   674: 	source_name(aSourceFile), source_seq(aSourceFile));
   675:     fputs("<FIGURE_ATTRIBUTES>(MULTIPAGE\\WIDE)\n", aRptFile);
   676:     fputs("<LINE_ART>(WIDE)\n", aRptFile);
   677:     fputs("ROUTINES IN THIS FILE (Alphabetical)\n\n", aRptFile);
   678:     if (source_routines(aSourceFile) == 0) {
   679: 	fputs("   None.\n", aRptFile);
   680:     }
   681:     else {
   682: 	fputs(" Line Name\n----- ----\n", aRptFile);
   683: 	for (curref = list_first(source_reflist(aSourceFile));
   684: 	    curref != NULL;
   685: 	    curref = next_entry(curref)) {
   686: 	    fprintf(aRptFile, "%5d %s\n",
   687: 		def_begin(ref_definition(curref)),
   688: 		def_name(ref_definition(curref)));
   689: 	}
   690:     }
   691:     
   692:     fputs("\nBEGINNING OF FILE\n\n", aRptFile);
   693: }
END rpt_source_sdml_hdr. Go to: Beginning of routine.


   694: 
   695: /*************************************************************************++*/

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

   696: void rpt_source_sdml_entry(
   697: /* Writes SDML-formatted entry for an annotated source line.		    */
   698: 
   699:     FILE    *aRptFile,
   700: 	    /* (READ, BY ADDR):						    */
   701: 	    /* Report output file. Must be opened by caller.		    */
   702: 
   703:     DEFINITION
   704: 	    *aDef,
   705: 	    /* (READ, BY ADDR):						    */
   706: 	    /* Routine definition entry to report.			    */
   707: 
   708:     char    *aSrcLine,
   709: 	    /* (READ, BY ADDR):						    */
   710: 	    /* Source file line contents.				    */
   711: 
   712:     int	    vLine,
   713: 	    /* (READ, BY VAL):						    */
   714: 	    /* Source file line number.					    */
   715:     
   716:     int	    vTabSize
   717: 	    /* (READ, BY VAL):						    */
   718: 	    /* Source text tab size.					    */
   719:     
   720: )	/* No return value.						    */
   721: 	/*****************************************************************--*/
   722: 
   723: {
   724:     DEFINITION				    /* Next definition in file.	    */
   725: 	    *nextdef;
   726:     int	    column;			    /* Output column.		    */
   727:     int	    count;			    /* Tab expansion counter.	    */
   728: 	    
   729:     if (aDef != NULL && def_begin(aDef) == vLine) {
   730: 	fputs("<VALID_BREAK>\n", aRptFile);
   731: 	mLastValidBreak = vLine;
   732: 	fprintf(aRptFile, "\nBEGIN ROUTINE %s.\n\n", def_name(aDef));
   733:     }
   734:     fprintf(aRptFile, "%6d: ", vLine);
   735: 					    /* Expand tabs on output since  */
   736: 					    /* SDML treats TAB as a space.  */
   737:     for (column = 0; *aSrcLine != '\0'; aSrcLine++) {
   738: 	if (*aSrcLine == '\t') {
   739: 	    for (count = vTabSize - column % vTabSize;
   740: 		count > 0;
   741: 		count--, column++) {
   742: 		fputc(' ', aRptFile);
   743: 	    }
   744: 	}
   745: 	else if (*aSrcLine == '\f') {
   746: 	    fputs("\n<VALID_BREAK>", aRptFile);
   747: 	    mLastValidBreak = vLine;
   748: 	}
   749: 	else {
   750: 	    switch (*aSrcLine) {
   751: 	    case '>': fputs("<LITERAL>(>)", aRptFile); break;
   752: 	    case '<': fputs("<LITERAL>(<)", aRptFile); break;
   753: 	    default: fputc(*aSrcLine, aRptFile);
   754: 	    }
   755: 	    column++;
   756: 	}
   757:     }
   758:     if (aDef != NULL && def_end(aDef) == vLine) {
   759: 	fprintf(aRptFile, "\nEND %s.\n\n", def_name(aDef));
   760:     }
   761:     else if (vLine - mLastValidBreak > MAX_VALID_BREAK) {
   762: 	fputs("<VALID_BREAK>\n", aRptFile);
   763: 	mLastValidBreak = vLine;
   764:     }
   765: }
END rpt_source_sdml_entry. Go to: Beginning of routine.


   766: 
   767: /*************************************************************************++*/

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

   768: void rpt_source_sdml_end(
   769: /* Writes SDML-formatted report end for annotated source file.		    */
   770: 
   771:     FILE    *aRptFile,
   772: 	    /* (READ, BY ADDR):						    */
   773: 	    /* Report output file. Must be opened by caller.		    */
   774: 
   775:     SOURCEFILE
   776: 	    *aSourceFile,
   777: 	    /* (READ, BY ADDR):						    */
   778: 	    /* Source file entry to report.				    */
   779:     
   780:     int	    vFirst,
   781: 	    /* (READ, BY VAL):						    */
   782: 	    /* Flag indicating whether this is first table.		    */
   783: 
   784:     int	    vLast
   785: 	    /* (READ, BY VAL):						    */
   786: 	    /* Flag indicating whether this is last table.		    */
   787:     
   788: )	/* No return value.						    */
   789: 	/*****************************************************************--*/
   790: 
   791: {
   792:     fputs("\nEND OF FILE\n\n", aRptFile);
   793:     fprintf(aRptFile, "TOTAL: %ld routines, %ld Avg Length\n",
   794: 	source_routines(aSourceFile), source_avglen(aSourceFile));
   795:     fputs("<ENDLINE_ART>\n", aRptFile);
   796:     fputs("<ENDFIGURE>\n\n", aRptFile);
   797: }
END rpt_source_sdml_end. Go to: Beginning of routine.


   798: 

END OF FILE TOTAL: 24 routines, 30 Avg Length

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