BRoutine Analyzer Source File Analysis - ranalyzer.c8

ranalyzer.c Source Code

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

Q

Routines In This File (Alphabetical)



 Line Name
----- ----+  116 analyze_file.  267 analyze_product, 1095 cmdopt_author-  779 cmdopt_callers+  403 cmdopt_clear+  812 cmdopt_depth1  560 cmdopt_description3  954 cmdopt_fmt_kwhandler,  992 cmdopt_format0 1039 cmdopt_htmlbyfile. 1067 cmdopt_htmlxref.  653 cmdopt_language*  505 cmdopt_list)  467 cmdopt_log.  904 cmdopt_noreport/  531 cmdopt_outprefix,  844 cmdopt_report.  587 cmdopt_separate)  387 cmdopt_set+  419 cmdopt_trace/  750 cmdopt_urlprefix)   38 get_parser# 1206 main( 1110 show_help


BEGINNING OF FILE


V     1: /****************************************************************************/     2: /*									    */1     3: /*  FACILITY:	Routine Analyzer					    */     4: /*									    */+     5: /*  MODULE:	Main Module						    */     6: /*									    */O     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */>     8: /*		Equipment Corporation, Littleton, MA, USA.		    */     9: /*									    */V    10: /*  DESCRIPTION: This is the main module for Routine Analyzer. It contains  */V    11: /*  the main routine, command option handlers, and the main application	    */F    12: /*  routines for processing product and source files.			    */    13: /*									    */*    14: /*  REVISION HISTORY:							    */    15: /*									    */7    16: /*  V1.0-00 27-JAN-1995 Steve Branam					    */    17: /*									    */N    18: /*	Modified help logic when insufficient arguments supplied and	    */'    19: /*	cleaned up help.						    */    20: /*									    */7    21: /*  V0.1-00 24-AUG-1994 Steve Branam					    */    22: /*									    */(    23: /*	Original version.						    */    24: /*									    */V    25: /****************************************************************************/    26: D    27: #define MAIN_MODULE			    /* This is the main module.	    */     28: #include <ctype.h>    29: #include "ranalyzer.h"    30:     31: +    32: extern language_element c_parser();/    33: extern language_element bliss_parser();-    34: extern language_element dcl_parser();.    35: extern language_element text_parser();    36: V    37: /*************************************************************************++*/

cROUTINE get_parser. Go to: mNext routine in file; Routines in this file.



    38: PARSER get_parser(V    39: /* Returns the parser function appropriate for the source language, based   */2    40: /* on the file name extension.						    */    41: !    42:     char    *aSourceName,-    43: 	    /* (READ, BY ADDR):  					    */3    44: 	    /* Source file name string.					    */    45: !    46:     char    **aParserName.    47: 	    /* (WRITE, BY ADDR):  					    */I    48: 	    /* Parser name string ptr, set to parser name string.	    */    49: 6    50: )	/* Returns ptr to parser function.				    */O    51: 	/*****************************************************************--*/    52: 	    53: {G    54:     KEYWORD_DEFINITION			    /* Current keyword definition.  */    55: 	    *curkwdef;G    56:     LANGUAGE_TRANSLATION		    /* Current language trans.	    */    57: 	    *curtrans;@    58:     char    *extstr;			    /* File extension ptr.	    */    59: -    60:     if (global_langtable() == NULL) {9    61: 	set_lang_table(list_entries(global_langlist()));,    62: 	for (curkwdef = global_langtable();0    63: 	    (curtrans = remove_lang()) != NULL;    64: 	    curkwdef++) {>    65: 	    set_kwdef_keyword(curkwdef, lang_fext(curtrans));E    66: 	    set_kwdef_minlen(curkwdef, strlen(lang_fext(curtrans)));;    67: 	    set_kwdef_code(curkwdef, lang_code(curtrans));!    68: 	    free_lang(curtrans);
    69: 	}
    70:     }    71:     72:     73:     /*+									    */U    74:     /*	Scan back from end of file name string for file extension. If not   */U    75:     /*	found, can't identify parser. Otherwise, locate end of extension    */G    76:     /*	string and compare it to known file extensions.			    */    77:     /*-									    */    78: @    79:     for (extstr = &aSourceName[strlen(aSourceName)];K    80: 	extstr >= aSourceName && *extstr != FILE_EXT_SEPARATOR;    81: 	extstr--);*    82:     if (extstr < aSourceName) {Q    83: 	printf("ERROR: No file extension specified for file %s\n", aSourceName);    84: 	return NULL;
    85:     }    86:     else {    87: 	extstr++;A    88: 	switch (translate_keyword(extstr, global_langtable())) {G    89: 	case LANGUAGE_UNKNOWN:		    /* No matches on file type.	    */    90: 	    printf(G    91: 	    "ERROR: Unable to identify source language for file %s\n",    92: 		aSourceName);    93: 	    return NULL;    94: 	    break;    95: 	case LANGUAGE_TEXT:;    96: 	    *aParserName = "text (no language structure)";     97: 	    return text_parser;    98: 	    break;    99: 	case LANGUAGE_DCL:"   100: 	    *aParserName = "DCL";   101: 	    return dcl_parser;   102: 	    break;   103: 	case LANGUAGE_CC:    104: 	    *aParserName = "C";   105: 	    return c_parser;   106: 	    break;   107: 	case LANGUAGE_BLISS:$   108: 	    *aParserName = "BLISS";!   109: 	    return bliss_parser;   110: 	    break;
   111: 	}
   112:     }	   113: }
HEND get_parser. Go to: Beginning of routine.





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

