1 /***************************************
2   $Header: /home/amb/CVS/cxref/src/cxref.h,v 1.30 1999-11-16 18:58:13 amb Exp $
3 
4   C Cross Referencing & Documentation tool. Version 1.5c.
5 
6   Prototypes for general functions.
7   ******************/ /******************
8   Written by Andrew M. Bishop
9 
10   This file Copyright 1995,96,97,98,99 Andrew M. Bishop
11   It may be distributed under the GNU Public License, version 2, or
12   any higher version.  See section COPYING of the GNU Public license
13   for conditions under which this file may be redistributed.
14   ***************************************/
15 
16 
17 #ifndef CXREF_H
18 #define CXREF_H  /*+ To stop multiple inclusions. +*/
19 
20 #include "datatype.h"
21 
22 /* Definitions for variable / function / file types */
23 
24 #define LOCAL     1      /*+ Signifies a LOCAL function / variable / include file. +*/
25 #define GLOBAL    2      /*+ Signifies a GLOBAL fuction / variable / include file. +*/
26 #define EXTERNAL  4      /*+ Signifies an EXTERNAL variable. +*/
27 #define EXTERN_H  8      /*+ Signifies an EXTERNAL variable seen in a header file. +*/
28 #define EXTERN_F 16      /*+ Signifies an EXTERNAL variable seen in a function file. +*/
29 #define INLINED  32      /*+ Signifies an INLINED function. +*/
30 
31 /* Definitions for -xref options */
32 
33 #define XREF_FILE   1    /*+ Signifies that file cross references are required. +*/
34 #define XREF_FUNC   2    /*+ Signifies that function cross references are required. +*/
35 #define XREF_VAR    4    /*+ Signifies that variable cross references are required. +*/
36 #define XREF_TYPE   8    /*+ Signifies that type definition cross references are required. +*/
37 #define XREF_ALL   15    /*+ Signifies that all the above cross references are required. +*/
38 
39 /* Definitions for -warn options */
40 
41 #define WARN_COMMENT  1  /*+ Signifies that warnings for commetns are required. +*/
42 #define WARN_XREF     2  /*+ Signifies that warnings for cross references are required. +*/
43 #define WARN_ALL      3  /*+ Signifies that all of the above warnings are required. +*/
44 
45 /* Definitions for -index options */
46 
47 #define INDEX_FILE   1   /*+ Signifies that an index of files is needed. +*/
48 #define INDEX_FUNC   2   /*+ Signifies that an index of global functions is needed. +*/
49 #define INDEX_VAR    3   /*+ Signifies that an index of global variables is needed. +*/
50 #define INDEX_TYPE   4   /*+ Signifies that an index of type definitions is needed. +*/
51 #define INDEX_ALL   15   /*+ Signifies that a complete index of all of the above is needed. +*/
52 
53 /* in cxref.c */
54 
55 char *CanonicaliseName(char *name);
56 
57 /* In parse.l */
58 
59 void ResetLexer(void);
60 
61 /* In parse.y */
62 
63 void ResetParser(void);
64 
65 /* in file.c */
66 
67 File NewFile(char* name);
68 void DeleteFile(File file);
69 
70 void SeenFileComment(char* comment);
71 
72 /* in comment.c */
73 
74 void SeenComment(char* c,int flag);
75 char* GetCurrentComment(void);
76 void SetCurrentComment(char* comment);
77 char* SplitComment(char** original,char* name);
78 void DeleteComment(void);
79 
80 /* in preproc.c */
81 
82 void SeenInclude(char *name);
83 void SeenIncludeComment(void);
84 char *SeenFileChange(char *name,int flag);
85 
86 void SeenDefine(char* name);
87 void SeenDefineComment(void);
88 void SeenDefineValue(char* value);
89 void SeenDefineFunctionArg(char* name);
90 void SeenDefineFuncArgComment(void);
91 
92 void ResetPreProcAnalyser(void);
93 void DeleteIncludeType(Include inc);
94 void DeleteDefineType(Define inc);
95 
96 /* in type.c */
97 
98 void SeenTypedefName(char* name,int what_type);
99 int IsATypeName(char* name);
100 void SeenTypedef(char* name,char* type);
101 
102 void SeenStructUnionStart(char* name);
103 void SeenStructUnionComp(char* name,int depth);
104 void SeenStructUnionEnd(void);
105 
106 void ResetTypeAnalyser(void);
107 void DeleteTypedefType(Typedef type);
108 
109 /* in var.c */
110 
111 void SeenVariableDefinition(char* name,char* type,int scope);
112 
113 void UpScope(void);
114 void DownScope(void);
115 void SeenScopeVariable(char* name);
116 int IsAScopeVariable(char* name);
117 
118 void ResetVariableAnalyser(void);
119 void DeleteVariableType(Variable var);
120 
121 /* in func.c */
122 
123 void SeenFunctionProto(char* name,int in_a_function);
124 
125 void SeenFunctionDeclaration(char* name,int scope);
126 void SeenFunctionDefinition(char* type);
127 void SeenFunctionArg(char* name,char* type);
128 
129 void SeenFunctionCall(char* name);
130 void CheckFunctionVariableRef(char* name,int in_a_function);
131 
132 int SeenFuncIntComment(char* comment);
133 
134 void ResetFunctionAnalyser(void);
135 void DeleteFunctionType(Function func);
136 
137 /* In slist.c */
138 
139 StringList NewStringList(void);
140 void AddToStringList(StringList sl,char* str,int alphalist,int uniqlist);
141 void DeleteStringList(StringList sl);
142 
143 StringList2 NewStringList2(void);
144 void AddToStringList2(StringList2 sl,char* str1,char* str2,int alphalist,int uniqlist);
145 void DeleteStringList2(StringList2 sl);
146 
147 /* In xref.c */
148 
149 void CrossReference(File file,int outputs);
150 void CreateAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
151 
152 void CrossReferenceDelete(char *name);
153 
154 /* In warn-raw.c */
155 
156 void WriteWarnRawFile(File file);
157 void WriteWarnRawAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
158 
159 int CopyOrSkip(char *string,char *type,int *copy,int *skip);
160 
161 /* In latex.c */
162 
163 void WriteLatexFile(File file);
164 void WriteLatexAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
165 
166 void WriteLatexFileDelete(char *name);
167 
168 /* In html.c */
169 
170 void WriteHTMLFile(File file);
171 void WriteHTMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
172 
173 void WriteHTMLFileDelete(char *name);
174 
175 /* In rtf.c */
176 
177 void WriteRTFFile(File file);
178 void WriteRTFAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
179 
180 void WriteRTFFileDelete(char *name);
181 
182 /* In sgml.c */
183 
184 void WriteSGMLFile(File file);
185 void WriteSGMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types);
186 
187 void WriteSGMLFileDelete(char *name);
188 
189 
190 /* Not defined on Suns */
191 
192 #if defined(__sun__) && !defined(__svr4__)
193 #include <stdio.h>
194 
195 int fputs(const char *s, FILE *stream);
196 int fprintf(FILE*, const char*,...);
197 int pclose( FILE *stream);
198 int fscanf( FILE *stream, const char *format, ...);
199 int fclose(FILE*);
200 int rename(const char *oldpath, const char *newpath);
201 int printf(const char*,...);
202 int fwrite(const void*,unsigned int,unsigned int, FILE*);
203 int fread(void*,unsigned int,unsigned int, FILE*);
204 int isatty(int desc);
205 int fflush( FILE *stream);
206 #endif /* Suns */
207 
208 #endif /* CXREF_H */
209