@Routine Analyzer Source File Analysis - objects.h6

objects.h 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
----- ----)  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_source0  220 def_tree_required,  221 def_tree_size+  222 def_xreffile*  242 find_caller'  241 find_ref/  166 inc_source_calls2  160 inc_source_comments/  163 inc_source_empty/  162 inc_source_mixed1  165 inc_source_rlength2  164 inc_source_routines4  161 inc_source_statements1  244 isalready_expanded0  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_req0  228 set_def_tree_size/  229 set_def_xreffile,  100 set_lang_code,   99 set_lang_fext4  159 set_source_byfilefile,  155 source_avglen0  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_seq0  150 source_statements-  147 source_tabsize


BEGINNING OF FILE


V     1: /****************************************************************************/     2: /*									    */1     3: /*  FACILITY:	Routine Analyzer					    */     4: /*									    */=     5: /*  MODULE:	Object Management Support Header			    */     6: /*									    */O     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */>     8: /*		Equipment Corporation, Littleton, MA, USA.		    */     9: /*									    */V    10: /*  DESCRIPTION: This header file contains all type definitions for the	    */V    11: /*  object types used by Routine Analyzer. Member access routines (get/set  */V    12: /*  values) and a number of object management routines are implemented here */$    13: /*  as macros.								    */    14: /*									    */*    15: /*  REVISION HISTORY:							    */    16: /*									    */X    17: /*  V0.1-01 09-JAN-1994 Steve Branam                                        */  V    18: /*                                                                          */V    19: /*      Replace LANGUAGE_C with LANGUAGE_CC to avoid conflict with Unix     */V    20: /*      C compiler predefined symbol.                                       */    21: /*									    */7    22: /*  V0.1-00 24-AUG-1994 Steve Branam					    */    23: /*									    */(    24: /*	Original version.						    */    25: /*									    */V    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"3    37: #define OBJ_NAME_ROUTINENAME	"Routine name"4    38: #define OBJ_NAME_AUTHORNAME	"Program author"    39: V    40: /****************************************************************************/    41: /*									    */*    42: /* LIST ENTRY OBJECTS							    */    43: /*									    */K    44: /*	This general class of objects can be strung together on a	    */Q    45: /*	doubly-linked list. There are several specific subtypes in this	    */&    46: /*	general class:							    */    47: /*									    */1    48: /*	Language Translation Record					    */    49: /*									    */Q    50: /*	    Contains all the information for a file extension-to-language   */'    51: /*	    translation.						    */    52: /*									    */)    53: /*	Source File Record						    */    54: /*									    */L    55: /*	    Contains all the information for a single source file.	    */    56: /*									    *//    57: /*	Routine Definition Record					    */    58: /*									    */Q    59: /*	    Contains all the information for the definition of a single	    */$    60: /*	    routine.							    */    61: /*									    */.    62: /*	Routine Reference Record					    */    63: /*									    */Q    64: /*	    Contains all the information for a given reference (call) to    */&    65: /*	    a routine.							    */    66: /*									    */V    67: /****************************************************************************/    68: V    69: /****************************************************************************/    70: /*									    */=    71: /* Language translation record object type.				    */    72: /*									    */V    73: /****************************************************************************/    74: 9    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 {9    86:     LIST_ENTRY_HDR			    /* List linkage.		    */    87: 	    entry_hdr;A    88:     char    *fext;			    /* File extension string.	    */;    89:     SOURCE_LANGUAGE			    /* Language code.		    */    90: 	    code;    91: } LANGUAGE_TRANSLATION;    92:     93: /*									    */A    94: /* Language translation member access routines.				    */    95: /*									    */    96: 

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



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

:



a

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

s

/+    98: #define lang_code(l) ((l)->code)0
GEND lang_code. Go to: Beginning of routine.

I



A

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



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

"



A

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

1

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

=



d   101:    102: /*									    */0>   103: /* Language translation management routines.				    */   104: /*									    */"   105: 

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



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





=

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

1

"@   107: #define remove_lang() (dequeue_entry(global_langlist()))
IEND remove_lang. Go to: Beginning of routine.





=   108: V   109: /****************************************************************************/   110: /*									    */H5   111: /* Source file record object type.					    */0   112: /*									    */2V   113: /****************************************************************************/   114: 0   115: #define OBJ_NAME_SOURCEFILE	"SOURCEFILE"   116: &   117: typedef struct source_record {9   118:     LIST_ENTRY_HDR			    /* List linkage.		    */1   119: 	    entry_hdr;>A   120:     int	    seqnum;			    /* File sequence number.	    */06   121:     char    *name;			    /* File name.		    */E   122:     char    *author;			    /* Program author, that's me!   */>B   123:     int	    tabsize;			    /* Source text tab size.	    */A   124:     long    lines;			    /* Total number of lines.	    */E   133:     LIST    reflist;			    /* List of routines defined in  */*0   134: 					    /* this file, treated as	    */%   135: 					    /* callers.			    */ H   136:     int	    byfilefile;			    /* By-file report file number   */(   137: 					    /* for linking.		    */   138: } SOURCEFILE;   139:    140: /*									    */e?   141: /* Source file record member access routines.				    */n   142: /*									    */A   143: 

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

u

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





I

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



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





 

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

*

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





	

gROUTINE source_tabsize. Go to: BmNext routine in file; Routines in this file.

_

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





*

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

s

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

n



d

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



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

R



t

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

R

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





6

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



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





*

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

T

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





n

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



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

N



0

gROUTINE source_rlength. Go to: nmNext routine in file; Routines in this file.

)

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





