File: datatype.h

package info (click to toggle)
cxref 1.6a-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,124 kB
  • ctags: 1,502
  • sloc: ansic: 18,209; yacc: 2,086; sh: 917; lex: 460; perl: 452; makefile: 418; lisp: 256; cpp: 188; python: 80
file content (215 lines) | stat: -rw-r--r-- 8,953 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/***************************************
  $Header: /home/amb/cxref/src/RCS/datatype.h 1.14 1999/01/24 16:53:48 amb Exp $

  C Cross Referencing & Documentation tool. Version 1.5.

  Definition of the different variables types that are used.
  ******************/ /******************
  Written by Andrew M. Bishop

  This file Copyright 1995,96,97,99 Andrew M. Bishop
  It may be distributed under the GNU Public License, version 2, or
  any higher version.  See section COPYING of the GNU Public license
  for conditions under which this file may be redistributed.
  ***************************************/


#ifndef DATA_TYPE_H
#define DATA_TYPE_H     /*+ To stop multiple inclusions. +*/

/*+ A pointer type to file information. +*/
typedef struct _File *File;

/*+ A pointer type to #include information. +*/
typedef struct _Include *Include;

/*+ A pointer type to #define information. +*/
typedef struct _Define *Define;

/*+ A pointer type to typedef information. +*/
typedef struct _Typedef *Typedef;

/*+ A pointer type to variable information. +*/
typedef struct _Variable *Variable;

/*+ A pointer type to function information. +*/
typedef struct _Function *Function;

/*+ A pointer type to struct and union information. +*/
typedef struct _StructUnion *StructUnion;

/*+ A data structure to contain lists of strings, eg functions that are called. +*/
typedef struct _StringList
{
 int    n;                              /*+ The number of strings in the list. +*/
 char** s;                              /*+ The strings. +*/
}
*StringList;

/*+ A data structure to contain two lists of strings, eg arguments and comments. +*/
typedef struct _StringList2
{
 int    n;                              /*+ The number of strings in the list. +*/
 char** s1;                             /*+ The first set of strings. +*/
 char** s2;                             /*+ The second set of strings. +*/
}
*StringList2;


/*+ A data structure to contain a complete file worth of information. +*/
struct _File
{
 char* comment;                         /*+ The file comment. +*/

 char* name;                            /*+ The name of the file. +*/

 Include includes;                      /*+ A linked list of include files. +*/

 Define defines;                        /*+ A linked list of #defines. +*/

 Typedef typedefs;                      /*+ A linked list of type definitions. +*/

 Variable variables;                    /*+ A linked list of variable definitions. +*/

 Function functions;                    /*+ A linked list of function prototypes. +*/

 StringList  inc_in;                    /*+ The files that this file is included in. +*/

 StringList2 f_refs;                    /*+ The functions that are referenced. +*/
 StringList2 v_refs;                    /*+ The variables that are referenced. +*/
};

/*+ A data structure to contain information about a #include. +*/
struct _Include
{
 char* comment;                         /*+ The comment for the include file. +*/

 char* name;                            /*+ The name of the included file. +*/

 int scope;                             /*+ The type of file, LOCAL or GLOBAL. +*/

 Include includes;                      /*+ The files that are include by this file. +*/

 Include next;                          /*+ A pointer to the next item. +*/
};

/*+ A data structure to contain information about a #define. +*/
struct _Define
{
 char* comment;                         /*+ The comment for the #define. +*/

 char* name;                            /*+ The name that is defined. +*/
 char* value;                           /*+ The value that is defined (if simple). +*/

 StringList2 args;                      /*+ The arguments to the #define function. +*/

 int lineno;                            /*+ The line number that this definition appears on. +*/

 Define next;                           /*+ A pointer to the next item. +*/
};

/*+ A data structure to contain the information for a typedef. +*/
struct _Typedef
{
 char* comment;                         /*+ The comment for the type definition. +*/

 char* name;                            /*+ The name of the defined type. +*/

 char* type;                            /*+ The type of the definition. +*/
 StructUnion sutype;                    /*+ The type of the definition if it is a locally declared struct / union. +*/
 Typedef typexref;                      /*+ The type of the definition if it is not locally declared or a repeat definition. +*/

 int lineno;                            /*+ The line number that this type definition appears on. +*/

 Typedef next;                          /*+ A pointer to the next item. +*/
};

/*+ A data structure to contain the information for a variable. +*/
struct _Variable
{
 char* comment;                         /*+ The comment for the variable. +*/

 char* name;                            /*+ The name of the variable. +*/

 char* type;                            /*+ The type of the variable. +*/

 int scope;                             /*+ The scope of the variable, STATIC, GLOBAL or EXTERNAL +*/

 char* defined;                         /*+ The name of the file that the variable is defined in as global if extern here. +*/

 char* incfrom;                         /*+ The name of the file that the variable is included from if any. +*/

 StringList2 visible;                   /*+ The names of the files that the variable is visible in. +*/
 StringList2 used;                      /*+ The names of the files that the variable is used in. +*/

 int lineno;                            /*+ The line number that this variable definition appears on. +*/

 Variable next;                         /*+ A pointer to the next item. +*/
};

/*+ A data structure to contain information for a function definition. +*/
struct _Function
{
 char* comment;                         /*+ The comment for the function. +*/

 char* name;                            /*+ The name of the function. +*/

 char* type;                            /*+ The return type of the function. +*/
 char* cret;                            /*+ A comment for the returned value. +*/

 char* protofile;                       /*+ The name of the file where the function is prototyped +*/

 char* incfrom;                         /*+ The name of the file that the function is included from if any. +*/

 StringList2 args;                      /*+ The arguments to the function. +*/

 int scope;                             /*+ The scope of the function, LOCAL or GLOBAL. +*/

 StringList  protos;                    /*+ The functions that are prototyped within this function. +*/

 StringList2 calls;                     /*+ The functions that are called from this function. +*/
 StringList2 called;                    /*+ The names of the functions that call this one. +*/
 StringList2 used;                      /*+ The places that the function is used, (references not direct calls). +*/

 StringList2 v_refs;                    /*+ The variables that are referenced from this function. +*/
 StringList2 f_refs;                    /*+ The functions that are referenced from this function. +*/

 int lineno;                            /*+ The line number that this function definition appears on. +*/

 Function next;                         /*+ A pointer to the next item. +*/
};

/*+ A data structure to contain a structure definition to allow structures to be matched to their typedefs (if any). +*/
struct _StructUnion
{
 char* comment;                         /*+ The comment for the struct or union or simple component. +*/

 char* name;                            /*+ The name of the struct or union or simple component. +*/

 int n_comp;                            /*+ The number of sub-components (if none then it is simple). +*/
 StructUnion* comps;                    /*+ The sub-components. +*/
};


/*++++++++++++++++++++++++++++++++++++++
  A function to add a pointer to the end of a linked list.

  dst The destination, where the pointer is to be added to.

  type The type of the pointer.

  src The pointer that is to be added to the end of the linked list.
  ++++++++++++++++++++++++++++++++++++++*/

#define AddToLinkedList(dst,type,src) {                               \
                                        if(dst)                       \
                                           {                          \
                                            type temp=dst;            \
                                            while(temp && temp->next) \
                                               temp=temp->next;       \
                                            temp->next=src;           \
                                           }                          \
                                        else                          \
                                           dst=src;                   \
                                      }
#endif /* DATA_TYPE_H */