objects.h Source Code

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

Routines In This File (Alphabetical)

 Line Name
----- ----
  240 add_caller
  106 add_lang
  237 add_ref
  172 add_srcref
  215 def_begin
  219 def_callers
  216 def_end
  217 def_length
  212 def_name
  230 def_num_callers
  231 def_num_calls
  218 def_refs
  214 def_root
  213 def_source
  220 def_tree_required
  221 def_tree_size
  222 def_xreffile
  242 find_caller
  241 find_ref
  166 inc_source_calls
  160 inc_source_comments
  163 inc_source_empty
  162 inc_source_mixed
  165 inc_source_rlength
  164 inc_source_routines
  161 inc_source_statements
  244 isalready_expanded
  243 isdefined_routine
  278 isrecursive_ref
   98 lang_code
   97 lang_fext
  239 pop_ref
  238 push_ref
  271 ref_caller
  268 ref_definition
  270 ref_line
  269 ref_name
  272 ref_offset
  107 remove_lang
  225 set_def_begin
  226 set_def_end
  224 set_def_root
  223 set_def_source
  227 set_def_tree_req
  228 set_def_tree_size
  229 set_def_xreffile
  100 set_lang_code
   99 set_lang_fext
  159 set_source_byfilefile
  155 source_avglen
  158 source_byfilefile
  156 source_calls
  149 source_comments
  152 source_empty
  148 source_line
  146 source_lines
  151 source_mixed
  145 source_name
  157 source_reflist
  154 source_rlength
  153 source_routines
  144 source_seq
  150 source_statements
  147 source_tabsize

BEGINNING OF FILE

     1: /****************************************************************************/
     2: /*									    */
     3: /*  FACILITY:	Routine Analyzer					    */
     4: /*									    */
     5: /*  MODULE:	Object Management Support Header			    */
     6: /*									    */
     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */
     8: /*		Equipment Corporation, Littleton, MA, USA.		    */
     9: /*									    */
    10: /*  DESCRIPTION: This header file contains all type definitions for the	    */
    11: /*  object types used by Routine Analyzer. Member access routines (get/set  */
    12: /*  values) and a number of object management routines are implemented here */
    13: /*  as macros.								    */
    14: /*									    */
    15: /*  REVISION HISTORY:							    */
    16: /*									    */
    17: /*  V0.1-01 09-JAN-1994 Steve Branam                                        */  
    18: /*                                                                          */
    19: /*      Replace LANGUAGE_C with LANGUAGE_CC to avoid conflict with Unix     */
    20: /*      C compiler predefined symbol.                                       */
    21: /*									    */
    22: /*  V0.1-00 24-AUG-1994 Steve Branam					    */
    23: /*									    */
    24: /*	Original version.						    */
    25: /*									    */
    26: /****************************************************************************/
    27: 
    28: #ifndef __OBJECTS_H
    29: #define __OBJECTS_H
    30: 
    31: /*									    */
    32: /* String object names.							    */
    33: /*									    */
    34: 
    35: #define OBJ_NAME_FILENAME	"File name"
    36: #define OBJ_NAME_LANG_EXT	"Language file extension"
    37: #define OBJ_NAME_ROUTINENAME	"Routine name"
    38: #define OBJ_NAME_AUTHORNAME	"Program author"
    39: 
    40: /****************************************************************************/
    41: /*									    */
    42: /* LIST ENTRY OBJECTS							    */
    43: /*									    */
    44: /*	This general class of objects can be strung together on a	    */
    45: /*	doubly-linked list. There are several specific subtypes in this	    */
    46: /*	general class:							    */
    47: /*									    */
    48: /*	Language Translation Record					    */
    49: /*									    */
    50: /*	    Contains all the information for a file extension-to-language   */
    51: /*	    translation.						    */
    52: /*									    */
    53: /*	Source File Record						    */
    54: /*									    */
    55: /*	    Contains all the information for a single source file.	    */
    56: /*									    */
    57: /*	Routine Definition Record					    */
    58: /*									    */
    59: /*	    Contains all the information for the definition of a single	    */
    60: /*	    routine.							    */
    61: /*									    */
    62: /*	Routine Reference Record					    */
    63: /*									    */
    64: /*	    Contains all the information for a given reference (call) to    */
    65: /*	    a routine.							    */
    66: /*									    */
    67: /****************************************************************************/
    68: 
    69: /****************************************************************************/
    70: /*									    */
    71: /* Language translation record object type.				    */
    72: /*									    */
    73: /****************************************************************************/
    74: 
    75: #define OBJ_NAME_LANGTRANS	"LANGUAGE_TRANSLATION"
    76: 
    77: typedef enum {				    /* List of known languages.	    */
    78:     LANGUAGE_UNKNOWN,
    79:     LANGUAGE_TEXT,
    80:     LANGUAGE_DCL,
    81:     LANGUAGE_BLISS,
    82:     LANGUAGE_CC
    83: } SOURCE_LANGUAGE;
    84: 
    85: typedef struct lang_trans_record {
    86:     LIST_ENTRY_HDR			    /* List linkage.		    */
    87: 	    entry_hdr;
    88:     char    *fext;			    /* File extension string.	    */
    89:     SOURCE_LANGUAGE			    /* Language code.		    */
    90: 	    code;
    91: } LANGUAGE_TRANSLATION;
    92: 
    93: /*									    */
    94: /* Language translation member access routines.				    */
    95: /*									    */
    96: 

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

    97: #define lang_fext(l) ((l)->fext)