aROUTINE analyze_file. Go to: mNext routine in file; Routines in this file.



   116: int analyze_file(V   117: /* Analyze the code in a product source file, using the designated parser.  */V   118: /* This adds routine definition entries for every routine defined in the    */U   119: /* file, and for every unknown routine referenced in the file. Unknown	    */V   120: /* routines are expected to be defined later in the file, in another file,  */D   121: /* or in another product (i.e. a run-time library).			    */   122: !   123:     char    *aSourceName,(   124: 		/* (READ, BY ADDR):					    *//   125: 		/* Source file name string.				    */   126:    127:     int	    vTabSize,(   128: 		/* (READ, BY ADDR):					    */,   129: 		/* Source file tab size.				    */   130:    131:     PARSER  aParser,(   132: 		/* (READ, BY ADDR):					    */H   133: 		/* Source language parse routine, called to return the next */2   134: 		/* token from the source file.				    */   135:    136:     char    *aLangName(   137: 		/* (READ, BY ADDR):					    */,   138: 		/* Language name string.				    */   139: 2   140: )	/* Returns status indication:					    */6   141: 	/*  1	- File analyzed successfully.				    */;   142: 	/*  0   - File not analyzed successfully.			    */HO   143: 	/*****************************************************************--*/t   144: 	   145: {i@   146:     DEFINITION				    /* Current routine definition.  */    147: 	    *curdef = NULL;		  :   148:     DEFINITION				    /* Referenced routine	    */2   149: 	    *refdef;			    /* definition.		    */?   150:     REFERENCE				    /* Current routine reference.   */    151: 	    *curref;a   152:     SOURCEFILE;   153: 	    *curfile;			    /* Current source file.	    */9A   154:     FILE    *sourcefile;		    /* Source file ptr.		    */AV   155:     char    element[MAX_ROUTINE_NAME + 1];  /* Language element buffer.	    */
   156: 		E   157:     language_element			    /* Type of language element.    */0   158: 	    element_type;G   159:     long    sourceline;		    /* Line number in source file.  */"
   160: 		   161:     /*+									    */U   162:     /*	Add a new source file entry to the source file list, then analyze   */EU   163:     /*	the language elements in the source file, adding definition and	    */E>   164:     /*	reference entries for routines found.				    */   165:     /*-									    */   166: ,   167: 					    /* Open source file.	    */A   168:     if ((sourcefile = fopen(aSourceName, "r")) == NULL) {AC   169: 	printf("ERROR: Unable to open source file %s for input\n",0   170: 	    aSourceName);   171: 	return 0;
   172:     }r<   173:     else {				    /* Create new source file entry */.   174: 					    /* and add it to list.	    */3   175: 	curfile = new_file(aSourceName, vTabSize);*!   176: 	add_file(curfile);		    *-   177: 	list_file_begin(curfile, aLangName);*    178: 	new_list_line(curfile);3   179: 					    /* Process next source language */	%   180: 					    /* element.			    */lH   181: 	while ((element_type = (*aParser)(sourcefile, curfile, element,5   182: 				    &sourceline)) != END_OF_SOURCE) { #   183: 	    switch(element_type) {t   184: 	    case PARSE_ERROR:   185:    186: 		    /*+							    */G   187: 		    /*	Parser believes some source construct is invalid,   */*0   188: 		    /*	give up on this file.				    */   189: 		    /*-							    */
   190: 	    s!   191: 		    fclose(sourcefile);f   192: 		    return 0;*   193: 		    break;$   194: 	    case ROUTINE_DEF_BEGIN:   195:    196: 		    /*+							    */G   197: 		    /*	Start of a routine found: Get its definition entry  */G   198: 		    /*	for this file and save begin line number. Add a	    */ G   199: 		    /*	source reference, passing this def as the caller as */G   200: 		    /*	well as the definition so that it will be inserted  */	1   201: 		    /*	in alphabetical order.				    */    202: 		    /*-							    */   203: 					    *2   204: 		    curdef = find_def(element, curfile);0   205: 		    set_def_begin(curdef, sourceline);G   206: 		    add_srcref(curfile, new_ref(sourceline, curdef, curdef));h.   207: 		    list_def_begin(curfile, curdef);   208: 		    break;"   209: 	    case ROUTINE_DEF_END:   210:    211: 		    /*+							    */G   212: 		    /*	End of a routine found: Save end line number and    */u:   213: 		    /*	clear current definition context.		    */   214: 		    /*-							    */   215: .   216: 		    set_def_end(curdef, sourceline);+   217: 		    inc_source_routines(curfile);0>   218: 		    inc_source_rlength(curfile, def_length(curdef));?   219: 		    inc_source_calls(curfile, def_num_calls(curdef));n,   220: 		    list_def_end(curfile, curdef);!   221: 		    curdef = NULL;	    t   222: 		    break;   223: 	    case ROUTINE_REF:   224:    225: 		    /*+							    */G   226: 		    /*	Routine reference found: Make sure this is inside a */ G   227: 		    /*	routine definition (as opposed to a static data	    */aG   228: 		    /*	initializer macro or some other construct that the  */ G   229: 		    /*	parser has misconstrued as a routine call). Find    */tG   230: 		    /*	the definition of the referenced routine, add a	    */rG   231: 		    /*	reference entry for it to current routine being	    */*E   232: 		    /*	defined, and add a caller entry to it for the	    */ +   233: 		    /*	current routine.				    */e   234: 		    /*-							    */   235: &   236: 		    if (curdef != NULL) {   ,   237: 			refdef = find_def(element, NULL);8   238: 			curref = new_ref(sourceline, refdef, curdef);'   239: 			add_ref(curdef, curref);     ,   240: 		        list_ref(curfile, curref);8   241: 			curref = new_ref(sourceline, refdef, curdef);&   242: 			add_caller(refdef, curref);   243: 		    }    244: 		    break;   245: 	    }
   246: 	}   247:    248: 	/*+								    */O   249: 	/*  Parser has reached the end of the source file, close it and	    */fG   250: 	/*  roll up all file counts to total product counters.		    */a   251: 	/*-								    */   252:    253: 	fclose(sourcefile);6   254: 	inc_total_comments(source_comments(curfile));:   255: 	inc_total_statements(source_statements(curfile));0   256: 	inc_total_mixed(source_mixed(curfile));0   257: 	inc_total_empty(source_empty(curfile));6   258: 	inc_total_routines(source_routines(curfile));4   259: 	inc_total_rlength(source_rlength(curfile));0   260: 	inc_total_calls(source_calls(curfile));    261: 	list_file_end(curfile);   262: 	return 1;
   263:     }g	   264: }N
JEND analyze_file. Go to: Beginning of routine.





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

dROUTINE analyze_product. Go to: mNext routine in file; Routines in this file.



    267: int analyze_product(V   268: /* Processes a product definition file. This file contains a line for the   */V   269: /* product name, then one line for each product source file.  Analyzes the  */V   270: /* source code in each product source file, then produces analysis reports  */(   271: /* for the product.							    */   272: !   273:     char    *aProductName1(   274: 		/* (READ, BY ADDR):					    */0   275: 		/* Product file name string.				    */
   276: 		2   277: )	/* Returns status indication:					    */8   278: 	/*  1	- Product analyzed successfully.			    */>   279: 	/*  0   - Product not analyzed successfully.			    */O   280: 	/*****************************************************************--*/o   281: 	   282: {5B   283:     FILE    *productfile;		    /* Product file ptr.	    *//   284: 					    /* Product name buffer.	    */*8   285:     char    productname[MAX_PRODUCT_NAME + 1];  V   286:     char    sourcebuf[MAX_FILE_NAME + 1];   /* Source file line buffer.	    */V   287:     char    sourcename[MAX_FILE_NAME + 1];  /* Source file name buffer.	    */V   288:     char    outputname[MAX_FILE_NAME + 1];  /* Output file name buffer.	    */E   289:     PARSER  *parser;			    /* Parser function for source   */d%   290: 					    /* language.		    */ H   291:     char    *parsername;		    /* Parser language name ptr.    */<   292:     int	    tabsize;			    /* File tab size.		    */   293:    294:     /*+									    */U   295:     /*	Analyze each source file listed in the product definition file.	    */	S   296:     /*	Abort if the product file cannot be opened or an error occurs	    */	P   297:     /*	during analysis. The appropriate parser must be determined	    */5   298:     /*	individually for each file.					    */	   299:     /*-									    */   300: -   301: 					    /* Open product file.	    */eC   302:     if ((productfile = fopen(aProductName, "r")) == NULL) {gD   303: 	printf("ERROR: Unable to open product file %s for input\n",   304: 	    aProductName);/   305: 	return 0;
   306:     }aT   307:     else if (fgets(productname, sizeof(productname), productfile) == NULL) {D   308: 	printf("ERROR: Unable to read product name from file %s\n",   309: 	    aProductName);z   310: 	return 0;
   311:     }    312:     else {5   313: 	productname[strlen(productname) - 1] = '\0';*'   314: 	set_product_name(productname);**   315: 	list_product_begin(aProductName);3   316: 					    /* Get next source file name.   */oK   317: 	while (fgets(sourcebuf, sizeof(sourcebuf), productfile) != NULL) {f   318: O   319: 	    if (sscanf(sourcebuf, "%s %d", sourcename, &tabsize) < 2) {E   320: 		tabsize = TAB_SIZE;    321: 	    }3   322: 					    /* Get parser for file type and */1)   323: 					    /* analyze file.		    */fK   324: 	    if ((parser = get_parser(sourcename, &parsername)) == NULL*F   325: 		|| !analyze_file(sourcename, tabsize, parser, parsername)) {   326: 		fclose(productfile);   327: 		return 0;e   328: 	    }
   329: 	}   330: 	fclose(productfile); .   331: 	list_analysis_complete(aProductName);
   332:     }n   333:    334:     /*+									    */U   335:     /*	Write alphabetical reports (ordered by routine name): defined and   */fU   336:     /*	undefined routines; calls/callers for defined routines; and call    */aS   337:     /*	trees for defined routines. Before the last report, duplicate	    */	U   338:     /*	references must be trimmed from the routine definitions so that	    */	U   339:     /*	minimal call trees can be generated (i.e. a routine will appear	    */iC   340:     /*	only once in a given level of a call tree).			    */    341:     /*-									    */   342: %   343:     if (rpt_html_enabled()) {C   344: 	assign_xreffiles();   345: 	assign_byfilefiles();
   346:     }/&   347:     if (rpt_defined_enabled())O   348: 	report_defined(make_filename(outfile_prefix(), OUTFILE_SUFFIX_DEFLIST,i+   349: 	    report_filext(), outputname));i(   350:     if (rpt_undefined_enabled())S   351: 	report_undefined(make_filename(outfile_prefix(), OUTFILE_SUFFIX_UNDEFLIST,p+   352: 	    report_filext(), outputname));$   353:     if (rpt_calls_enabled())K   354: 	report_calls(make_filename(outfile_prefix(), OUTFILE_SUFFIX_CALLS,S+   355: 	    report_filext(), outputname)); D   356:     discard_dup_refs();			    /* Trim duplicate refs.	    */
   357: #if 08$   358:     if (rpt_trees_enabled())T   359: 	report_call_trees(make_filename(outfile_prefix(), OUTFILE_SUFFIX_CALLTREES,+   360: 	    report_filext(), outputname));r   361: #endif$   362:     if (rpt_xrefs_enabled())J   363: 	report_xrefs(make_filename(outfile_prefix(), OUTFILE_SUFFIX_XREF,+   364: 	    report_filext(), outputname));*   365:    366:     /*+									    */U   367:     /*	Sort the file definitions by source file and beginning line number  */U   368:     /*	and write the defined routines in this order. Finally, report the   */ *   369:     /*	product files.							    */   370:     /*-									    */   371:    372:     sort_file_order();%   373:     if (rpt_byfile_enabled()) N   374: 	report_by_file(make_filename(outfile_prefix(), OUTFILE_SUFFIX_BYFILE,+   375: 	    report_filext(), outputname));i$   376:     if (rpt_files_enabled())K   377: 	report_files(make_filename(outfile_prefix(), OUTFILE_SUFFIX_FILES,*+   378: 	    report_filext(), outputname));t%   379:     if (rpt_source_enabled())*.   380: 	report_source(OUTFILE_SUFFIX_SOURCE);   381: +   382:     list_product_end(aProductName); <   383:     return 1;				    /* Successful completion	    */	   384: }e
MEND analyze_product. Go to: Beginning of routine.





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

cROUTINE cmdopt_set. Go to: *mNext routine in file; Routines in this file.

i

n   387: int cmdopt_set(aR   388: /* Common command line option handler to set simple toggle options.	    */   389:    390:     int	    vToggleFlagt+   391: 	    /* (READ, BY VAL):						    */ .   392: 	    /* Toggle flag to set.					    */   393: O   394: )	/* Returns 1 to indicate successful processing of this option.	    */O   395: 	/*****************************************************************--*/	   396: 	   397: {e$   398:     set_option(vToggleFlag);   399:     return 1;6	   400: }(
HEND cmdopt_set. Go to: Beginning of routine.





(   401: V   402: /*************************************************************************++*/

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

2

    403: int cmdopt_clear( T   404: /* Common command line option handler to clear simple toggle options.	    */   405:    406:     int	    vToggleFlag	+   407: 	    /* (READ, BY VAL):						    */e0   408: 	    /* Toggle flag to clear.					    */   409: O   410: )	/* Returns 1 to indicate successful processing of this option.	    */lO   411: 	/*****************************************************************--*/   412: 	   413: {u&   414:     clear_option(vToggleFlag);   415:     return 1;u	   416: }(
JEND cmdopt_clear. Go to: Beginning of routine.





    417: V   418: /*************************************************************************++*/

eROUTINE cmdopt_trace. Go to: *mNext routine in file; Routines in this file.

>

_   419: int cmdopt_trace(EH   420: /* Command line option handler to set specified traces.			    */   421:    422:     int	    vOptCode, +   423: 	    /* (READ, BY VAL):						    */sO   424: 	    /* Option keyword translation code, ignored by this routine.    */p   425:    426:     char    *aValStr,   427: 	    /* (READ, BY ADDR):						    */D   428: 	    /* Option value string, preceded by equal sign.		    */   429:     -   430: )	/* Returns status code:						    */ ?   431: 	/*  1	- Successful processing of this option.			    */	3   432: 	/*  0	- Report keywords missing.				    */ O   433: 	/*****************************************************************--*/    434: 	   435: { /   436: 					    /* Trace option keyword	    */t+   437: 					    /* dispatch table.		    */ 4   438:     static KEYWORD_DEFINITION keywords[] = {8   439: 	{"memalloc",	3, cmdopt_set,  TRACE_MEM_ENABLE},7   440: 	{"strings",	3, cmdopt_set,  TRACE_STR_ENABLE},47   441: 	{"objects",	3, cmdopt_set,  TRACE_OBJ_ENABLE},h7   442: 	{"reports",	3, cmdopt_set,  TRACE_RPT_ENABLE},h9   443: 	{"plevel",	3, cmdopt_set,  TRACE_PLEVEL_ENABLE},u9   444: 	{"blevel",	3, cmdopt_set,  TRACE_BLEVEL_ENABLE},+9   445: 	{"parser",	3, cmdopt_set,  TRACE_PARSER_ENABLE}, 6   446: 	{NULL,		0, NULL}	    /* End of table.		    */   447:     };   448: U   449:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {e3   450: 	if (!process_keyword(aValStr, keywords)) {P>   451: 	    printf("ERROR: Unable to process %ctrace option",!   452: 		CMDLINE_OPTION_SWITCH);3   453: 	    return 0;
   454: 	}   455: 	else {a   456: 	    return 1;
   457: 	}
   458:     }i   459:     else {N   460: 	printf("ERROR: %ctrace option requires trace type keyword or list\n",$   461: 	    CMDLINE_OPTION_SWITCH);   462: 	return 0;
   463:     }i	   464: }
JEND cmdopt_trace. Go to: Beginning of routine.





   465: V   466: /*************************************************************************++*/

cROUTINE cmdopt_log. Go to: mmNext routine in file; Routines in this file.

i

N   467: int cmdopt_log(EQ   468: /* Command line option handler to set log file for stdout logging.	    */    469:    470:     int	    vOptCode, +   471: 	    /* (READ, BY VAL):						    */cO   472: 	    /* Option keyword translation code, ignored by this routine.    */d   473:    474:     char    *aValStr,   475: 	    /* (READ, BY ADDR):						    */D   476: 	    /* Option value string, preceded by equal sign.		    */   477:     -   478: )	/* Returns status code:						    */e?   479: 	/*  1	- Successful processing of this option.			    */ H   480: 	/*  0	- Log file name missing, or file cannot be opened.	    */O   481: 	/*****************************************************************--*/e   482: 	   483: {)   484:     /*+									    */U   485:     /*	If a file name value has been supplied, reopen stdout on that file. */3   486:     /*-									    */   487: U   488:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {35   489: 	if (freopen(aValStr, "w", stdout) != NULL) {    490: 	    return 1;
   491: 	}   492: 	else {oO   493: 	    printf("ERROR: Unable to open log file %s for output\n", aValStr);f   494: 	    return 0;
   495: 	}
   496:     }*   497:     else {?   498: 	printf("ERROR: %clog option requires log file name\n",*$   499: 	    CMDLINE_OPTION_SWITCH);   500: 	return 0;
   501:     }	   502: } 
HEND cmdopt_log. Go to: Beginning of routine.





    503: V   504: /*************************************************************************++*/

dROUTINE cmdopt_list. Go to: mNext routine in file; Routines in this file.

F

   505: int cmdopt_list(V   506: /* Command line option handler to enable listing file. Attempts to create   */%   507: /* listing file.							    */_   508: )   509:     /* No arguments.							    */p   510: -   511: )	/* Returns status code:						    */ ?   512: 	/*  1	- Successful processing of this option.			    */S7   513: 	/*  0	- Unable to open listing file.				    */ O   514: 	/*****************************************************************--*/3   515: 	   516: {_J   517:     char    name[MAX_FILE_NAME + 1];		/* Listing file name.	    */   518: $   519:     set_option(LIST_ENABLE);S   520:     if (open_list_file(make_filename(outfile_prefix(), OUTFILE_SUFFIX_LIST,p0   521: 	    OUTFILE_EXT_LIST, name)) == NULL) {L   522: 	printf("ERROR: Unable to open listing file %s for output\n", name);   523: 	return 0;
   524:     }    525:     else {   526: 	return 1;
   527:     }n	   528: }e
IEND cmdopt_list. Go to: Beginning of routine.

t



    529: V   530: /*************************************************************************++*/

iROUTINE cmdopt_outprefix. Go to: LmNext routine in file; Routines in this file.

r

i   531: int cmdopt_outprefix(xO   532: /* Command line option handler to set report file output prefix.	    */    533:    534:     int	    vOptCode,r+   535: 	    /* (READ, BY VAL):						    */ O   536: 	    /* Option keyword translation code, ignored by this routine.    */u   537:    538:     char    *aValStr,   539: 	    /* (READ, BY ADDR):						    */D   540: 	    /* Option value string, preceded by equal sign.		    */   541:     -   542: )	/* Returns status code:						    */*?   543: 	/*  1	- Successful processing of this option.			    */ +   544: 	/*  0	- Prefix missing.					    */mO   545: 	/*****************************************************************--*/r   546: 	   547: {>U   548:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {m%   549: 	set_outfile_prefix(aValStr);o   550: 	return 1;
   551:     }3   552:     else {E   553: 	printf("ERROR: %coutprefix option requires prefix string\n", $   554: 	    CMDLINE_OPTION_SWITCH);   555: 	return 0;
   556:     }a	   557: }u
NEND cmdopt_outprefix. Go to: Beginning of routine.





*   558: V   559: /*************************************************************************++*/

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

0

>   560: int cmdopt_description(fV   561: /* Command line option handler to set the product description file name.    */   562:    563:     int	    vOptCode,>+   564: 	    /* (READ, BY VAL):						    */3O   565: 	    /* Option keyword translation code, ignored by this routine.    */l   566:    567:     char    *aValStr,   568: 	    /* (READ, BY ADDR):						    */D   569: 	    /* Option value string, preceded by equal sign.		    */   570:     -   571: )	/* Returns status code:						    */s?   572: 	/*  1	- Successful processing of this option.			    */*5   573: 	/*  0	- Option value out of range.				    */O   574: 	/*****************************************************************--*/1   575: 	   576: {>9   577:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR) {f*   578: 	set_product_description(aValStr);   579: 	return 1;
   580:     }*F   581:     printf("ERROR: %cdescription option requires file name\n",    582: 	CMDLINE_OPTION_SWITCH);   583:     return 0;0	   584: }o
PEND cmdopt_description. Go to: Beginning of routine.





>   585: V   586: /*************************************************************************++*/

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

6

h   587: int cmdopt_separate(V   588: /* Command line option handler to set list of routines for which separate   */V   589: /* call trees MUST be generated if they call anything. The option value is  */V   590: /* the name of a file containing a list of routine names, one per line.	    */   591:    592:     int	    vOptCode,*+   593: 	    /* (READ, BY VAL):						    */*O   594: 	    /* Option keyword translation code, ignored by this routine.    */*   595:    596:     char    *aValStr,   597: 	    /* (READ, BY ADDR):						    */D   598: 	    /* Option value string, preceded by equal sign.		    */   599:     -   600: )	/* Returns status code:						    */4?   601: 	/*  1	- Successful processing of this option.			    */2I   602: 	/*  0	- List file name missing, or file cannot be opened.	    */cO   603: 	/*****************************************************************--*/V   604: 	   605: { F   606:     FILE    *sepfile;			    /* Sep routine list file ptr.   */?   607:     int	    rcount;			    /* Routine name count.	    */4R   608:     char    rname[MAX_ROUTINE_NAME * 2];    /* Routine name buffer.	    */E   609:     char    **rlist;			    /* Ptr to routine name list.    */t   610:     U   611:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') { 7   612: 	if ((sepfile = fopen(aValStr, "r")) != NULL) {,   613: 						/* Count lines in file.	    */K   614: 	    for (rcount = 0; fgets(rname, sizeof(rname), sepfile) != NULL;n   615: 		rcount++);3   616: 					    /* Allocate routine name list   */i,   617: 					    /* and terminate it.	    */;   618: 	    rlist = malloc((rcount + 1) * sizeof(char *));E"   619: 	    rlist[rcount] = NULL;   620:    621: 	    /*+								    */N   622: 	    /*	Reset to beginning of file. For each line in file, get the  */N   623: 	    /*	routine name, stripping the ending newline. Allocate memory */N   624: 	    /*	for it, copy the name to the memory, and put the memory ptr */3   625: 	    /*	in the routine name list.				    */*   626: 	    /*-								    */   627: *   628: 	    fseek(sepfile, 0, SEEK_SET); &   629: 	    while (rcount-- > 0) {/   630: 		fgets(rname, sizeof(rname), sepfile);/*   631: 		rname[strlen(rname) - 1] = '\0';C   632: 		rlist[rcount] = strcpy(malloc(strlen(rname) + 1), rname);5   633: 	    }   634: 	    fclose(sepfile); L   635: 	    set_separate_list(rlist);	    /* Save list in global db.	    */   636: 	    return 1;
   637: 	     
   638: 	}   639: 	else {sQ   640: 	    printf("ERROR: Unable to open separate routine file %s for input\n",r   641: 		aValStr);d   642: 	    return 0;
   643: 	}
   644:     }*   645:     else {M   646: 	printf("ERROR: %cseparate option requires routine list file name\n",5$   647: 	    CMDLINE_OPTION_SWITCH);   648: 	return 0;
   649:     }l	   650: }4
MEND cmdopt_separate. Go to: Beginning of routine.

R



p   651: V   652: /*************************************************************************++*/

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

q

o   653: int cmdopt_language(R   654: /* Command line option handler to set list of source file extension	    */-   655: /* language translations.						    */n   656:    657:     int	    vOptCode,5+   658: 	    /* (READ, BY VAL):						    */*O   659: 	    /* Option keyword translation code, ignored by this routine.    */O   660:    661:     char    *aValStr,   662: 	    /* (READ, BY ADDR):						    */D   663: 	    /* Option value string, preceded by equal sign.		    */   664:     -   665: )	/* Returns status code:						    */t?   666: 	/*  1	- Successful processing of this option.			    */fM   667: 	/*  0	- Language file name missing, file cannot be opened, or	    */9   668: 	/*	  invalid language definition found.			    */1O   669: 	/*****************************************************************--*/o   670: 	   671: {*5   672:     static KEYWORD_DEFINITION languages[] = { *   673: 	{"text",	3, NULL, LANGUAGE_TEXT},)   674: 	{"dcl",		3, NULL, LANGUAGE_DCL},,   675: 	{"bliss",	3, NULL, LANGUAGE_BLISS},&   676: 	{"c",		1, NULL, LANGUAGE_CC},>   677: 	{NULL,          0, NULL}	    /* End of table.		    */   678:     };G   679:     FILE    *langfile;			    /* Lang translation file ptr.   */ M   680:     char    translation[512];		    /* Translation string buffer.   */nC   681:     char    *fextbegin;			    /* File extension ptr.	    */ E   682:     char    *fextend;			    /* File extension end ptr.	    */eD   683:     SOURCE_LANGUAGE			    /* Language identification.	    */   684: 	    langcode;3   685: 					    /* Check for equal sign and	    */*3   686: 					    /* make sure there is a file.   */RU   687:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {o8   688: 	if ((langfile = fopen(aValStr, "r")) != NULL) {	   689: 	<0   690: 					    /* For each line, locate	    */-   691: 					    /* beginning of text.	    */oP   692: 	    while (fgets(translation, sizeof(translation), langfile) != NULL) {6   693: 		translation[strlen(translation) - 1] = '\0';'   694: 		for (fextbegin = translation; J   695: 		    *fextbegin != '\0' && isspace(*fextbegin) &&3   696: 		    *fextbegin != CMDLINE_OPTION_COMMENT;9   697: 		    fextbegin++);	3   698: 					    /* Ignore comment lines. Find   */e3   699: 					    /* end of translation field and */R/   700: 					    /* process translation.	    */-5   701: 		if (*fextbegin != CMDLINE_OPTION_COMMENT) {4'   702: 		    for (fextend = fextbegin; M   703: 			*fextend > ' ' && *fextend != CMDLINE_OPTION_SEPARATOR;   704: 			fextend++);6   705: 		    if (*fextend != CMDLINE_OPTION_SEPARATOR)   706: 			|| !isalnum(*(fextend + 1))) {o   707: 			printf(I   708: 		    "ERROR: Invalid language definition in language file %s\n",t   709: 			    aValStr);   710: 			printf(@   711: 		    "       Language name missing in definition %s\n",   712: 			    fextbegin);   713: 			fclose(langfile);   714: 			return 0;   715: 		    }n   716: 		    else {   717: 			*fextend++ = '\0'; 5   718: 			if ((langcode = translate_keyword(fextend,*1   719: 			    languages)) == LANGUAGE_UNKNOWN) {0   720: 			    printf(I   721: 		    "ERROR: Invalid language definition in language file %s\n",E   722: 			    aValStr);?   723: 			    printf("       Language %s unknown\n", fextend);f    724: 			    fclose(langfile);   725: 			    return 0;   726: 			}   727: 			else {r7   728: 			    add_lang(new_lang(fextbegin, langcode));    729: 			}   730: 		    }>   731: 		}    732: 	    }   733: 	    fclose(langfile);   734: 	    return 1;
   735: 	}   736: 	else {uI   737: 	    printf("ERROR: Unable to open language file %s for input\n",,   738: 		aValStr);/   739: 	    return 0;
   740: 	}
   741:     }e   742:     else {I   743: 	printf("ERROR: %clanguage option requires language file name\n",1$   744: 	    CMDLINE_OPTION_SWITCH);   745: 	return 0;
   746:     }o	   747: } 
MEND cmdopt_language. Go to: Beginning of routine.

*



1   748: V   749: /*************************************************************************++*/

iROUTINE cmdopt_urlprefix. Go to: rmNext routine in file; Routines in this file.

r

    750: int cmdopt_urlprefix(iG   751: /* Command line option handler to set HTML URL prefix.			    */*   752:    753:     int	    vOptCode,*+   754: 	    /* (READ, BY VAL):						    */0O   755: 	    /* Option keyword translation code, ignored by this routine.    */A   756:    757:     char    *aValStr,   758: 	    /* (READ, BY ADDR):						    */D   759: 	    /* Option value string, preceded by equal sign.		    */   760:     -   761: )	/* Returns status code:						    */o?   762: 	/*  1	- Successful processing of this option.			    */e+   763: 	/*  0	- Prefix missing.					    */ O   764: 	/*****************************************************************--*/    765: 	   766: { U   767:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') { !   768: 	set_url_prefix(aValStr);c   769: 	return 1;
   770:     }*   771:     else {E   772: 	printf("ERROR: %curlprefix option requires prefix string\n",5$   773: 	    CMDLINE_OPTION_SWITCH);   774: 	return 0;
   775:     } 	   776: }0
NEND cmdopt_urlprefix. Go to: Beginning of routine.





    777: V   778: /*************************************************************************++*/

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

6

    779: int cmdopt_callers(EV   780: /* Command line option handler to set maximum number of callers to allow    */?   781: /* inline expansion of routine call subtrees.				    */+   782:    783:     int	    vOptCode,a+   784: 	    /* (READ, BY VAL):						    */oO   785: 	    /* Option keyword translation code, ignored by this routine.    */6   786:    787:     char    *aValStr,   788: 	    /* (READ, BY ADDR):						    */D   789: 	    /* Option value string, preceded by equal sign.		    */   790:     -   791: )	/* Returns status code:						    */m?   792: 	/*  1	- Successful processing of this option.			    */]5   793: 	/*  0	- Option value out of range.				    */6O   794: 	/*****************************************************************--*/3   795: 	   796: {e>   797:     int	    maxcallers;			    /* Option value.		    */   798: 9   799:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR) { $   800: 	maxcallers = atoi(aValStr);\   801: 	if (maxcallers >= MIN_MAX_CALLERS && maxcallers <= MAX_MAX_CALLERS) {)   802: 	    set_max_callers(maxcallers);{   803: 	    return 1;
   804: 	}
   805:     }P   806:     printf("ERROR: %ccallers option requires value between %d and %d\n",B   807: 	CMDLINE_OPTION_SWITCH, MIN_MAX_CALLERS, MAX_MAX_CALLERS);   808:     return 0; 	   809: }t
