Line Name ----- ---- 97 assign_byfilefiles 70 assign_xreffiles 413 byfile_link_prefix 28 byfile_link_suffix 309 calls_link_prefix 26 calls_link_suffix 124 link_url 1431 rpt_byfile_html_end 1371 rpt_byfile_html_entry 1323 rpt_byfile_html_hdr 1013 rpt_calls_html_end 972 rpt_calls_html_entry 943 rpt_calls_html_hdr 816 rpt_defined_html_end 761 rpt_defined_html_entry 733 rpt_defined_html_hdr 1560 rpt_file_html_end 1500 rpt_file_html_entry 1465 rpt_file_html_hdr 670 rpt_html_continue 505 rpt_html_section_hdr 444 rpt_html_section_nav 482 rpt_html_section_title 599 rpt_html_subsection_hdr 1719 rpt_source_html_end 1657 rpt_source_html_entry 1592 rpt_source_html_hdr 1294 rpt_tree_html_end 1200 rpt_tree_html_entry 1160 rpt_tree_html_hdr 917 rpt_undefined_html_end 870 rpt_undefined_html_entry 842 rpt_undefined_html_hdr 1138 rpt_xref_html_end 1055 rpt_xref_html_entry 1039 rpt_xref_html_hdr 281 sourcefile_link_prefix 247 source_link 211 source_link_prefix 29 source_link_suffix 152 tree_link 382 xref_link 340 xref_link_prefix 27 xref_link_suffix
BEGINNING OF FILE
1: /****************************************************************************/ 2: /* */ 3: /* FACILITY: Routine Analyzer */ 4: /* */ 5: /* MODULE: HTML 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 HTML format, suitable for viewing with a World-Wide */ 12: /* Web browser. */ 13: /* */ 14: /* REVISION HISTORY: */ 15: /* */ 16: /* V0.1-00 24-AUG-1994 Steve Branam */ 17: /* */ 18: /* Original version. */ 19: /* */ 20: /****************************************************************************/ 21: 22: #include <stdio.h> 23: #include "ranalyzer.h" 24: #include "reports.h" 25:
26: #define calls_link_suffix() (rpt_source_enabled() ? "</A>" : "")END calls_link_suffix. Go to: Beginning of routine.
27: #define xref_link_suffix() (rpt_xrefs_enabled() ? "</A>" : "")END xref_link_suffix. Go to: Beginning of routine.
28: #define byfile_link_suffix() (rpt_byfile_enabled() ? "</A>" : "")END byfile_link_suffix. Go to: Beginning of routine.
29: #define source_link_suffix() (rpt_source_enabled() ? "</A>" : "")END source_link_suffix. Go to: Beginning of routine.
30: 31: /* Section navigation hyperlink */ 32: /* information. */ 33: static HTML_SECTION mSections[] = { 34: {NULL, "table_of_contents", NULL, NULL, NULL, NULL, NULL}, 35: {HTML_SECTION_FILES, "source_files_section", 36: OUTFILE_SUFFIX_FILES, NULL, 37: OUTFILE_SUFFIX_BYFILE, NULL, 38: "file", NULL}, 39: {HTML_SECTION_BYFILE, "routines_by_file_section", 40: OUTFILE_SUFFIX_BYFILE, OUTFILE_SUFFIX_MOREBYFILE, 41: OUTFILE_SUFFIX_DEFLIST, OUTFILE_SUFFIX_FILES, 42: "file", "routine", "f"}, 43: {HTML_SECTION_DEFINED, "defined_routines_section", 44: OUTFILE_SUFFIX_DEFLIST, NULL, 45: OUTFILE_SUFFIX_UNDEFLIST, 46: OUTFILE_SUFFIX_BYFILE, "routine", NULL, NULL}, 47: {HTML_SECTION_UNDEFINED, "undefined_routines_section", 48: OUTFILE_SUFFIX_UNDEFLIST, NULL, 49: OUTFILE_SUFFIX_CALLS, OUTFILE_SUFFIX_DEFLIST, 50: "routine", NULL, NULL}, 51: {HTML_SECTION_CALLS, "routine_calls_section", 52: OUTFILE_SUFFIX_CALLS, NULL, 53: OUTFILE_SUFFIX_XREF, OUTFILE_SUFFIX_UNDEFLIST, 54: "routine", NULL, "c"}, 55: {HTML_SECTION_XREF, "caller_xref_section", 56: OUTFILE_SUFFIX_XREF, OUTFILE_SUFFIX_MOREXREF, 57: OUTFILE_SUFFIX_CALLTREES, OUTFILE_SUFFIX_CALLS, 58: "routine", NULL, "x"}, 59: {HTML_SECTION_TREES, "routine_call_trees_section", 60: OUTFILE_SUFFIX_CALLTREES, OUTFILE_SUFFIX_MORETREES, 61: OUTFILE_SUFFIX_FIRSTSOURCE, 62: OUTFILE_SUFFIX_XREF, "tree", NULL, "t"}, 63: {HTML_SECTION_SOURCE, "source_code_section", 64: OUTFILE_SUFFIX_FIRSTSOURCE, OUTFILE_SUFFIX_SOURCE, 65: NULL, OUTFILE_SUFFIX_CALLTREES, 66: "file", NULL, "s"} 67: }; 68: 69: /*************************************************************************++*/
70: void assign_xreffiles( 71: /* Assigns the Xref file numbers for routine definitions. */ 72: 73: /* No arguments. */ 74: 75: ) /* No return value. */ 76: /*****************************************************************--*/ 77: 78: { 79: int xreffile; /* Xref file number. */ 80: int lines; /* Number of lines of def/refs. */ 81: DEFINITION /* Current definition entry. */ 82: *curdef; 83: 84: for (xreffile = lines = 0, curdef = list_first(global_deflist()); 85: curdef != NULL; 86: curdef = next_entry(curdef)) { 87: set_def_xreffile(curdef, xreffile); 88: lines += def_num_callers(curdef) + def_num_calls(curdef) + 5; 89: if (lines > max_html_xref()) { 90: lines = 0; 91: xreffile++; 92: } 93: } 94: }END assign_xreffiles. Go to: Beginning of routine.
95: 96: /*************************************************************************++*/
97: void assign_byfilefiles( 98: /* Assigns the by-file file numbers for routine definitions. */ 99: 100: /* No arguments. */ 101: 102: ) /* No return value. */ 103: /*****************************************************************--*/ 104: 105: { 106: int byfilefile; /* By-file file number. */ 107: int lines; /* Number of lines of def/refs. */ 108: SOURCEFILE /* Current file entry. */ 109: *curfile; 110: 111: for (byfilefile = lines = 0, curfile = list_first(global_filelist()); 112: curfile != NULL; 113: curfile = next_entry(curfile)) { 114: set_source_byfilefile(curfile, byfilefile); 115: lines += source_routines(curfile) + 10; 116: if (lines > max_html_byfile()) { 117: lines = 0; 118: byfilefile++; 119: } 120: } 121: }END assign_byfilefiles. Go to: Beginning of routine.
122: 123: /*************************************************************************++*/
124: char *link_url( 125: /* Formats an HTML link URL portion. */ 126: 127: char *aFileName 128: /* (READ, BY ADDR): */ 129: /* Report file name portion. */ 130: 131: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 132: /* address of a statically-defined string buffer, so the string */ 133: /* must be read from it immediately. */ 134: /*****************************************************************--*/ 135: 136: { 137: /* Trace name string buffer. */ 138: static char strbuf[MAX_FILE_NAME + 60]; 139: 140: if (url_prefix()) { 141: sprintf(strbuf, "%s%s%s%s", url_prefix(), outfile_prefix(), aFileName, 142: OUTFILE_EXT_HTML); 143: } 144: else { 145: sprintf(strbuf, "%s%s%s", outfile_prefix(), aFileName, 146: OUTFILE_EXT_HTML); 147: } 148: return strbuf; 149: }END link_url. Go to: Beginning of routine.
150: 151: #if 1
152: #define tree_link(d,f) xref_link(d,f)END tree_link. Go to: Beginning of routine.
153: #else 154: /*************************************************************************++*/ 155: char *tree_link( 156: /* Formats a hyperlink to a routine's call tree if one exists. */ 157: 158: DEFINITION 159: *aDef, 160: /* (READ, BY ADDR): */ 161: /* Routine definition entry to link to. */ 162: 163: int vSameFile 164: /* (READ, BY VAL): */ 165: /* Flag indicating whether this is link within same HTML file. */ 166: 167: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 168: /* address of a statically-defined string buffer, so the string */ 169: /* must be read from it immediately. */ 170: /*****************************************************************--*/ 171: 172: { 173: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 174: char outputname[MAX_FILE_NAME + 1]; /* Report file name buffer. */ 175: 176: if (!rpt_trees_enabled()) { /* Linking is valid only if */ 177: return ""; /* report generated. */ 178: } 179: else { 180: if (!vSameFile) { 181: if (def_treefile(aDef)) { 182: sprintf(outputname, OUTFILE_SUFFIX_MORETREES, 183: def_treefile(aDef)); 184: } 185: else { 186: strcpy(outputname, OUTFILE_SUFFIX_CALLTREES); 187: } 188: } 189: /* If routine needs a separate */ 190: /* tree or is expanded within */ 191: /* some other tree, make link. */ 192: if (needs_tree(aDef) || def_root(aDef) != NULL) { 193: sprintf(link, "<A HREF=\"%s#t%lx\">%s</A>", 194: (vSameFile ? "" : link_url(outputname)), 195: #if 0 196: (needs_tree(aDef) ? aDef : def_root(aDef)), 197: (needs_tree(aDef) ? "Tree" : "Root")); 198: #else 199: aDef, "Tree"); 200: #endif 201: return link; 202: } 203: else { /* Otherwise, no tree exists. */ 204: return "No tree"; 205: } 206: } 207: } 208: #endif 209: 210: /*************************************************************************++*/
211: char *source_link_prefix( 212: /* Formats the prefix for a hyperlink to a routine's source code. */ 213: 214: DEFINITION 215: *aDef, 216: /* (READ, BY ADDR): */ 217: /* Routine definition entry to link to. */ 218: 219: int vSameFile 220: /* (READ, BY VAL): */ 221: /* Flag indicating whether this is link within same HTML file. */ 222: 223: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 224: /* address of a statically-defined string buffer, so the string */ 225: /* must be read from it immediately. */ 226: /*****************************************************************--*/ 227: 228: { 229: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 230: char linkname[MAX_FILE_NAME + 1]; /* Source file name. */ 231: 232: if (!rpt_source_enabled()) { /* Linking is valid only if */ 233: return ""; /* report generated. */ 234: } 235: else { 236: if (!vSameFile) { 237: sprintf(linkname, OUTFILE_SUFFIX_SOURCE, 238: source_seq(def_source(aDef))); 239: } 240: sprintf(link, "<A HREF=\"%s#d%lx\">", 241: (vSameFile ? "" : link_url(linkname)), aDef); 242: return link; 243: } 244: }END source_link_prefix. Go to: Beginning of routine.
245: 246: /*************************************************************************++*/
247: char *source_link( 248: /* Formats a hyperlink to a routine's source code. */ 249: 250: DEFINITION 251: *aDef, 252: /* (READ, BY ADDR): */ 253: /* Routine definition entry to link to. */ 254: 255: int vSameFile 256: /* (READ, BY VAL): */ 257: /* Flag indicating whether this is link within same HTML file. */ 258: 259: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 260: /* address of a statically-defined string buffer, so the string */ 261: /* must be read from it immediately. */ 262: /*****************************************************************--*/ 263: 264: { 265: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 266: 267: if (!rpt_source_enabled()) { /* Linking is valid only if */ 268: return ""; /* report generated. */ 269: } 270: else if (isdefined_routine(aDef)) { 271: sprintf(link, "%sSource%s", source_link_prefix(aDef, vSameFile), 272: source_link_suffix()); 273: return link; 274: } 275: else { 276: return "No source"; 277: } 278: }END source_link. Go to: Beginning of routine.
279: 280: /*************************************************************************++*/
281: char *sourcefile_link_prefix( 282: /* Formats the prefix for a hyperlink to a file's source code. */ 283: 284: SOURCEFILE 285: *aSourceFile 286: /* (READ, BY ADDR): */ 287: /* Source file entry to link to. */ 288: 289: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 290: /* address of a statically-defined string buffer, so the string */ 291: /* must be read from it immediately. */ 292: /*****************************************************************--*/ 293: 294: { 295: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 296: char linkname[MAX_FILE_NAME + 1]; /* Source file name. */ 297: 298: if (!rpt_source_enabled()) { /* Linking is valid only if */ 299: return ""; /* report generated. */ 300: } 301: else { 302: sprintf(linkname, OUTFILE_SUFFIX_SOURCE, source_seq(aSourceFile)); 303: sprintf(link, "<A HREF=\"%s\">", link_url(linkname), aSourceFile); 304: return link; 305: } 306: }END sourcefile_link_prefix. Go to: Beginning of routine.
307: 308: /*************************************************************************++*/
309: char *calls_link_prefix( 310: /* Formats the prefix for a hyperlink to a routine's calls/callers. */ 311: 312: DEFINITION 313: *aDef, 314: /* (READ, BY ADDR): */ 315: /* Routine definition entry to link to. */ 316: 317: int vSameFile 318: /* (READ, BY VAL): */ 319: /* Flag indicating whether this is link within same HTML file. */ 320: 321: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 322: /* address of a statically-defined string buffer, so the string */ 323: /* must be read from it immediately. */ 324: /*****************************************************************--*/ 325: 326: { 327: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 328: 329: if (!rpt_calls_enabled()) { /* Linking is valid only if */ 330: return ""; /* report generated. */ 331: } 332: else { 333: sprintf(link, "<A HREF=\"%s#c%lx\">", 334: (vSameFile ? "" : link_url(OUTFILE_SUFFIX_CALLS)), aDef); 335: return link; 336: } 337: }END calls_link_prefix. Go to: Beginning of routine.
338: 339: /*************************************************************************++*/
340: char *xref_link_prefix( 341: /* Formats the prefix for a hyperlink to a routine's caller */ 342: /* cross-references. */ 343: 344: DEFINITION 345: *aDef, 346: /* (READ, BY ADDR): */ 347: /* Routine definition entry to link to. */ 348: 349: int vSameFile 350: /* (READ, BY VAL): */ 351: /* Flag indicating whether this is link within same HTML file. */ 352: 353: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 354: /* address of a statically-defined string buffer, so the string */ 355: /* must be read from it immediately. */ 356: /*****************************************************************--*/ 357: 358: { 359: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 360: char outputname[MAX_FILE_NAME + 1]; /* Report file name buffer. */ 361: 362: if (!rpt_xrefs_enabled()) { /* Linking is valid only if */ 363: return ""; /* report generated. */ 364: } 365: else { 366: if (!vSameFile) { 367: if (def_xreffile(aDef)) { 368: sprintf(outputname, OUTFILE_SUFFIX_MOREXREF, 369: def_xreffile(aDef)); 370: } 371: else { 372: strcpy(outputname, OUTFILE_SUFFIX_XREF); 373: } 374: } 375: sprintf(link, "<A HREF=\"%s#x%lx\">", 376: (vSameFile ? "" : link_url(outputname)), aDef); 377: return link; 378: } 379: }END xref_link_prefix. Go to: Beginning of routine.
380: 381: /*************************************************************************++*/
382: char *xref_link( 383: /* Formats a hyperlink to a routine's caller cross-references. */ 384: 385: DEFINITION 386: *aDef, 387: /* (READ, BY ADDR): */ 388: /* Routine definition entry to link to. */ 389: 390: int vSameFile 391: /* (READ, BY VAL): */ 392: /* Flag indicating whether this is link within same HTML file. */ 393: 394: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 395: /* address of a statically-defined string buffer, so the string */ 396: /* must be read from it immediately. */ 397: /*****************************************************************--*/ 398: 399: { 400: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 401: 402: if (!rpt_xrefs_enabled()) { /* Linking is valid only if */ 403: return ""; /* report generated. */ 404: } 405: else { 406: sprintf(link, "%sGoto%s", xref_link_prefix(aDef, vSameFile), 407: xref_link_suffix()); 408: return link; 409: } 410: }END xref_link. Go to: Beginning of routine.
411: 412: /*************************************************************************++*/
413: char *byfile_link_prefix( 414: /* Formats the prefix for a hyperlink to a file's routine listing. */ 415: 416: SOURCEFILE 417: *aSourceFile, 418: /* (READ, BY ADDR): */ 419: /* File entry to link to. */ 420: 421: int vSameFile 422: /* (READ, BY VAL): */ 423: /* Flag indicating whether this is link within same HTML file. */ 424: 425: ) /* Returns formatted string ptr. WARNING: The returned ptr is the */ 426: /* address of a statically-defined string buffer, so the string */ 427: /* must be read from it immediately. */ 428: /*****************************************************************--*/ 429: 430: { 431: static char link[MAX_FILE_NAME + 64]; /* Link string buffer. */ 432: 433: if (!rpt_byfile_enabled()) { /* Linking is valid only if */ 434: return ""; /* report generated. */ 435: } 436: else { 437: sprintf(link, "<A HREF=\"%s#f%lx\">", 438: (vSameFile ? "" : link_url(OUTFILE_SUFFIX_BYFILE)), aSourceFile); 439: return link; 440: } 441: }END byfile_link_prefix. Go to: Beginning of routine.
442: 443: /*************************************************************************++*/
444: void rpt_html_section_nav( 445: /* Writes a set of common HTML section navigation links to the report file. */ 446: /* These links go to the table of contents, and the next and previous */ 447: /* sections. */ 448: 449: FILE *aRptFile, 450: /* (READ, BY ADDR): */ 451: /* Report output file. Must be opened by caller. */ 452: 453: HTML_SECTION_TYPE 454: vSection, 455: /* (READ, BY VAL): */ 456: /* Section number to write. */ 457: 458: int vLast 459: /* (READ, BY VAL): */ 460: /* Flag indicating this is last entry in section. */ 461: 462: ) /* No return value. */ 463: /*****************************************************************--*/ 464: 465: { 466: char fname[MAX_FILE_NAME + 1]; /* File name buffer. */ 467: 468: fprintf(aRptFile, "Go to: <A HREF=\"%s#%s\">Contents</a>", 469: link_url(OUTFILE_SUFFIX_FILES), 470: section_anchor(mSections, MAIN_SECTION)); 471: if (section_nextsuffix(mSections, vSection) != NULL) { 472: fprintf(aRptFile, "; <A HREF=\"%s\">Next section</a>", 473: link_url(section_nextsuffix(mSections, vSection))); 474: } 475: if (section_prevsuffix(mSections, vSection) != NULL) { 476: fprintf(aRptFile, "; <A HREF=\"%s\">Previous section</a>", 477: link_url(section_prevsuffix(mSections, vSection))); 478: } 479: }END rpt_html_section_nav. Go to: Beginning of routine.
480: 481: /*************************************************************************++*/
482: void rpt_html_section_title( 483: /* Writes a common HTML section title report file. */ 484: 485: FILE *aRptFile, 486: /* (READ, BY ADDR): */ 487: /* Report output file. Must be opened by caller. */ 488: 489: char *aSubTitle 490: /* (READ, BY ADDR): */ 491: /* Optional subtitle string to add to title. If NULL is passed, */ 492: /* only main title will be written. */ 493: 494: ) /* No return value. */ 495: /*****************************************************************--*/ 496: 497: { 498: fprintf(aRptFile, 499: "<TITLE>%s Source File Analysis%s%s</TITLE>\n", product_name(), 500: (aSubTitle == NULL ? "" : " - "), 501: (aSubTitle == NULL ? "" : aSubTitle)); 502: }END rpt_html_section_title. Go to: Beginning of routine.
503: 504: /*************************************************************************++*/
505: void rpt_html_section_hdr( 506: /* Writes a common HTML section header to the report file. This includes a */ 507: /* title, a level-one header, and optionally navigation links to other */ 508: /* sections. */ 509: 510: FILE *aRptFile, 511: /* (READ, BY ADDR): */ 512: /* Report output file. Must be opened by caller. */ 513: 514: HTML_SECTION_TYPE 515: vSection 516: /* (READ, BY VAL): */ 517: /* Section number to write. */ 518: 519: ) /* No return value. */ 520: /*****************************************************************--*/ 521: 522: { 523: FILE *dscfile; /* Description file. */ 524: char dscbuf[256]; /* Description file line */ 525: /* buffer. */ 526: 527: rpt_html_section_title(aRptFile, 528: (ismain_section(vSection) ? NULL : section_name(mSections, vSection))); 529: 530: if (ismain_section(vSection)) { /* Write main header. */ 531: fprintf(aRptFile, "<H1>%s Source File Analysis</H1>\n", 532: product_name()); 533: 534: if (product_description() != NULL) { 535: if ((dscfile = fopen(product_description(), "r")) != NULL) { 536: while (fgets(dscbuf, sizeof(dscbuf), dscfile) != NULL) { 537: fputs(dscbuf, aRptFile); 538: } 539: fclose(dscfile); 540: } 541: else { 542: printf( 543: "WARNING: Unable to open description file %s for input\n", 544: product_description()); 545: } 546: } 547: 548: fputs("<A NAME=\"table_of_contents\">\n", aRptFile); 549: fputs("<H2>Contents</H2></A>\n", aRptFile); 550: fputs("The following sections contain information that was\n", 551: aRptFile); 552: fputs("generated by automated analysis of the\n", aRptFile); 553: fprintf(aRptFile, "%s source files.<P>\n", product_name()); 554: 555: fputs("<UL>\n", aRptFile); 556: if (rpt_files_enabled()) 557: fputs("<LI> <A HREF=\"#source_files_section\">Source Files</A>\n", 558: aRptFile); 559: if (rpt_byfile_enabled()) 560: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Defined Routines By File</A>\n", 561: link_url(OUTFILE_SUFFIX_BYFILE)); 562: if (rpt_defined_enabled()) 563: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Defined Routines Alphabetical</A>\n", 564: link_url(OUTFILE_SUFFIX_DEFLIST)); 565: if (rpt_undefined_enabled()) 566: fprintf(aRptFile, "<LI> <A HREF=\"%s\">External Routines Alphabetical</A>\n", 567: link_url(OUTFILE_SUFFIX_UNDEFLIST)); 568: if (rpt_calls_enabled()) 569: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Defined Routines Calls/Callers</A>\n", 570: link_url(OUTFILE_SUFFIX_CALLS)); 571: if (rpt_xrefs_enabled()) 572: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Caller Cross Reference</A>\n", 573: link_url(OUTFILE_SUFFIX_XREF)); 574: if (rpt_trees_enabled()) 575: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Routine Call Trees</A>\n", 576: link_url(OUTFILE_SUFFIX_CALLTREES)); 577: if (rpt_source_enabled()) 578: fprintf(aRptFile, "<LI> <A HREF=\"%s\">Source Code</A>\n", 579: link_url(OUTFILE_SUFFIX_FIRSTSOURCE)); 580: fputs("</UL>\n", aRptFile); 581: 582: fputs("For information on the software used to generate this\n", aRptFile); 583: fputs("analysis, contact Steve Branam, Network Products\n", aRptFile); 584: fputs("Support Group, Digital Equipment Corporation,\n", aRptFile); 585: fputs("Littleton, MA, USA.<P>\n", aRptFile); 586: fputs("\n<HR>\n<HR>\n\n", aRptFile); 587: } 588: else { /* Write section header. */ 589: fprintf(aRptFile, "<A NAME=\"%s\">\n", 590: section_anchor(mSections, vSection)); 591: fprintf(aRptFile, "<H1>%s</H1></a>\n", 592: section_name(mSections, vSection)); 593: rpt_html_section_nav(aRptFile, vSection, 0); 594: fputs("</A>.<P>\n", aRptFile); 595: } 596: }END rpt_html_section_hdr. Go to: Beginning of routine.
597: 598: /*************************************************************************++*/
599: void rpt_html_subsection_hdr( 600: /* Writes a common HTML subsection header to the report file. This */ 601: /* includes navigation links to other sections and subsections. */ 602: 603: FILE *aRptFile, 604: /* (READ, BY ADDR): */ 605: /* Report output file. Must be opened by caller. */ 606: 607: HTML_SECTION_TYPE 608: vSection, 609: /* (READ, BY VAL): */ 610: /* Section number to write. */ 611: 612: void *aNext, 613: /* (READ, BY ADDR): */ 614: /* Next subsection object (of any type). */ 615: 616: void *aPrev, 617: /* (READ, BY ADDR): */ 618: /* Previous subsection object (of any type). */ 619: 620: char *aFileSuffix, 621: /* (READ, BY ADDR): */ 622: /* Optional filename suffix for linking across continuation */ 623: /* files. If NULL is passed, next/prev links will be within */ 624: /* current file. Otherwise, next or prev link (whichever one is */ 625: /* NULL) is within a different file. */ 626: 627: int vFileNumber 628: /* (READ, BY VAL): */ 629: /* File number for linking across continuation files. */ 630: /* If this is zero and aFileSuffix is non-NULL, the file name */ 631: /* will come from the mSections table. If it is non-zero and */ 632: /* aFileSuffix is non-NULL, aFileSuffix will be used with the */ 633: /* number to form the name. */ 634: 635: ) /* No return value. */ 636: /*****************************************************************--*/ 637: 638: { 639: char fname[MAX_FILE_NAME + 1]; /* File name buffer. */ 640: 641: rpt_html_section_nav(aRptFile, vSection, (aNext == NULL)); 642: if (aFileSuffix != NULL) { 643: if (vFileNumber) { 644: sprintf(fname, aFileSuffix, vFileNumber); 645: } 646: else { 647: strcpy(fname, section_suffix(mSections, vSection)); 648: } 649: } 650: fprintf(aRptFile, "; <A HREF=\"%s\">Beginning of section</a>", 651: link_url(section_suffix(mSections, vSection))); 652: 653: if (aNext != NULL) { 654: fprintf(aRptFile, "; <A HREF=\"%s#%s%lx\">Next %s in section</a>", 655: (aFileSuffix != NULL ? link_url(fname) : ""), 656: section_subanchor(mSections, vSection), aNext, 657: section_objstr(mSections, vSection)); 658: } 659: 660: if (aPrev != NULL) { 661: fprintf(aRptFile, "; <A HREF=\"%s#%s%lx\">Previous %s in section</a>", 662: (aFileSuffix != NULL ? link_url(fname) : ""), 663: section_subanchor(mSections, vSection), aPrev, 664: section_objstr(mSections, vSection)); 665: } 666: fputs(".<P>\n", aRptFile); 667: }END rpt_html_subsection_hdr. Go to: Beginning of routine.
668: 669: /*************************************************************************++*/
670: int rpt_html_continue( 671: /* Continues an HTML report in a new output file, adding links between the */ 672: /* files. */ 673: 674: FILE **aRptFile, 675: /* (MODIFY, BY ADDR): */ 676: /* Report file ptr. The current file will be linked and closed */ 677: /* through this ptr, and the new file will be opened through */ 678: /* it, leaving it set to the new file information. */ 679: 680: HTML_SECTION_TYPE 681: vSection, 682: /* (READ, BY VAL): */ 683: /* Section number being reported. */ 684: 685: void *aCurrent, 686: /* (READ, BY ADDR): */ 687: /* Current subsection object (of any type) to be reported. */ 688: 689: int vCurFileNumber, 690: /* (READ, BY VAL): */ 691: /* Current file number being ended. */ 692: 693: int vNextFileNumber 694: /* (READ, BY VAL): */ 695: /* Next file number to be started. */ 696: 697: ) /* Returns vNextFileNumber, next file number started if successful, */ 698: /* or 0 if continuation failed. */ 699: /*****************************************************************--*/ 700: 701: { 702: char rptname[MAX_FILE_NAME + 1]; /* Report file name prefix. */ 703: char outputname[MAX_FILE_NAME + 1]; /* Report file name buffer. */ 704: 705: /* Write ending link to next */ 706: /* object and close file. */ 707: rpt_html_subsection_hdr(*aRptFile, vSection, aCurrent, NULL, 708: section_moresuffix(mSections, vSection), vNextFileNumber); 709: fclose(*aRptFile); 710: 711: /* Open next file. */ 712: sprintf(rptname, section_moresuffix(mSections, vSection), vNextFileNumber); 713: if ((*aRptFile = fopen(make_filename(outfile_prefix(), rptname, 714: report_filext(), outputname), "w")) == NULL) { 715: printf("ERROR: Unable to open %s for report output\n", rptname); 716: return 0; 717: } 718: else { 719: if (log_enabled()) { 720: printf(" Continuing report section in file %s\n", outputname); 721: } 722: /* Write HTML title, starting */ 723: /* link to previous object. */ 724: rpt_html_section_title(*aRptFile, section_name(mSections, vSection)); 725: rpt_html_subsection_hdr(*aRptFile, vSection, NULL, 726: entry_blink((LIST_ENTRY_HDR *) aCurrent), 727: section_moresuffix(mSections, vSection), vCurFileNumber); 728: return vNextFileNumber; 729: } 730: }END rpt_html_continue. Go to: Beginning of routine.
731: 732: /*************************************************************************++*/
733: void rpt_defined_html_hdr( 734: /* Writes HTML-formatted report header for defined routines. */ 735: 736: FILE *aRptFile 737: /* (READ, BY ADDR): */ 738: /* Report output file. Must be opened by caller. */ 739: 740: ) /* No return value. */ 741: /*****************************************************************--*/ 742: 743: { 744: rpt_html_section_hdr(aRptFile, DEFINED_ROUTINES_SECTION); 745: fputs("<PRE>\n", aRptFile); 746: fputs( 747: "========================================================================\n", 748: aRptFile); 749: fputs( 750: " # Times\n", 751: aRptFile); 752: fputs( 753: "Routine Line Length Calls Called\n", 754: aRptFile); 755: fputs( 756: "------------------------------------------------------------------------\n", 757: aRptFile); 758: }END rpt_defined_html_hdr. Go to: Beginning of routine.
759: 760: /*************************************************************************++*/
761: void rpt_defined_html_entry( 762: /* Writes HTML-formatted routine entry for a defined routine. */ 763: 764: FILE *aRptFile, 765: /* (READ, BY ADDR): */ 766: /* Report output file. Must be opened by caller. */ 767: 768: DEFINITION 769: *aDef, 770: /* (READ, BY ADDR): */ 771: /* Routine definition entry to report. */ 772: 773: int vFirst, 774: /* (READ, BY VAL): */ 775: /* Flag indicating whether this is first entry in table. */ 776: 777: int vLast 778: /* (READ, BY VAL): */ 779: /* Flag indicating whether this is last entry in table. */ 780: 781: ) /* No return value. */ 782: /*****************************************************************--*/ 783: 784: { 785: char fullname[MAX_ROUTINE_IDENT + 1];/* Routine fullname buffer. */ 786: /* Routine name folding buffer. */ 787: char rname[RPT_HTML_ROUTINE_MEDIUM_LEN + 1]; 788: int pos; /* Pos in routine name to */ 789: /* print. */ 790: 791: strcpy(fullname, def_ident(aDef)); 792: /* Get first part of rout name. */ 793: pos = fold_string(fullname, 0, NULL, rname, RPT_HTML_ROUTINE_MEDIUM_LEN); 794: 795: fprintf(aRptFile, "%-40s ", rname); 796: #if 0 797: fprintf(aRptFile,"%s%7ld%s %7ld ", 798: source_link_prefix(aDef, 0), def_begin(aDef), source_link_suffix(), 799: def_length(aDef)); 800: #else 801: fprintf(aRptFile,"%7ld %7ld ", def_begin(aDef), def_length(aDef)); 802: #endif 803: fprintf(aRptFile,"%s%7ld%s %s%7ld%s\n", 804: (vLast ? "<A NAME=\"defined_routines_section_last\">" : ""), 805: def_num_calls(aDef), (vLast ? "</A>" : ""), xref_link_prefix(aDef, 0), 806: def_num_callers(aDef), xref_link_suffix()); 807: 808: while (pos < strlen(fullname)) { 809: pos = fold_string(fullname, pos, " ", rname, 810: RPT_HTML_ROUTINE_MEDIUM_LEN); 811: fprintf(aRptFile, "%s\n", rname); 812: } 813: }END rpt_defined_html_entry. Go to: Beginning of routine.
814: 815: /*************************************************************************++*/
816: void rpt_defined_html_end( 817: /* Writes HTML-formatted report end for defined routines. */ 818: 819: FILE *aRptFile, 820: /* (READ, BY ADDR): */ 821: /* Report output file. Must be opened by caller. */ 822: 823: long vTotalDef 824: /* (READ, BY VAL): */ 825: /* Total number of defined routines. */ 826: 827: ) /* No return value. */ 828: /*****************************************************************--*/ 829: 830: { 831: fputs( 832: "-------------------------------------------------------------------------\n", 833: aRptFile); 834: fprintf(aRptFile, "TOTAL: %ld routines\n", vTotalDef); 835: fputs( 836: "=========================================================================\n", 837: aRptFile); 838: fputs("</PRE>\n<HR>\n<HR>\n", aRptFile); 839: }END rpt_defined_html_end. Go to: Beginning of routine.
840: 841: /*************************************************************************++*/
842: void rpt_undefined_html_hdr( 843: /* Writes HTML-formatted report header for undefined routines. */ 844: 845: FILE *aRptFile 846: /* (READ, BY ADDR): */ 847: /* Report output file. Must be opened by caller. */ 848: 849: ) /* No return value. */ 850: /*****************************************************************--*/ 851: 852: { 853: rpt_html_section_hdr(aRptFile, UNDEFINED_ROUTINES_SECTION); 854: fputs("<PRE>\n", aRptFile); 855: fputs( 856: "================================================\n", 857: aRptFile); 858: fputs( 859: " Times\n", 860: aRptFile); 861: fputs( 862: "Routine Called\n", 863: aRptFile); 864: fputs( 865: "------------------------------------------------\n", 866: aRptFile); 867: }END rpt_undefined_html_hdr. Go to: Beginning of routine.
868: 869: /*************************************************************************++*/
870: void rpt_undefined_html_entry( 871: /* Writes HTML-formatted routine entry for a undefined routine. */ 872: 873: FILE *aRptFile, 874: /* (READ, BY ADDR): */ 875: /* Report output file. Must be opened by caller. */ 876: 877: DEFINITION 878: *aDef, 879: /* (READ, BY ADDR): */ 880: /* Routine definition entry to report. */ 881: 882: int vFirst, 883: /* (READ, BY VAL): */ 884: /* Flag indicating whether this is first entry in table. */ 885: 886: int vLast 887: /* (READ, BY VAL): */ 888: /* Flag indicating whether this is last entry in table. */ 889: 890: ) /* No return value. */ 891: /*****************************************************************--*/ 892: 893: { 894: char fullname[MAX_ROUTINE_IDENT + 1];/* Routine fullname buffer. */ 895: /* Routine name folding buffer. */ 896: char rname[RPT_HTML_ROUTINE_MEDIUM_LEN + 1]; 897: int pos; /* Pos in routine name to */ 898: /* print. */ 899: 900: strcpy(fullname, def_name(aDef)); 901: /* Get first part of rout name. */ 902: pos = fold_string(fullname, 0, NULL, rname, RPT_HTML_ROUTINE_MEDIUM_LEN); 903: 904: fprintf(aRptFile,"%s%-40s%s %s%7ld%s\n", 905: (vLast ? "<A NAME=\"undefined_routines_section_last\">" : ""), 906: rname, (vLast ? "</A>" : ""), xref_link_prefix(aDef, 0), 907: def_num_callers(aDef), xref_link_suffix()); 908: 909: while (pos < strlen(fullname)) { 910: pos = fold_string(fullname, pos, " ", rname, 911: RPT_HTML_ROUTINE_MEDIUM_LEN); 912: fprintf(aRptFile, "%s\n", rname); 913: } 914: }END rpt_undefined_html_entry. Go to: Beginning of routine.
915: 916: /*************************************************************************++*/
917: void rpt_undefined_html_end( 918: /* Writes HTML-formatted report end for undefined routines. */ 919: 920: FILE *aRptFile, 921: /* (READ, BY ADDR): */ 922: /* Report output file. Must be opened by caller. */ 923: 924: long vTotalUndef 925: /* (READ, BY VAL): */ 926: /* Total number of undefined routines. */ 927: 928: ) /* No return value. */ 929: /*****************************************************************--*/ 930: 931: { 932: fputs( 933: "------------------------------------------------\n", 934: aRptFile); 935: fprintf(aRptFile, "TOTAL: %ld routines\n", vTotalUndef); 936: fputs( 937: "================================================\n", 938: aRptFile); 939: fputs("</PRE>\n<HR>\n<HR>\n", aRptFile); 940: }END rpt_undefined_html_end. Go to: Beginning of routine.
941: 942: /*************************************************************************++*/
943: void rpt_calls_html_hdr( 944: /* Writes HTML-formatted report header for defined routine calls/callers */ 945: /* table. */ 946: 947: FILE *aRptFile, 948: /* (READ, BY ADDR): */ 949: /* Report output file. Must be opened by caller. */ 950: 951: DEFINITION 952: *aDef 953: /* (READ, BY ADDR): */ 954: /* Routine definition entry to report. */ 955: 956: ) /* No return value. */ 957: /*****************************************************************--*/ 958: 959: { 960: rpt_html_section_hdr(aRptFile, CALLS_CALLERS_SECTION); 961: fputs("<HR>\n\n", aRptFile); 962: 963: fprintf(aRptFile, 964: "<TABLE>(%s Calls/Caller Routines)\n", def_ident(aDef)); 965: fputs("<TABLE_ATTRIBUTES>(MULTIPAGE)\n", aRptFile); 966: fputs("<TABLE_SETUP>(4\\20\\5\\20)\n", aRptFile); 967: fputs("<TABLE_HEADS>(Calls Routine\\Line\\Caller Routine\\Line)\n", 968: aRptFile); 969: }END rpt_calls_html_hdr. Go to: Beginning of routine.
970: 971: /*************************************************************************++*/
972: void rpt_calls_html_entry( 973: /* Writes HTML-formatted calls/caller entry for a defined routine. */ 974: 975: FILE *aRptFile, 976: /* (READ, BY ADDR): */ 977: /* Report output file. Must be opened by caller. */ 978: 979: REFERENCE 980: *aCalled, 981: /* (READ, BY ADDR): */ 982: /* Called routine reference entry to report. If NULL is passed, */ 983: /* only a caller is being reported. */ 984: 985: REFERENCE 986: *aCaller 987: /* (READ, BY ADDR): */ 988: /* Caller routine reference entry to report. If NULL is passed, */ 989: /* only a called routine is being reported. */ 990: 991: ) /* No return value. */ 992: /*****************************************************************--*/ 993: 994: { 995: fprintf(aRptFile, "<TABLE_ROW>("); 996: if (aCalled == NULL) { 997: fprintf(aRptFile, "\\\\"); 998: } 999: else { 1000: fprintf(aRptFile, "%s\\%ld\\", def_name(ref_definition(aCalled)), 1001: ref_offset(aCalled)); 1002: } 1003: if (aCaller == NULL) { 1004: fprintf(aRptFile, "\\)\n"); 1005: } 1006: else { 1007: fprintf(aRptFile, "%s\\%ld)\n", def_name(ref_caller(aCaller)), 1008: ref_offset(aCaller)); 1009: } 1010: }END rpt_calls_html_entry. Go to: Beginning of routine.
1011: 1012: /*************************************************************************++*/
1013: void rpt_calls_html_end( 1014: /* Writes HTML-formatted report end for defined routine calls/caller */ 1015: /* table. */ 1016: 1017: FILE *aRptFile, 1018: /* (READ, BY ADDR): */ 1019: /* Report output file. Must be opened by caller. */ 1020: 1021: DEFINITION 1022: *aDef 1023: /* (READ, BY ADDR): */ 1024: /* Routine definition entry to report. */ 1025: 1026: ) /* No return value. */ 1027: /*****************************************************************--*/ 1028: 1029: { 1030: fputs("<TABLE_ROW>(<SPAN>(4)<RULE>)\n", aRptFile); 1031: fprintf(aRptFile, "<TABLE_ROW>(<EMPHASIS>(TOTAL CALLS: %ld\\BOLD)\\\\\n", 1032: def_num_calls(aDef)); 1033: fprintf(aRptFile, " <EMPHASIS>(TOTAL CALLERS: %ld\\BOLD)\\)\n", 1034: def_num_callers(aDef)); 1035: fputs("<ENDTABLE>\n\n", aRptFile); 1036: }END rpt_calls_html_end. Go to: Beginning of routine.
1037: 1038: /*************************************************************************++*/
1039: void rpt_xref_html_hdr( 1040: /* Writes HTML-formatted report header for cross reference. */ 1041: 1042: FILE *aRptFile 1043: /* (READ, BY ADDR): */ 1044: /* Report output file. Must be opened by caller. */ 1045: 1046: ) /* No return value. */ 1047: /*****************************************************************--*/ 1048: 1049: { 1050: rpt_html_section_hdr(aRptFile, CALLER_XREF_SECTION); 1051: fputs("<HR>\n\n", aRptFile); 1052: }END rpt_xref_html_hdr. Go to: Beginning of routine.
1053: 1054: /*************************************************************************++*/
1055: void rpt_xref_html_entry( 1056: /* Writes HTML-formatted cross-reference sections for a routine. */ 1057: 1058: FILE *aRptFile, 1059: /* (READ, BY ADDR): */ 1060: /* Report output file. Must be opened by caller. */ 1061: 1062: DEFINITION 1063: *aDef, 1064: /* (READ, BY ADDR): */ 1065: /* Routine definition entry to report. */ 1066: 1067: int vFirst, 1068: /* (READ, BY VAL): */ 1069: /* Flag indicating this is first entry being reported. */ 1070: 1071: int vLast 1072: /* (READ, BY VAL): */ 1073: /* Flag indicating this is last entry being reported. */ 1074: 1075: ) /* No return value. */ 1076: /*****************************************************************--*/ 1077: 1078: { 1079: REFERENCE /* Current caller ref. */ 1080: *caller; 1081: char fullname[MAX_ROUTINE_IDENT + 1];/* Routine fullname buffer. */ 1082: /* Routine name folding buffer. */ 1083: char rname[RPT_HTML_ROUTINE_WIDE_LEN + 1]; 1084: int rpos; /* Pos in routine name to print.*/ 1085: 1086: fprintf(aRptFile, "<H2><A NAME=\"x%lx\">%s</A> - ", aDef, def_name(aDef)); 1087: if (isdefined_routine(aDef)) { 1088: fprintf(aRptFile, "%s%s%s", source_link_prefix(aDef, 0), 1089: source_name(def_source(aDef)), source_link_suffix()); 1090: } 1091: else { 1092: fputs("External", aRptFile); 1093: } 1094: fputs("</H2><H3>Callers", aRptFile); 1095: if (def_num_callers(aDef) == 0) { 1096: fputs(": No callers</H3>\n<PRE>\n", aRptFile); 1097: } 1098: else { 1099: fputs("</H3>\n<PRE>\n", aRptFile); 1100: fprintf(aRptFile, "%ld caller%s\n", 1101: def_num_callers(aDef), (def_num_callers(aDef) == 1 ? "" : "s")); 1102: 1103: /* Write entry for each caller. */ 1104: for (caller = list_first(def_callers(aDef)); 1105: caller != NULL; 1106: caller = next_entry(caller)) { 1107: strcpy(fullname, def_ident(ref_caller(caller))); 1108: 1109: /* Get first part of rout name. */ 1110: rpos = fold_string(fullname, 0, NULL, rname, 1111: RPT_HTML_ROUTINE_WIDE_LEN); 1112: fprintf(aRptFile, "%5c+ %-48s %s\n", ' ', rname, 1113: xref_link(ref_caller(caller), 1114: (def_xreffile(aDef) == def_xreffile(ref_caller(caller))))); 1115: while (rpos < strlen(fullname)) { /* Write rest of routine name. */ 1116: rpos = fold_string(fullname, rpos, " ", rname, 1117: RPT_HTML_ROUTINE_WIDE_LEN); 1118: fprintf(aRptFile, "%5c%s\n", ' ', rname); 1119: } 1120: } 1121: } 1122: if (isdefined_routine(aDef)) { 1123: fputs("</PRE><H3>Call Tree", aRptFile); 1124: if (def_num_calls(aDef) == 0) { 1125: fputs(": No calls", aRptFile); 1126: } 1127: fputs("</H3>\n", aRptFile); 1128: } 1129: if (def_num_calls(aDef) != 0) { 1130: fputs("<PRE>\n", aRptFile); 1131: } 1132: else { 1133: fputs("<HR>\n", aRptFile); 1134: } 1135: }END rpt_xref_html_entry. Go to: Beginning of routine.
1136: 1137: /*************************************************************************++*/
1138: void rpt_xref_html_end( 1139: /* Writes HTML-formatted report end for caller cross-reference. */ 1140: 1141: FILE *aRptFile, 1142: /* (READ, BY ADDR): */ 1143: /* Report output file. Must be opened by caller. */ 1144: 1145: long vTotalDef 1146: /* (READ, BY VAL): */ 1147: /* Total number of routines. */ 1148: 1149: ) /* No return value. */ 1150: /*****************************************************************--*/ 1151: 1152: { 1153: fputs("----------------------------------------------------\n", aRptFile); 1154: fprintf(aRptFile, "TOTAL: %ld routines\n", vTotalDef); 1155: fputs("====================================================\n", aRptFile); 1156: fputs("</PRE>\n<HR>\n<HR>\n", aRptFile); 1157: }END rpt_xref_html_end. Go to: Beginning of routine.
1158: 1159: /*************************************************************************++*/
1160: void rpt_tree_html_hdr( 1161: /* Writes HTML-formatted report header for defined routine call tree. */ 1162: 1163: FILE *aRptFile, 1164: /* (READ, BY ADDR): */ 1165: /* Report output file. Must be opened by caller. */ 1166: 1167: DEFINITION 1168: *aDef, 1169: /* (READ, BY ADDR): */ 1170: /* Routine definition entry to report. */ 1171: 1172: int vFirst, 1173: /* (READ, BY VAL): */ 1174: /* Flag indicating whether this is first tree. */ 1175: 1176: int vLast 1177: /* (READ, BY VAL): */ 1178: /* Flag indicating whether this is last tree. */ 1179: 1180: ) /* No return value. */ 1181: /*****************************************************************--*/ 1182: 1183: { 1184: if (vFirst) { 1185: rpt_html_section_hdr(aRptFile, CALL_TREES_SECTION); 1186: fputs("<HR>\n\n", aRptFile); 1187: } 1188: 1189: fprintf(aRptFile, "<H2><A NAME=\"t%lx\">%s</a> %sCall Tree%s</H2>\n", 1190: aDef, def_ident(aDef), 1191: (vLast ? "<A NAME=\"routine_call_trees_section_last\">" : ""), 1192: (vLast ? "</A>" : "")); 1193: rpt_html_subsection_hdr(aRptFile, CALL_TREES_SECTION, 1194: (vLast ? NULL : next_tree(aDef)), 1195: (vFirst ? NULL : prev_tree(aDef)), NULL, 0); 1196: fputs("<PRE>\n", aRptFile); 1197: }END rpt_tree_html_hdr. Go to: Beginning of routine.
1198: 1199: /*************************************************************************++*/
1200: void rpt_tree_html_entry( 1201: /* Writes HTML-formatted call tree line for a defined routine. */ 1202: 1203: FILE *aRptFile, 1204: /* (READ, BY ADDR): */ 1205: /* Report output file. Must be opened by caller. */ 1206: 1207: REFERENCE 1208: *aRef, 1209: /* (READ, BY ADDR): */ 1210: /* Reference to routine definition entry to report. */ 1211: 1212: int vLevel, 1213: /* (READ, BY VAL): */ 1214: /* Nesting level, used to space indentation. */ 1215: 1216: int vExpanded, 1217: /* (READ, BY VAL): */ 1218: /* Flag indicating whether or not routine has already been */ 1219: /* expanded in this call tree. */ 1220: 1221: int vRecursive 1222: /* (READ, BY VAL): */ 1223: /* Flag indicating whether or not routine is called */ 1224: /* recursively. */ 1225: 1226: ) /* No return value. */ 1227: /*****************************************************************--*/ 1228: 1229: { 1230: int lcount; /* Level print count. */ 1231: 1232: for (lcount = vLevel; lcount > 1; lcount--) { 1233: fputs("| ", aRptFile); 1234: } 1235: if (lcount > 0) { 1236: fprintf(aRptFile, "%c ", (isend_of_list(aRef) ? '+' : '|')); 1237: } 1238: if (vLevel == 0) { 1239: #if 0 1240: fprintf(aRptFile,"%s%s%s: ", 1241: source_link_prefix(ref_definition(aRef), 0), 1242: def_name(ref_definition(aRef)), source_link_suffix()); 1243: fprintf(aRptFile, "%s%ld caller%s%s\n", 1244: xref_link_prefix(ref_definition(aRef), 0), 1245: def_num_callers(ref_definition(aRef)), 1246: (def_num_callers(ref_definition(aRef)) == 1 ? "" : "s"), 1247: xref_link_suffix()); 1248: #else 1249: fprintf(aRptFile,"%s\n", def_name(ref_definition(aRef))); 1250: #endif 1251: } 1252: /* If routine is not going to */ 1253: /* be expanded here, add an */ 1254: else if (vExpanded || vRecursive || /* explanation code. */ 1255: !isdefined_routine(ref_definition(aRef))) { 1256: fprintf(aRptFile, "%s (%s%s%s)", 1257: def_name(ref_definition(aRef)), 1258: (vExpanded ? "Duplicate" : ""), 1259: (vRecursive ? "Recursive" : ""), 1260: (!isdefined_routine(ref_definition(aRef)) ? "External" : "")); 1261: } 1262: #if 0 1263: /* Separate tree gets link. */ 1264: else if (needs_tree(ref_definition(aRef)) && !tree_inline_disabled()) { 1265: fprintf(aRptFile, "%s %s(Separate)%s\n", 1266: def_name(ref_definition(aRef)), 1267: xref_link_prefix(ref_definition(aRef), 0), xref_link_suffix()); 1268: } 1269: #else 1270: else if (needs_tree(ref_definition(aRef)) && !tree_inline_disabled() 1271: || vLevel == max_tree_depth() 1272: && def_num_calls(ref_definition(aRef)) > 0) { 1273: fprintf(aRptFile, "%s (Separate)", def_name(ref_definition(aRef))); 1274: } 1275: #endif 1276: #if 0 1277: else if (def_root(ref_definition(aRef)) == NULL) { 1278: /* This is the first inline */ 1279: /* expansion of a routine, make */ 1280: /* it an anchor. */ 1281: fprintf(aRptFile, "<A NAME=\"t%lx\">%s</a>", ref_definition(aRef), 1282: def_name(ref_definition(aRef))); 1283: } 1284: #endif 1285: else { /* Otherwise, format plain. */ 1286: fprintf(aRptFile, "%s", def_name(ref_definition(aRef))); 1287: } 1288: if (vLevel > 0) { 1289: fprintf(aRptFile, " %s\n", xref_link(ref_definition(aRef), 0)); 1290: } 1291: }END rpt_tree_html_entry. Go to: Beginning of routine.
1292: 1293: /*************************************************************************++*/
1294: void rpt_tree_html_end( 1295: /* Writes HTML-formatted section end for defined routine call tree. */ 1296: 1297: FILE *aRptFile, 1298: /* (READ, BY ADDR): */ 1299: /* Report output file. Must be opened by caller. */ 1300: 1301: DEFINITION 1302: *aDef, 1303: /* (READ, BY ADDR): */ 1304: /* Routine definition entry to report. */ 1305: 1306: int vFirst, 1307: /* (READ, BY VAL): */ 1308: /* Flag indicating whether this is first tree. */ 1309: 1310: int vLast 1311: /* (READ, BY VAL): */ 1312: /* Flag indicating whether this is last tree. */ 1313: 1314: ) /* No return value. */ 1315: /*****************************************************************--*/ 1316: 1317: { 1318: fputs("END OF TREE\n", aRptFile); 1319: fputs("</PRE>\n<HR>\n\n", aRptFile); 1320: }END rpt_tree_html_end. Go to: Beginning of routine.
1321: 1322: /*************************************************************************++*/
1323: void rpt_byfile_html_hdr( 1324: /* Writes HTML-formatted report header for defined routines by file table. */ 1325: 1326: FILE *aRptFile, 1327: /* (READ, BY ADDR): */ 1328: /* Report output file. Must be opened by caller. */ 1329: 1330: SOURCEFILE 1331: *aSourceFile, 1332: /* (READ, BY ADDR): */ 1333: /* Source file entry to report. */ 1334: 1335: int vFirst, 1336: /* (READ, BY VAL): */ 1337: /* Flag indicating whether this is first table. */ 1338: 1339: int vLast 1340: /* (READ, BY VAL): */ 1341: /* Flag indicating whether this is last table. */ 1342: 1343: ) /* No return value. */ 1344: /*****************************************************************--*/ 1345: 1346: { 1347: if (vFirst) { 1348: rpt_html_section_hdr(aRptFile, ROUTINES_BY_FILE_SECTION); 1349: fputs("<HR>\n\n", aRptFile); 1350: } 1351: 1352: fprintf(aRptFile, "<H2><A NAME=\"f%lx\">%s</a> %sRoutines%s</H2>\n", 1353: aSourceFile, source_name(aSourceFile), 1354: (vLast ? "<A NAME=\"routines_by_file_section_last\">" : ""), 1355: (vLast ? "</A>" : "")); 1356: rpt_html_subsection_hdr(aRptFile, ROUTINES_BY_FILE_SECTION, 1357: (vLast ? NULL : next_defining_file(aSourceFile)), 1358: (vFirst ? NULL : prev_defining_file(aSourceFile)), NULL, 0); 1359: fputs("<PRE>\n", aRptFile); 1360: fputs("=======================================================\n", 1361: aRptFile); 1362: fputs(" # Times\n", 1363: aRptFile); 1364: fputs("Routine Line Length Calls Called\n", 1365: aRptFile); 1366: fputs("-------------------------------------------------------\n", 1367: aRptFile); 1368: }END rpt_byfile_html_hdr. Go to: Beginning of routine.
1369: 1370: /*************************************************************************++*/
1371: void rpt_byfile_html_entry( 1372: /* Writes HTML-formatted entry for a defined routine by file. */ 1373: 1374: FILE *aRptFile, 1375: /* (READ, BY ADDR): */ 1376: /* Report output file. Must be opened by caller. */ 1377: 1378: DEFINITION 1379: *aDef, 1380: /* (READ, BY ADDR): */ 1381: /* Routine definition entry to report. */ 1382: 1383: int vFirst, 1384: /* (READ, BY VAL): */ 1385: /* Flag indicating whether this is first entry in table. */ 1386: 1387: int vLast 1388: /* (READ, BY VAL): */ 1389: /* Flag indicating whether this is last entry in table. */ 1390: 1391: ) /* No return value. */ 1392: /*****************************************************************--*/ 1393: 1394: { 1395: char anchor[32]; /* Anchor name buffer. */ 1396: /* Routine name folding buffer. */ 1397: char rname[RPT_HTML_FILE_FIELD_LEN + 1]; 1398: int pos; /* Pos in routine name to */ 1399: /* print. */ 1400: 1401: if (vLast) { /* Form anchor name. */ 1402: sprintf(anchor, "<A NAME=\"f%lx_last\">", def_source(aDef)); 1403: } 1404: /* Get first part of rout name. */ 1405: pos = fold_string(def_name(aDef), 0, NULL, rname, 1406: RPT_HTML_ROUTINE_FIELD_LEN); 1407: #if 0 1408: fprintf(aRptFile, "%s%-23s%s %s ", 1409: (vLast ? anchor : ""), rname, (vLast ? "</A>" : ""), 1410: tree_link(aDef, 0)); 1411: #else 1412: fprintf(aRptFile, "%s%-23s%s ", 1413: (vLast ? anchor : ""), rname, (vLast ? "</A>" : "")); 1414: #endif 1415: fprintf(aRptFile,"%s%7ld%s %7ld ", 1416: source_link_prefix(aDef, 0), def_begin(aDef), source_link_suffix(), 1417: def_length(aDef)); 1418: fprintf(aRptFile,"%s%7ld%s ", 1419: calls_link_prefix(aDef, 0), def_num_calls(aDef), calls_link_suffix()); 1420: fprintf(aRptFile,"%s%7ld%s\n", 1421: xref_link_prefix(aDef, 0), def_num_callers(aDef), xref_link_suffix()); 1422: 1423: while (pos < strlen(def_name(aDef))) { 1424: pos = fold_string(def_name(aDef), pos, " ", rname, 1425: RPT_HTML_ROUTINE_FIELD_LEN); 1426: fprintf(aRptFile, "%s\n", rname); 1427: } 1428: }END rpt_byfile_html_entry. Go to: Beginning of routine.
1429: 1430: /*************************************************************************++*/
1431: void rpt_byfile_html_end( 1432: /* Writes HTML-formatted report end for defined routine by file table. */ 1433: 1434: FILE *aRptFile, 1435: /* (READ, BY ADDR): */ 1436: /* Report output file. Must be opened by caller. */ 1437: 1438: SOURCEFILE 1439: *aSourceFile, 1440: /* (READ, BY ADDR): */ 1441: /* Source file entry to report. */ 1442: 1443: int vFirst, 1444: /* (READ, BY VAL): */ 1445: /* Flag indicating whether this is first table. */ 1446: 1447: int vLast 1448: /* (READ, BY VAL): */ 1449: /* Flag indicating whether this is last table. */ 1450: 1451: ) /* No return value. */ 1452: /*****************************************************************--*/ 1453: 1454: { 1455: fputs("-------------------------------------------------------\n", 1456: aRptFile); 1457: fprintf(aRptFile, "TOTAL: %5ld ROUTINES %7ld AVG\n", 1458: source_routines(aSourceFile), source_avglen(aSourceFile)); 1459: fputs("=======================================================\n", 1460: aRptFile); 1461: fprintf(aRptFile, "</PRE>\n<HR>\n%s\n", (vLast ? "<HR>\n" : "")); 1462: }END rpt_byfile_html_end. Go to: Beginning of routine.
1463: 1464: /*************************************************************************++*/
1465: void rpt_file_html_hdr( 1466: /* Writes HTML-formatted report header for source files. */ 1467: 1468: FILE *aRptFile 1469: /* (READ, BY ADDR): */ 1470: /* Report output file. Must be opened by caller. */ 1471: 1472: ) /* No return value. */ 1473: /*****************************************************************--*/ 1474: 1475: { 1476: /*+ */ 1477: /* This file is the main analysis HTML file, so first write the main */ 1478: /* document header, then the section header. */ 1479: /*- */ 1480: 1481: rpt_html_section_hdr(aRptFile, MAIN_SECTION); 1482: rpt_html_section_hdr(aRptFile, SOURCE_FILES_SECTION); 1483: 1484: fputs("<PRE>\n", aRptFile); 1485: fputs( 1486: "===============================================================================\n", 1487: aRptFile); 1488: fputs( 1489: " Com- State- Rou- Avg #\n", 1490: aRptFile); 1491: fputs( 1492: "File Lines mented ment tines Length Len Calls\n", 1493: aRptFile); 1494: fputs( 1495: "-------------------------------------------------------------------------------\n", 1496: aRptFile); 1497: }END rpt_file_html_hdr. Go to: Beginning of routine.
1498: 1499: /*************************************************************************++*/
1500: void rpt_file_html_entry( 1501: /* Writes HTML-formatted source file entry. */ 1502: 1503: FILE *aRptFile, 1504: /* (READ, BY ADDR): */ 1505: /* Report output file. Must be opened by caller. */ 1506: 1507: SOURCEFILE 1508: *aSourceFile, 1509: /* (READ, BY ADDR): */ 1510: /* Source file entry to report. */ 1511: 1512: int vFirst, 1513: /* (READ, BY VAL): */ 1514: /* Flag indicating whether this is first entry in table. */ 1515: 1516: int vLast 1517: /* (READ, BY VAL): */ 1518: /* Flag indicating whether this is last entry in table. */ 1519: 1520: ) /* No return value. */ 1521: /*****************************************************************--*/ 1522: 1523: { 1524: /* File name folding buffer. */ 1525: char fname[RPT_HTML_FILE_FIELD_LEN + 1]; 1526: int pos; /* Pos in file name to print. */ 1527: 1528: /*+ */ 1529: /* The file name may have to be folded over multiple lines. Embed a */ 1530: /* hyperlink to the routines table for this file, and an anchor to the */ 1531: /* line if it is the last entry in this table. */ 1532: /*- */ 1533: 1534: /* Get first part of file name. */ 1535: pos = fold_string(source_name(aSourceFile), 0, NULL, fname, 1536: RPT_HTML_FILE_FIELD_LEN); 1537: 1538: fprintf(aRptFile, "%s%-23s%s %s%7ld%s %7ld %7ld ", 1539: (vLast ? "<A NAME=\"source_files_section_last\">" : ""), 1540: fname, (vLast ? "</A>" : ""), sourcefile_link_prefix(aSourceFile), 1541: source_lines(aSourceFile), source_link_suffix(), 1542: source_comments(aSourceFile) + source_mixed(aSourceFile), 1543: source_statements(aSourceFile) + source_mixed(aSourceFile)); 1544: fprintf(aRptFile, "%s%7ld%s %7ld %7ld %7ld\n", 1545: (source_routines(aSourceFile) > 0 ? byfile_link_prefix(aSourceFile, 0) 1546: : ""), 1547: source_routines(aSourceFile), 1548: (source_routines(aSourceFile) > 0 ? byfile_link_suffix() : ""), 1549: source_rlength(aSourceFile), 1550: source_avglen(aSourceFile), source_calls(aSourceFile)); 1551: 1552: while (pos < strlen(source_name(aSourceFile))) { 1553: pos = fold_string(source_name(aSourceFile), pos, " ", fname, 1554: RPT_HTML_FILE_FIELD_LEN); 1555: fprintf(aRptFile, "%s\n", fname); 1556: } 1557: }END rpt_file_html_entry. Go to: Beginning of routine.
1558: 1559: /*************************************************************************++*/
1560: void rpt_file_html_end( 1561: /* Writes HTML-formatted report end for source files. */ 1562: 1563: FILE *aRptFile, 1564: /* (READ, BY ADDR): */ 1565: /* Report output file. Must be opened by caller. */ 1566: 1567: long vTotalFiles 1568: /* (READ, BY VAL): */ 1569: /* Total number of source files. */ 1570: 1571: ) /* No return value. */ 1572: /*****************************************************************--*/ 1573: 1574: { 1575: fputs( 1576: "-------------------------------------------------------------------------------\n", 1577: aRptFile); 1578: 1579: fprintf(aRptFile, 1580: "TOTAL: %7ld files %7ld %7ld %7ld %7ld %7ld %7ld %7ld\n", 1581: vTotalFiles, total_lines(), 1582: total_comments() + total_mixed(), total_statements() + total_mixed(), 1583: total_routines(), total_rlength(), total_avglen(), total_calls()); 1584: 1585: fputs( 1586: "===============================================================================\n", 1587: aRptFile); 1588: fputs("</PRE>\n<HR>\n<HR>\n\n", aRptFile); 1589: }END rpt_file_html_end. Go to: Beginning of routine.
1590: 1591: /*************************************************************************++*/
1592: void rpt_source_html_hdr( 1593: /* Writes HTML-formatted report header for annotated source file. */ 1594: 1595: FILE *aRptFile, 1596: /* (READ, BY ADDR): */ 1597: /* Report output file. Must be opened by caller. */ 1598: 1599: SOURCEFILE 1600: *aSourceFile, 1601: /* (READ, BY ADDR): */ 1602: /* Source file entry to report. */ 1603: 1604: int vFirst, 1605: /* (READ, BY VAL): */ 1606: /* Flag indicating whether this is first table. */ 1607: 1608: int vLast 1609: /* (READ, BY VAL): */ 1610: /* Flag indicating whether this is last table. */ 1611: 1612: ) /* No return value. */ 1613: /*****************************************************************--*/ 1614: 1615: { 1616: REFERENCE /* Current routine reference. */ 1617: *curref; 1618: 1619: if (vFirst) { 1620: rpt_html_section_hdr(aRptFile, SOURCE_CODE_SECTION); 1621: fputs("<HR>\n\n", aRptFile); 1622: } 1623: 1624: rpt_html_section_title(aRptFile, source_name(aSourceFile)); 1625: fprintf(aRptFile, "<H2><A NAME=\"s%lx\">%s</a> Source Code</H2>\n", 1626: aSourceFile, source_name(aSourceFile)); 1627: rpt_html_subsection_hdr(aRptFile, SOURCE_CODE_SECTION, 1628: (vLast ? NULL : next_entry(aSourceFile)), 1629: (vFirst ? NULL : prev_entry(aSourceFile)), OUTFILE_SUFFIX_SOURCE, 1630: source_seq(aSourceFile)); 1631: fputs( 1632: "<H3><A NAME=\"routines_in_this_file\">Routines In This File (Alphabetical)</a></H3>\n", 1633: aRptFile); 1634: 1635: fputs("<PRE>\n", aRptFile); 1636: if (source_routines(aSourceFile) == 0) { 1637: fputs(" None.\n", aRptFile); 1638: } 1639: else { 1640: fputs(" Line Name\n----- ----\n", aRptFile); 1641: for (curref = list_first(source_reflist(aSourceFile)); 1642: curref != NULL; 1643: curref = next_entry(curref)) { 1644: fprintf(aRptFile, "%5d %s%s%s\n", 1645: def_begin(ref_definition(curref)), 1646: source_link_prefix(ref_definition(curref), 1), 1647: def_name(ref_definition(curref)), source_link_suffix()); 1648: } 1649: fputs("</PRE>\n", aRptFile); 1650: } 1651: 1652: fputs("<HR>\n<PRE>BEGINNING OF FILE\n</PRE>\n<HR>\n", aRptFile); 1653: fputs("<PRE>\n", aRptFile); 1654: }END rpt_source_html_hdr. Go to: Beginning of routine.
1655: 1656: /*************************************************************************++*/
1657: void rpt_source_html_entry( 1658: /* Writes HTML-formatted entry for an annotated source line. */ 1659: 1660: FILE *aRptFile, 1661: /* (READ, BY ADDR): */ 1662: /* Report output file. Must be opened by caller. */ 1663: 1664: DEFINITION 1665: *aDef, 1666: /* (READ, BY ADDR): */ 1667: /* Routine definition entry to report. */ 1668: 1669: char *aSrcLine, 1670: /* (READ, BY ADDR): */ 1671: /* Source file line contents. */ 1672: 1673: int vLine 1674: /* (READ, BY VAL): */ 1675: /* Source file line number. */ 1676: 1677: ) /* No return value. */ 1678: /*****************************************************************--*/ 1679: 1680: { 1681: DEFINITION /* Next definition in file. */ 1682: *nextdef; 1683: 1684: if (aDef != NULL && def_begin(aDef) == vLine) { 1685: fprintf(aRptFile, "</PRE><HR>\n<A NAME=\"d%lx\">ROUTINE</A> ", aDef); 1686: fprintf(aRptFile, "%s%s%s. Go to: \n", 1687: xref_link_prefix(aDef, 0), def_name(aDef), xref_link_suffix()); 1688: if ((nextdef = next_entry(aDef)) != NULL) { 1689: fprintf(aRptFile, "%sNext routine in file%s; ", 1690: source_link_prefix(nextdef, 1), source_link_suffix()); 1691: } 1692: #if 0 1693: fprintf(aRptFile, 1694: "%s; %s; <A HREF=\"#routines_in_this_file\">Routines in this file</A>.<P>\n<PRE>\n", 1695: xref_link(aDef, 0), tree_link(aDef, 0)); 1696: #else 1697: fputs( 1698: "<A HREF=\"#routines_in_this_file\">Routines in this file</A>.<P>\n<PRE>\n", 1699: aRptFile); 1700: #endif 1701: } 1702: fprintf(aRptFile, "%6d: ", vLine); 1703: for (; *aSrcLine != '\0'; aSrcLine++) { 1704: switch (*aSrcLine) { 1705: case '>': fputs(">", aRptFile); break; 1706: case '<': fputs("<", aRptFile); break; 1707: case '&': fputs("&", aRptFile); break; 1708: default: fputc(*aSrcLine, aRptFile); 1709: } 1710: } 1711: if (aDef != NULL && def_end(aDef) == vLine) { 1712: fprintf(aRptFile, 1713: "</PRE>\nEND %s. Go to: %sBeginning of routine%s.<P>\n<HR>\n<PRE>\n", 1714: def_name(aDef), source_link_prefix(aDef, 1), source_link_suffix()); 1715: } 1716: }END rpt_source_html_entry. Go to: Beginning of routine.
1717: 1718: /*************************************************************************++*/
1719: void rpt_source_html_end( 1720: /* Writes HTML-formatted report end for annotated source file. */ 1721: 1722: FILE *aRptFile, 1723: /* (READ, BY ADDR): */ 1724: /* Report output file. Must be opened by caller. */ 1725: 1726: SOURCEFILE 1727: *aSourceFile, 1728: /* (READ, BY ADDR): */ 1729: /* Source file entry to report. */ 1730: 1731: int vFirst, 1732: /* (READ, BY VAL): */ 1733: /* Flag indicating whether this is first table. */ 1734: 1735: int vLast 1736: /* (READ, BY VAL): */ 1737: /* Flag indicating whether this is last table. */ 1738: 1739: ) /* No return value. */ 1740: /*****************************************************************--*/ 1741: 1742: { 1743: fputs("<HR>\nEND OF FILE\n\n", aRptFile); 1744: fprintf(aRptFile, "TOTAL: %ld routines, %ld Avg Length\n", 1745: source_routines(aSourceFile), source_avglen(aSourceFile)); 1746: fprintf(aRptFile, "</PRE>\n<HR>\n%s\n", (vLast ? "<HR>\n" : "")); 1747: rpt_html_subsection_hdr(aRptFile, SOURCE_CODE_SECTION, 1748: (vLast ? NULL : next_entry(aSourceFile)), 1749: (vFirst ? NULL : prev_entry(aSourceFile)), OUTFILE_SUFFIX_SOURCE, 1750: source_seq(aSourceFile)); 1751: }END rpt_source_html_end. Go to: Beginning of routine.
1752:
END OF FILE TOTAL: 44 routines, 35 Avg Length