END lang_fext. Go to: Beginning of routine.



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

    98: #define lang_code(l) ((l)->code)
END lang_code. Go to: Beginning of routine.



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

    99: #define set_lang_fext(l, s) ((l)->fext = s)
END set_lang_fext. Go to: Beginning of routine.



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

   100: #define set_lang_code(l, x) ((l)->code = x)
END set_lang_code. Go to: Beginning of routine.


   101: 
   102: /*									    */
   103: /* Language translation management routines.				    */
   104: /*									    */
   105: 

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

   106: #define add_lang(l) (enqueue_entry(global_langlist(), l))
END add_lang. Go to: Beginning of routine.



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

   107: #define remove_lang() (dequeue_entry(global_langlist()))
END remove_lang. Go to: Beginning of routine.


   108: 
   109: /****************************************************************************/
   110: /*									    */
   111: /* Source file record object type.					    */
   112: /*									    */
   113: /****************************************************************************/
   114: 
   115: #define OBJ_NAME_SOURCEFILE	"SOURCEFILE"
   116: 
   117: typedef struct source_record {
   118:     LIST_ENTRY_HDR			    /* List linkage.		    */
   119: 	    entry_hdr;
   120:     int	    seqnum;			    /* File sequence number.	    */
   121:     char    *name;			    /* File name.		    */
   122:     char    *author;			    /* Program author, that's me!   */
   123:     int	    tabsize;			    /* Source text tab size.	    */
   124:     long    lines;			    /* Total number of lines.	    */
   125:     long    comments;			    /* Number comment-only lines.   */
   126:     long    statements;			    /* Number statement-only lines. */
   127:     long    mixed;			    /* Number mixed comment/	    */
   128: 					    /* statement lines.		    */
   129:     long    routines;			    /* Number routines defined.	    */
   130:     long    rlength;			    /* Length of all routine defs.  */
   131:     long    calls;			    /* Number of routine calls made */
   132: 					    /* in this file.		    */
   133:     LIST    reflist;			    /* List of routines defined in  */
   134: 					    /* this file, treated as	    */
   135: 					    /* callers.			    */
   136:     int	    byfilefile;			    /* By-file report file number   */
   137: 					    /* for linking.		    */
   138: } SOURCEFILE;
   139: 
   140: /*									    */
   141: /* Source file record member access routines.				    */
   142: /*									    */
   143: 

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

   144: #define source_seq(src) ((src)->seqnum)
END source_seq. Go to: Beginning of routine.



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

   145: #define source_name(src) ((src)->name)
END source_name. Go to: Beginning of routine.



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

   146: #define source_lines(src) ((src)->lines)
END source_lines. Go to: Beginning of routine.



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

   147: #define source_tabsize(src) ((src)->tabsize)
END source_tabsize. Go to: Beginning of routine.



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

   148: #define source_line(src) ((src)->lines + 1)
END source_line. Go to: Beginning of routine.



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

   149: #define source_comments(src) ((src)->comments)
END source_comments. Go to: Beginning of routine.



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

   150: #define source_statements(src) ((src)->statements)
END source_statements. Go to: Beginning of routine.



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

   151: #define source_mixed(src) ((src)->mixed)
END source_mixed. Go to: Beginning of routine.



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

   152: #define source_empty(src) ((src)->lines-(src)->mixed-(src)->comments-(src)->statements)
END source_empty. Go to: Beginning of routine.



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

   153: #define source_routines(src) ((src)->routines)
END source_routines. Go to: Beginning of routine.



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

   154: #define source_rlength(src) ((src)->rlength)
END source_rlength. Go to: Beginning of routine.



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

   155: #define source_avglen(src) (source_routines(src)==0?0:((source_rlength(src) * 10)/source_routines(src) + 5)/ 10)