LEND cmdopt_callers. Go to: Beginning of routine.





8   810: V   811: /*************************************************************************++*/

eROUTINE cmdopt_depth. Go to: imNext routine in file; Routines in this file.

8

r   812: int cmdopt_depth(0V   813: /* Command line option handler to set maximum call tree expansion depth.    */   814:    815:     int	    vOptCode,*+   816: 	    /* (READ, BY VAL):						    */*O   817: 	    /* Option keyword translation code, ignored by this routine.    */=   818:    819:     char    *aValStr,   820: 	    /* (READ, BY ADDR):						    */D   821: 	    /* Option value string, preceded by equal sign.		    */   822:     -   823: )	/* Returns status code:						    */ ?   824: 	/*  1	- Successful processing of this option.			    */x5   825: 	/*  0	- Option value out of range.				    */ O   826: 	/*****************************************************************--*/	   827: 	   828: { <   829:     int	    maxdepth;			    /* Option value.		    */   830: 9   831:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR) {R"   832: 	maxdepth = atoi(aValStr);G   833: 	if (maxdepth > 0 && maxdepth < MAX_TREE_DEPTH) { *   834: 	    set_max_tree_depth(maxdepth);   835: 	    return 1;
   836: 	}
   837:     }sN   838:     printf("ERROR: %cdepth option requires value between %d and %d\n",7   839: 	CMDLINE_OPTION_SWITCH, 1, MAX_TREE_DEPTH - 1);t   840:     return 0; 	   841: }*