=

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

/

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

E



"

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

t

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





d

gROUTINE source_reflist. Go to: nmNext routine in file; Routines in this file.

o

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







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

1

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

R



M

nROUTINE set_source_byfilefile. Go to: mNext routine in file; Routines in this file.

o

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

*



*

lROUTINE inc_source_comments. Go to: mNext routine in file; Routines in this file.

*

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

*



 

nROUTINE inc_source_statements. Go to: mNext routine in file; Routines in this file.

s

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

6



 

iROUTINE inc_source_mixed. Go to: mNext routine in file; Routines in this file.



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





*

iROUTINE inc_source_empty. Go to: mNext routine in file; Routines in this file.

e

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





 

lROUTINE inc_source_routines. Go to: mNext routine in file; Routines in this file.

_

o?   164: #define inc_source_routines(src) ((src)->routines++)s
QEND inc_source_routines. Go to: Beginning of routine.

u





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

.

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





M

iROUTINE inc_source_calls. Go to: NmNext routine in file; Routines in this file.

n

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





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

_ROUTINE add_srcref. Go to: tmNext routine in file; Routines in this file.

/

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





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

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

0

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





l

cROUTINE def_source. Go to: omNext routine in file; Routines in this file.



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





o

aROUTINE def_root. Go to: rmNext routine in file; Routines in this file.

4

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





_

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

0

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

>



/

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

<

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

3



5

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

N

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





6

aROUTINE def_refs. Go to: imNext routine in file; Routines in this file.

R

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





n

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

(

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

H



d

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

f

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

*



 

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

<

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

H



8

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

u

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





m

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

n

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





e

eROUTINE set_def_root. Go to: NmNext routine in file; Routines in this file.

o

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





N

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

#

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

s



t

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

o

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

o



c

iROUTINE set_def_tree_req. Go to: HmNext routine in file; Routines in this file.



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





n

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

1

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





1

iROUTINE set_def_xreffile. Go to: *mNext routine in file; Routines in this file.

L

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





t

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



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





 

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

2

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

N



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

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

z

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

0



2

aROUTINE push_ref. Go to: imNext routine in file; Routines in this file.

0

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





o

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

t

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

f



d

_ROUTINE add_caller. Go to: >mNext routine in file; Routines in this file.

.

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





.

aROUTINE find_ref. Go to: NmNext routine in file; Routines in this file.

l

FEND find_ref. Go to: Beginning of routine.





o

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

e

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

<



E

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

E

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

A



e

kROUTINE isalready_expanded. Go to: nmNext routine in file; Routines in this file.

(

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





E   245: V   246: /****************************************************************************/   247: /*									    */f:   248: /* Routine reference record object type.				    */   249: /*									    */oV   250: /****************************************************************************/   251: .   252: #define OBJ_NAME_REFERENCE	"REFERENCE"   253: )   254: typedef struct reference_record {09   255:     LIST_ENTRY_HDR			    /* List linkage.		    */i   256: 	    entry_hdr;
gROUTINE ref_definition. Go to: rmNext routine in file; Routines in this file.

<

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





o

aROUTINE ref_name. Go to: AmNext routine in file; Routines in this file.

f

;=   269: #define ref_name(ref) (def_name(ref_definition(ref)))o
FEND ref_name. Go to: Beginning of routine.





o

aROUTINE ref_line. Go to: TmNext routine in file; Routines in this file.

n

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





>

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

#

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





&

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

t

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





r   273:    274: /*									    */qA   275: /* Routine reference record management routines.			    */P   276: /*									    */d   277: 

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

e

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

=



O   279: V   280: /****************************************************************************/   281: /*									    */l+   282: /* Forward references.							    */n   283: /*									    */PV   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

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