END source_avglen. Go to: Beginning of routine.



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

   156: #define source_calls(src) ((src)->calls)
END source_calls. Go to: Beginning of routine.



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

   157: #define source_reflist(src) (&(src)->reflist)
END source_reflist. Go to: Beginning of routine.



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

   158: #define source_byfilefile(src) ((src)->byfilefile)
END source_byfilefile. Go to: Beginning of routine.



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

   159: #define set_source_byfilefile(src, f) ((src)->byfilefile = f)
END set_source_byfilefile. Go to: Beginning of routine.



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

   160: #define inc_source_comments(src) ((src)->lines++,(src)->comments++)
END inc_source_comments. Go to: Beginning of routine.



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

   161: #define inc_source_statements(src) ((src)->lines++,(src)->statements++)
END inc_source_statements. Go to: Beginning of routine.



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

   162: #define inc_source_mixed(src) ((src)->lines++,(src)->mixed++)
END inc_source_mixed. Go to: Beginning of routine.



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

   163: #define inc_source_empty(src) ((src)->lines++)
END inc_source_empty. Go to: Beginning of routine.



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

   164: #define inc_source_routines(src) ((src)->routines++)
END inc_source_routines. Go to: Beginning of routine.



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

   165: #define inc_source_rlength(src, x) ((src)->rlength += x)
END inc_source_rlength. Go to: Beginning of routine.



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

   166: #define inc_source_calls(src, x) ((src)->calls += x)
END inc_source_calls. Go to: Beginning of routine.


   167: 
   168: /*									    */
   169: /* Source file record management routines.				    */
   170: /*									    */
   171: 

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

   172: #define add_srcref(s,r) (insert_ordered_entry(&(s)->reflist, r, compare_caller))
END add_srcref. Go to: Beginning of routine.


   173: 
   174: /****************************************************************************/
   175: /*									    */
   176: /* Routine definition record object type.				    */
   177: /*									    */
   178: /****************************************************************************/
   179: 
   180: typedef enum {
   181:     NOT_YET_EVALUATED,
   182:     TREE_REQUIRED,
   183:     TREE_NOT_REQUIRED
   184: } TREE_REQ;
   185: 
   186: #define OBJ_NAME_DEFINITION	"DEFINITION"
   187: 
   188: typedef struct definition_record {
   189:     LIST_ENTRY_HDR			    /* List linkage.		    */
   190: 	    entry_hdr;
   191:     char    *name;			    /* Routine name.		    */
   192:     struct source_record
   193: 	    *source;			    /* Ptr to source file record.   */
   194:     struct definition_record		    /* Ptr to root of call tree.    */
   195: 	    *rootdef;
   196:     long    begin;			    /* Beginning line in source.    */
   197:     long    end;			    /* Ending line in source.	    */
   198:     LIST    refs;			    /* List of referenced routines. */
   199:     LIST    callers;			    /* List of referencing	    */
   200: 					    /* routines.		    */
   201:     TREE_REQ				    /* Call tree required flag.	    */
   202: 	    needs_tree;
   203:     int	    treesize;			    /* Number of nodes in tree.	    */
   204:     int	    xreffile;			    /* Xref report file number for  */
   205: 					    /* linking.			    */
   206: } DEFINITION;
   207: 
   208: /*									    */
   209: /* Routine definition record member access routines.			    */
   210: /*									    */
   211: 

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

   212: #define def_name(def) ((def)->name)
END def_name. Go to: Beginning of routine.



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

   213: #define def_source(def) ((def)->source)
END def_source. Go to: Beginning of routine.



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

   214: #define def_root(def) ((def)->rootdef)
END def_root. Go to: Beginning of routine.



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

   215: #define def_begin(def) ((def)->begin)
END def_begin. Go to: Beginning of routine.



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

   216: #define def_end(def) ((def)->end)
END def_end. Go to: Beginning of routine.



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

   217: #define def_length(def) (def_end(def) - def_begin(def) + 1)
END def_length. Go to: Beginning of routine.



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

   218: #define def_refs(def) (&(def)->refs)
END def_refs. Go to: Beginning of routine.



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

   219: #define def_callers(def) (&(def)->callers)
END def_callers. Go to: Beginning of routine.



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

   220: #define def_tree_required(def) ((def)->needs_tree)
END def_tree_required. Go to: Beginning of routine.



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

   221: #define def_tree_size(def) ((def)->treesize)
END def_tree_size. Go to: Beginning of routine.



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

   222: #define def_xreffile(def) ((def)->xreffile)
END def_xreffile. Go to: Beginning of routine.



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

   223: #define set_def_source(def, s) ((def)->source = s)