JEND cmdopt_depth. Go to: Beginning of routine.





    842: V   843: /*************************************************************************++*/

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

n

	   844: int cmdopt_report(Q   845: /* Command line option handler to set specified report generation.	    */e   846:    847:     int	    vOptCode,	+   848: 	    /* (READ, BY VAL):						    */ O   849: 	    /* Option keyword translation code, ignored by this routine.    */E   850:    851:     char    *aValStr,   852: 	    /* (READ, BY ADDR):						    */D   853: 	    /* Option value string, preceded by equal sign.		    */   854:     -   855: )	/* Returns status code:						    */L?   856: 	/*  1	- Successful processing of this option.			    */ 3   857: 	/*  0	- Report keywords missing.				    */ O   858: 	/*****************************************************************--*/n   859: 	   860: { 0   861: 					    /* Report option keyword	    */+   862: 					    /* dispatch table.		    */l4   863:     static KEYWORD_DEFINITION keywords[] = {>   864: 	{"defined",	3, cmdopt_clear,    RPT_DEFINED_DISABLE},B   865: 	{"undefined",	3, cmdopt_clear,    RPT_UNDEFINED_DISABLE},?   866: 	{"calls",	3, cmdopt_clear,    RPT_CALLS_DISABLE},	    	?   867: 	{"trees",	3, cmdopt_clear,    RPT_TREES_DISABLE},	    n?   868: 	{"xrefs",	3, cmdopt_clear,    RPT_XREFS_DISABLE},	    l?   869: 	{"files",	3, cmdopt_clear,    RPT_FILES_DISABLE},	    TA   870: 	{"byfile",	3, cmdopt_clear,    RPT_BYFILE_DISABLE},	     A   871: 	{"source",	3, cmdopt_clear,    RPT_SOURCE_DISABLE},	     6   872: 	{NULL,		0, NULL}	    /* End of table.		    */   873:     };   874: U   875:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {g   876:     3   877: 					    /* Disable all reports, then    */3   878: 					    /* enable only those specified  */mC   879: 	set_option( RPT_DEFINED_DISABLE |   /* by keyword.		    */	&   880: 		     RPT_UNDEFINED_DISABLE |"   881: 		     RPT_CALLS_DISABLE |"   882: 		     RPT_TREES_DISABLE |"   883: 		     RPT_XREFS_DISABLE |#   884: 		     RPT_BYFILE_DISABLE |l"   885: 		     RPT_FILES_DISABLE |#   886: 		     RPT_SOURCE_DISABLE); 3   887: 	if (!process_keyword(aValStr, keywords)) {%?   888: 	    printf("ERROR: Unable to process %creport option",a!   889: 		CMDLINE_OPTION_SWITCH);    890: 	    return 0;
   891: 	}   892: 	else {    893: 	    return 1;
   894: 	}
   895:     }    896:     else {P   897: 	printf("ERROR: %creport option requires report type keyword or list\n",$   898: 	    CMDLINE_OPTION_SWITCH);   899: 	return 0;
   900:     } 	   901: } 
