1 /***************************************
4 C Cross Referencing & Documentation tool. Version 1.4.
6 Sets up the top level File structure.
7 ******************/ /******************
8 Written by Andrew M. Bishop
10 This file Copyright 1995,96,97 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 ***************************************/
16 /*+ To control the debugging in this file. +*/
27 /*+ This contains the File that is currently being documented to allow the other functions access to it. +*/
30 /*++++++++++++++++++++++++++++++++++++++
31 Creates a new File structure.
33 File NewFile Returns the new file structure.
35 char* name The name of the file.
36 ++++++++++++++++++++++++++++++++++++++*/
38 File
NewFile(char* name
)
40 File file
=(File
)Calloc(1,sizeof(struct _File
));
42 file
->name
=MallocString(name
);
43 file
->inc_in
=NewStringList();
44 file
->f_refs
=NewStringList2();
45 file
->v_refs
=NewStringList2();
51 /*++++++++++++++++++++++++++++++++++++++
52 Called when a file comment has been seen. Only the first of multiple comments in a file are used.
54 char* comment The comment for the file.
55 ++++++++++++++++++++++++++++++++++++++*/
57 void SeenFileComment(char* comment
)
60 CurFile
->comment
=MallocString(comment
);
64 /*++++++++++++++++++++++++++++++++++++++
65 Deletes a file structure.
67 File file The file structure to be deleted.
69 This is required to go through each of the elements in the File structure and delete each of them in turn.
70 ++++++++++++++++++++++++++++++++++++++*/
72 void DeleteFile(File file
)
74 if(file
->comment
) Free(file
->comment
);
75 if(file
->name
) Free(file
->name
);
77 if(file
->inc_in
) DeleteStringList(file
->inc_in
);
78 if(file
->f_refs
) DeleteStringList2(file
->f_refs
);
79 if(file
->v_refs
) DeleteStringList2(file
->v_refs
);
83 Include p
=file
->includes
;
94 Define p
=file
->defines
;
105 Typedef p
=file
->typedefs
;
108 DeleteTypedefType(p
);
116 Variable p
=file
->variables
;
119 DeleteVariableType(p
);
127 Function p
=file
->functions
;
130 DeleteFunctionType(p
);