END set_def_source. Go to: Beginning of routine.



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

   224: #define set_def_root(def, x) ((def)->rootdef = x)
END set_def_root. Go to: Beginning of routine.



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

   225: #define set_def_begin(def, x) ((def)->begin = x)
END set_def_begin. Go to: Beginning of routine.



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

   226: #define set_def_end(def, x) ((def)->end = x)
END set_def_end. Go to: Beginning of routine.



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

   227: #define set_def_tree_req(def, x) ((def)->needs_tree = x)
END set_def_tree_req. Go to: Beginning of routine.



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

   228: #define set_def_tree_size(def, x) ((def)->treesize = x)
END set_def_tree_size. Go to: Beginning of routine.



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

   229: #define set_def_xreffile(def, f) ((def)->xreffile = f)
END set_def_xreffile. Go to: Beginning of routine.



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

   230: #define def_num_callers(def) (list_entries(&(def)->callers))
END def_num_callers. Go to: Beginning of routine.



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

   231: #define def_num_calls(def) (list_entries(&(def)->refs))
END def_num_calls. Go to: Beginning of routine.


   232: 
   233: /*									    */
   234: /* Routine definition record management routines.			    */
   235: /*									    */
   236: 

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

   237: #define add_ref(d, r) (append_list_entry(&(d)->refs, r))
END add_ref. Go to: Beginning of routine.



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

   238: #define push_ref(d, r) (push_entry(&(d)->refs, r))
END push_ref. Go to: Beginning of routine.



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

   239: #define pop_ref(d) (pop_entry(&(d)->refs))
END pop_ref. Go to: Beginning of routine.



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

   240: #define add_caller(d,r) (insert_ordered_entry(&(d)->callers, r, compare_caller))
END add_caller. Go to: Beginning of routine.



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

   241: #define find_ref(d,r) (find_list_entry(&(d)->refs, r, compare_ref))
END find_ref. Go to: Beginning of routine.



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

   242: #define find_caller(d,r) (find_list_entry(&(d)->callers, r, compare_caller_name))
END find_caller. Go to: Beginning of routine.



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

   243: #define isdefined_routine(def) ((def)->source != NULL)
END isdefined_routine. Go to: Beginning of routine.



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

   244: #define isalready_expanded(def, root) (!tree_inline_disabled() && isdefined_routine(def) && (def)->rootdef == root)
END isalready_expanded. Go to: Beginning of routine.


   245: 
   246: /****************************************************************************/
   247: /*									    */
   248: /* Routine reference record object type.				    */
   249: /*									    */
   250: /****************************************************************************/
   251: 
   252: #define OBJ_NAME_REFERENCE	"REFERENCE"
   253: 
   254: typedef struct reference_record {
   255:     LIST_ENTRY_HDR			    /* List linkage.		    */
   256: 	    entry_hdr;
   257:     struct definition_record		    /* Ptr to routine definition    */
   258: 	    *definition;		    /* record.			    */
   259:     long    line;			    /* Line in source where called. */
   260:     struct definition_record		    /* Ptr to routine definition    */
   261: 	    *caller;			    /* record of caller.	    */
   262: } REFERENCE;
   263: 
   264: /*									    */
   265: /* Routine reference record member access routines.			    */
   266: /*									    */
   267: 

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

   268: #define ref_definition(ref) (ref->definition)
END ref_definition. Go to: Beginning of routine.



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

   269: #define ref_name(ref) (def_name(ref_definition(ref)))
END ref_name. Go to: Beginning of routine.



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

   270: #define ref_line(ref) (ref->line)
END ref_line. Go to: Beginning of routine.



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

   271: #define ref_caller(ref) (ref->caller)
END ref_caller. Go to: Beginning of routine.



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

   272: #define ref_offset(ref) (ref_line(ref) - def_begin(ref_caller(ref)) + 1)
END ref_offset. Go to: Beginning of routine.


   273: 
   274: /*									    */
   275: /* Routine reference record management routines.			    */
   276: /*									    */
   277: 

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

   278: #define isrecursive_ref(ref, root) (find_ref(root, ref) != NULL)
END isrecursive_ref. Go to: Beginning of routine.


   279: 
   280: /****************************************************************************/
   281: /*									    */
   282: /* Forward references.							    */
   283: /*									    */
   284: /****************************************************************************/
   285: 
   286: REFERENCE *find_ref_in_tree();
   287: int compare_ref();
   288: int compare_file();
   289: int compare_caller();
   290: char *def_ident();
   291: 
   292: #endif /* #ifndef __OBJECTS_H */

END OF FILE TOTAL: 64 routines, 1 Avg Length

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