KEND cmdopt_report. Go to: Beginning of routine.

8



/   902: V   903: /*************************************************************************++*/

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

>

1   904: int cmdopt_noreport(V   905: /* Command line option handler to suppress specified report generation.	    */   906:    907:     int	    vOptCode,z+   908: 	    /* (READ, BY VAL):						    *//O   909: 	    /* Option keyword translation code, ignored by this routine.    */n   910:    911:     char    *aValStr,   912: 	    /* (READ, BY ADDR):						    */D   913: 	    /* Option value string, preceded by equal sign.		    */   914:     -   915: )	/* Returns status code:						    */R?   916: 	/*  1	- Successful processing of this option.			    */a3   917: 	/*  0	- Report keywords missing.				    */O   918: 	/*****************************************************************--*/9   919: 	   920: {e3   921: 					    /* No-report option keyword	    */ +   922: 					    /* dispatch table.		    */*4   923:     static KEYWORD_DEFINITION keywords[] = {<   924: 	{"defined",	3, cmdopt_set,    RPT_DEFINED_DISABLE},@   925: 	{"undefined",	3, cmdopt_set,    RPT_UNDEFINED_DISABLE},=   926: 	{"calls",	3, cmdopt_set,    RPT_CALLS_DISABLE},	    +=   927: 	{"trees",	3, cmdopt_set,    RPT_TREES_DISABLE},	     =   928: 	{"xrefs",	3, cmdopt_set,    RPT_XREFS_DISABLE},	     =   929: 	{"files",	3, cmdopt_set,    RPT_FILES_DISABLE},	    p?   930: 	{"byfile",	3, cmdopt_set,    RPT_BYFILE_DISABLE},	    T?   931: 	{"source",	3, cmdopt_set,    RPT_SOURCE_DISABLE},	     6   932: 	{NULL,		0, NULL}	    /* End of table.		    */   933:     };   934: U   935:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') {*3   936: 	if (!process_keyword(aValStr, keywords)) {TA   937: 	    printf("ERROR: Unable to process %cnoreport option",/!   938: 		CMDLINE_OPTION_SWITCH);N   939: 	    return 0;
   940: 	}   941: 	else {i   942: 	    return 1;
   943: 	}
   944:     }    945:     else {   946: 	printf(O   947: 	    "ERROR: %cnoreport option requires report type keyword or list\n",*$   948: 	    CMDLINE_OPTION_SWITCH);   949: 	return 0;
   950:     } 	   951: } 
MEND cmdopt_noreport. Go to: Beginning of routine.

d



c   952: V   953: /*************************************************************************++*/

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



t!   954: int cmdopt_fmt_kwhandler(I   955: /* Common keyword handler for format command line option.		    */-   956:     957:     report_output_format   958:     	    vFormat+   959: 	    /* (READ, BY VAL):						    */f(   960: 	    /* Format code.						    */   961: -   962: )	/* Returns status flag:						    */x?   963: 	/*  1	- Successful processing of this option.			    */_>   964: 	/*  0	- Conflicting format option specified.			    */O   965: 	/*****************************************************************--*/o   966: 	   967: {bG   968:     if (rpt_text_enabled() || report_format() != FORMAT_TEXT) {X>   969: 	puts("ERROR: Conflicting format options specififed");   970: 	return 0;
   971:     }0   972:     else {   973: 	switch (vFormat) {8   974: 	case FORMAT_TEXT:H   975: 	    set_option(RPT_TEXT_ENABLE);	/* Text has special flag.   */   976: 	case FORMAT_SDML:   977: 	case FORMAT_HTML:(   978: 	    set_report_format(vFormat);   979: 	    break;E   980: 	case FORMAT_RTF:    981: 	case FORMAT_WINHELP:_   982: 	case FORMAT_VMSHELP:fU   983: puts("Sorry, the RTF, WINHELP, and VMSHELP formats are not yet implemented");r   984: return 0;l   985: 	    break;.
   986: 	}   987:         return 1;O
   988:     }6	   989: }R
REND cmdopt_fmt_kwhandler. Go to: Beginning of routine.





*   990: V   991: /*************************************************************************++*/

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

r

	   992: int cmdopt_format(K   993: /* Command line option handler to set report output format.		    */8   994:    995:     int	    vOptCode, +   996: 	    /* (READ, BY VAL):						    */ O   997: 	    /* Option keyword translation code, ignored by this routine.    */S   998:    999:     char    *aValStr,  1000: 	    /* (READ, BY ADDR):						    */D  1001: 	    /* Option value string, preceded by equal sign.		    */  1002:     -  1003: )	/* Returns status code:						    */ ?  1004: 	/*  1	- Successful processing of this option.			    */T2  1005: 	/*  0	- Format keyword missing.				    */O  1006: 	/*****************************************************************--*/r  1007: 	  1008: {0  1009: 					    /* Format option keyword	    */+  1010: 					    /* dispatch table.		    */*4  1011:     static KEYWORD_DEFINITION keywords[] = {B  1012: 	{"text",        3, cmdopt_fmt_kwhandler,    FORMAT_TEXT},B  1013: 	{"sdml",        3, cmdopt_fmt_kwhandler,    FORMAT_SDML},B  1014: 	{"html",        3, cmdopt_fmt_kwhandler,    FORMAT_HTML},:  1015: 	{"rtf",		3, cmdopt_fmt_kwhandler,    FORMAT_RTF},A  1016: 	{"winhelp",	3, cmdopt_fmt_kwhandler,    FORMAT_WINHELP}, A  1017: 	{"vmshelp",	3, cmdopt_fmt_kwhandler,    FORMAT_VMSHELP}, 6  1018: 	{NULL,		0, NULL}	    /* End of table.		    */  1019:     };  1020: U  1021:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR && *aValStr != '\0') { 3  1022: 	if (!process_keyword(aValStr, keywords)) { ?  1023: 	    printf("ERROR: Unable to process %cformat option",L!  1024: 		CMDLINE_OPTION_SWITCH);s  1025: 	    return 0;
  1026: 	}  1027: 	else {r  1028: 	    return 1;
  1029: 	}
  1030:     }*  1031:     else {J  1032: 	printf("ERROR: %cformat option requires report format keyword\n",$  1033: 	    CMDLINE_OPTION_SWITCH);  1034: 	return 0;
  1035:     }		  1036: } 
KEND cmdopt_format. Go to: Beginning of routine.

e



F  1037: V  1038: /*************************************************************************++*/

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

S

E  1039: int cmdopt_htmlbyfile(V  1040: /* Command line option handler to set maximum number of entries of HTML	    */7  1041: /* output to allow per by-file file.					    */*  1042:   1043:     int	    vOptCode, +  1044: 	    /* (READ, BY VAL):						    */_O  1045: 	    /* Option keyword translation code, ignored by this routine.    *//  1046:   1047:     char    *aValStr,  1048: 	    /* (READ, BY ADDR):						    */D  1049: 	    /* Option value string, preceded by equal sign.		    */  1050:     -  1051: )	/* Returns status code:						    */T?  1052: 	/*  1	- Successful processing of this option.			    */ *  1053: 	/*  0	- Value missing.					    */O  1054: 	/*****************************************************************--*/I  1055: 	  1056: { 9  1057:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR) {t,  1058: 	set_max_html_byfile(atoi(aValStr));  1059: 	return 1;
  1060:     } A  1061:     printf("ERROR: %chtmlbyfile option requires value\n",    1062: 	CMDLINE_OPTION_SWITCH);  1063:     return 0;{	  1064: }p
OEND cmdopt_htmlbyfile. Go to: Beginning of routine.

I



T  1065: V  1066: /*************************************************************************++*/

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

l

4  1067: int cmdopt_htmlxref(V  1068: /* Command line option handler to set maximum number of entries of HTML	    */9  1069: /* output to allow per call xref file.					    */p  1070:   1071:     int	    vOptCode,l+  1072: 	    /* (READ, BY VAL):						    */ O  1073: 	    /* Option keyword translation code, ignored by this routine.    */	  1074:   1075:     char    *aValStr,  1076: 	    /* (READ, BY ADDR):						    */D  1077: 	    /* Option value string, preceded by equal sign.		    */  1078:     -  1079: )	/* Returns status code:						    */p?  1080: 	/*  1	- Successful processing of this option.			    */s*  1081: 	/*  0	- Value missing.					    */O  1082: 	/*****************************************************************--*/s  1083: 	  1084: {9  1085:     if (*aValStr++ == CMDLINE_OPTION_SEPARATOR) {**  1086: 	set_max_html_xref(atoi(aValStr));  1087: 	return 1;
  1088:     }n?  1089:     printf("ERROR: %chtmlxref option requires value\n",    1090: 	CMDLINE_OPTION_SWITCH);  1091:     return 0;4	  1092: }d
MEND cmdopt_htmlxref. Go to: Beginning of routine.

T



S  1093: V  1094: /*************************************************************************++*/

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



9  1095: int cmdopt_author(V  1096: /* Command line option handler to show program author for posterity (gee,   */*  1097: /* I'm embarrassed!).							    */  1098: )  1099:     /* No arguments.							    */a  1100: E  1101: )	/* Returns 0 to indicate that this option is totally bogus! O  1102: 	/*****************************************************************--*/N  1103: 	  1104: { T  1105:     printf("%s %s\n%s\n", PROGRAM_IDENT, PROGRAM_COPYRIGHT, PROGRAM_AUTHOR);  1106:     return 0;l	  1107: }6
KEND cmdopt_author. Go to: Beginning of routine.

s



8  1108: V  1109: /*************************************************************************++*/

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

A

E  1110: void show_help(lH  1111: /* Prints help information to stdout and EXITS PROGRAM.			    */  1112: )  1113:     /* No arguments.							    */>  1114: .  1115: )	/* No return value.      					    */O  1116: 	/*****************************************************************--*/n  1117: 	  1118: {B  1119:     printf("%s %s\n\n", PROGRAM_IDENT, PROGRAM_COPYRIGHT);!  1120:     puts(PROGRAM_PARAMS);f8  1121:     printf(PROGRAM_HELP, CMDLINE_OPTION_SWITCH);  1122:     puts(aY  1123: "\nWhere: product_file is the product definition file listing the source files");   1124:     puts(l%  1125: "          to be analyzed.");/  1126:     puts(*G  1127: "       options are the following (they may be abbreviated):");<  1128: #if 0 /* This help is too long and is incomplete! */  1129:     printf(XU  1130: "          %chelp - Show this full help and exit.\n", CMDLINE_OPTION_SWITCH);   1131:     printf( M  1132: "          %clist - Create listing file <output_prefix>%s%s\n", G  1133: 	CMDLINE_OPTION_SWITCH, OUTFILE_SUFFIX_LIST, OUTFILE_EXT_LIST);c  1134:     printf(9Q  1135: "          %csilent - Disable stdout logging.\n", CMDLINE_OPTION_SWITCH);k  1136:     printf(MN  1137: "          %cbrief - Brief stdout logging.\n", CMDLINE_OPTION_SWITCH);  1138:     printf(F\  1139: "          %coutprefix=output_prefix - Output file pathname and filename prefix;\n",   1140: 	CMDLINE_OPTION_SWITCH);  1141:     puts(8W  1142: "             suffixes and extensions will be added to this prefix to create");n  1143:     puts(<0  1144: "             full output file names.");  1145:     printf(*V  1146: "          %cdefinition - Log routine definitions.\n", CMDLINE_OPTION_SWITCH);  1147:     printf(fT  1148: "          %creference - Log routine references.\n", CMDLINE_OPTION_SWITCH);  1149:     printf(r©  1150: "          %cseparate=sep_file - Name of file containing routine names for which\n             separate trees must always be generated if they call anything.\n",9   1151: 	CMDLINE_OPTION_SWITCH);  1152:     printf(R  1153: "          %clanguage - Name of file containing language definitions of the\n            form <ext>=<language>, where <ext> is a file type extension, and\n            <language> is one of the keywords \"c\", \"bliss\", or \"text\".\n",0   1154: 	CMDLINE_OPTION_SWITCH);  1155:     printf( t  1156: "          %cnoinline - Generate separate call trees for all routines that call\n              anything.\n",   1157: 	CMDLINE_OPTION_SWITCH);  1158:     printf(*M  1159: "          %ctext - Format reports as plain text files (default).\n",t   1160: 	CMDLINE_OPTION_SWITCH);  1161:     printf(	s  1162: "          %csdml - Format reports as Standard Digital Markup Language for\n              VAX Document.\n",F   1163: 	CMDLINE_OPTION_SWITCH);  1164:     printf(hy  1165: "          %chtml - Format reports as Hyper Text Markup Language for World-\n              Wide Web browsers.\n",m   1166: 	CMDLINE_OPTION_SWITCH);  1167:     printf(mw  1168: "          %ccallers=N - Set max callers for inline subtrees to N\n              (range %d-%d, default %d).\n",UA  1169: 	CMDLINE_OPTION_SWITCH, MIN_MAX_CALLERS, MAX_MAX_CALLERS,   1170: 	DEF_MAX_CALLERS);
  1171: #elseIG  1172:     printf("          %chelp                       %cauthor\n",r7  1173: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);bQ  1174:     printf("          %coptions=opt_file           %ctrace=debug_list\n",r7  1175: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);rE  1176:     printf("          %clog=log_file               %clist\n",E7  1177: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);F  1178:     printf("          %csilent                     %cbrief\n",7  1179: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);#U  1180:     printf("          %coutprefix=outfile_prefix   %curlprefix=url_prefix\n",*7  1181: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);*R  1182:     printf("          %cformat=report_format       %cseparate=sep_file\n",7  1183: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);0V  1184:     printf("          %clanguage=lang_file         %cdescription=desc_file\n",7  1185: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH); J  1186:     printf("          %cdefinition                 %creference\n",7  1187: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);*H  1188:     printf("          %ccallers=n                  %cdepth=n\n",7  1189: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);iU  1190:     printf("          %creport=report_list         %cnoreport=report_list\n",87  1191: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);pK  1192:     printf("          %chtmlbyfile=n               %chtmlxref=n\n",*7  1193: 	CMDLINE_OPTION_SWITCH, CMDLINE_OPTION_SWITCH);e,  1194:     printf("          %cnoinline\n",   1195: 	CMDLINE_OPTION_SWITCH);  1196: #endif	  1197: 	*I  1198:     if (list_enabled()) {		    /* Close the listing file if    */0>  1199: 	fclose(list_file());		    /* one was created.		    */
  1200:     }t  1201:     7  1202:     exit(0);				    /* End the program!		    */ 	  1203: }r
GEND show_help. Go to: Beginning of routine.

T



   1204: V  1205: /*************************************************************************++*/

]ROUTINE main. Go to: *mNext routine in file; Routines in this file.

>

h
  1206: main( ,  1207: /* Program main routine.						    */  1208:   1209:     int	    vArgc,+  1210: 	    /* (READ, BY VAL):						    */0D  1211: 	    /* Number of program argument strings in aArgv.		    */  1212:   1213:     char    *aArgv[],  1214: 	    /* (READ, BY ADDR):						    */:  1215: 	    /* List of program argument strings.			    */  1216: 4  1217: )	/* Returns system success code.					    */O  1218: 	/*****************************************************************--*/   1219: 	  1220: {3  1221: 					    /* Main program command line    */ 3  1222: 					    /* argument options dispatch    */	#  1223: 					    /* table.			    */t3  1224:     static KEYWORD_DEFINITION options[] = {e2  1225: 	{"options",     3, process_options_file},   1226: 	{"help",	3, show_help},$  1227: 	{"trace",	3, cmdopt_trace},-  1228: 	{"log",         3, cmdopt_log},	     -  1229: 	{"list",        3, cmdopt_list},    ==  1230: 	{"silent",      3, cmdopt_set,	LOG_SILENT_ENABLE},  (=  1231: 	{"brief",       3, cmdopt_set,	LOG_BRIEF_ENABLE},   n.  1232: 	{"outprefix",   3, cmdopt_outprefix},&  1233: 	{"format",	3, cmdopt_format},0  1234: 	{"description", 3, cmdopt_description},8  1235: 	{"definition",  3, cmdopt_set,	LOG_DEF_ENABLE},8  1236: 	{"reference",   3, cmdopt_set,	LOG_REF_ENABLE},-  1237: 	{"separate",    3, cmdopt_separate},**  1238: 	{"language",	3, cmdopt_language},=  1239: 	{"noinline",    3, cmdopt_set,	TREE_INLINE_DISABLE},m.  1240: 	{"urlprefix",   3, cmdopt_urlprefix},(  1241: 	{"callers",	3, cmdopt_callers},$  1242: 	{"depth",	3, cmdopt_depth},&  1243: 	{"report",	3, cmdopt_report},-  1244: 	{"noreport",    3, cmdopt_noreport}, .  1245: 	{"htmlbyfile",	5, cmdopt_htmlbyfile},*  1246: 	{"htmlxref",	5, cmdopt_htmlxref},&  1247: 	{"author",	3, cmdopt_author},>  1248: 	{NULL,          0, NULL}	    /* End of table.		    */  1249:     };  1250:   1251:     /*+									    */U  1252:     /*	Make sure enough required arguments were specified, then process    */ Q  1253:     /*	the optional arguments and analyze the product files. If no	    */ U  1254:     /*	arguments, show brief help. If first argument is an option, show    */iU  1255:     /*	full help regardless of which options were specified. Note that	    */*R  1256:     /*	showing full help terminates the program without any further	    */U  1257:     /*	processing of the command line, even if all the arguments are ok.   */1  1258:     /*-									    */  1259:       1260:     if (vArgc < 2) {   1261: 	puts(PROGRAM_PARAMS);<  1262:         printf(PROGRAM_HELP, CMDLINE_OPTION_SWITCH);
  1263:     }P:  1264:     else if (*aArgv[1] == CMDLINE_OPTION_SWITCH) {  1265: 	    show_help();5
  1266:     }n  1267:     else {3  1268: 					    /* Disable these reports by	    */*%  1269: 					    /* default.			    */7;  1270: 	set_option(RPT_CALLS_DISABLE | RPT_TREES_DISABLE);,	  1271: 	P*  1272: 	set_max_callers(DEF_MAX_CALLERS);2  1273: 	set_max_html_byfile(DEF_MAX_HTML_BYFILE);.  1274: 	set_max_html_xref(DEF_MAX_HTML_XREF);0  1275: 	set_max_tree_depth(MAX_TREE_DEPTH + 1);9  1276: 	if (process_options(vArgc, aArgv, 2, options)) { 6  1277: 	    add_lang(new_lang("DAT", LANGUAGE_TEXT));6  1278: 	    add_lang(new_lang("TXT", LANGUAGE_TEXT));5  1279: 	    add_lang(new_lang("COM", LANGUAGE_DCL));p4  1280: 	    add_lang(new_lang("C",   LANGUAGE_CC));4  1281: 	    add_lang(new_lang("H",   LANGUAGE_CC));7  1282: 	    add_lang(new_lang("BLI", LANGUAGE_BLISS));s7  1283: 	    add_lang(new_lang("REQ", LANGUAGE_BLISS)); 7  1284: 	    add_lang(new_lang("R32", LANGUAGE_BLISS));E'  1285: 	    analyze_product(aArgv[1]);5"  1286: 	    if (list_enabled()) {  1287: 		fclose(list_file());  1288: 	    }
  1289: 	}
  1290:     } 	  1291: }i
BEND main. Go to: Beginning of routine.





   1292: 
END OF FILEf!TOTAL: 24 routines, 50 Avg Lengthe

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