/[ascend]/trunk/base/generic/compiler/library.h
ViewVC logotype

Contents of /trunk/base/generic/compiler/library.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (show annotations) (download) (as text)
Tue Aug 2 11:20:09 2005 UTC (14 years, 4 months ago) by jds
File MIME type: text/x-chdr
File size: 8510 byte(s)
Manual rework of doxygen comments in all headers.
- Added @file comment to all headers.
- Added parameter names to all function declarations in headers.
- Corrected comment referencing where necessary.
- Split some comments which documented blocks of declarations.
- Converted notes about required work into @todo comments so doxygen can generate a todo list.
Minor bug fixes.
1 /*
2 * Type Definition Library
3 * by Tom Epperly
4 * Created: 1/12/90
5 * Version: $Revision: 1.17 $
6 * Version control file: $RCSfile: library.h,v $
7 * Date last modified: $Date: 1998/04/16 00:43:24 $
8 * Last modified by: $Author: ballan $
9 *
10 * This file is part of the Ascend Language Interpreter.
11 *
12 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
13 *
14 * The Ascend Language Interpreter is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * The Ascend Language Interpreter is distributed in hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with the program; if not, write to the Free Software Foundation, Inc., 675
26 * Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING.
27 */
28
29 /** @file
30 * Type Definition Library.
31 *
32 * The type library will only maintain one definition for a given type
33 * name. The library will complain if you try to add two types with the
34 * same name unless it happens when reloading a module.
35 * <pre>
36 * When #including library.h, make sure these files are #included first:
37 * #include "utilities/ascConfig.h"
38 * </pre>
39 */
40
41 #ifndef __LIBRARY_H_SEEN__
42 #define __LIBRARY_H_SEEN__
43
44 /** For use in constructing hierarchies. */
45 struct HierarchyNode {
46 struct TypeDescription *desc; /**< The type at this node. */
47 struct gl_list_t *descendents; /**< The list of refinements of desc. */
48 };
49
50 extern void InitializeLibrary(void);
51 /**< Initialize the library. */
52
53 extern struct TypeDescription *FindType(symchar *name);
54 /**<
55 * <!-- struct TypeDescription *FindType(name) -->
56 * <!-- const char *name; -->
57 * Find the type description associated with name. Returns NULL if unable
58 * to locate the type. Handles NULL input gracefully.
59 */
60
61 extern struct TypeDescription *FindRelationType(void);
62 /**<
63 * <!-- struct TypeDescription *FindRelationType() -->
64 * Find the type description associated with real relations.
65 * Returns NULL if never defined, which means someone forgot to
66 * load a system.lib equivalent.
67 */
68
69 extern struct TypeDescription *FindLogRelType(void);
70 /**<
71 * <!-- struct TypeDescription *FindLogRelnType() -->
72 * Find the type description associated with logical relations.
73 * Returns NULL if never defined, which means someone forgot to
74 * load a system.lib equivalent.
75 */
76
77 extern struct TypeDescription *FindSetType(void);
78 /**<
79 * <!-- struct TypeDescription *FindWhenType() -->
80 * Find the type description associated with set statements.
81 * Returns NULL if never defined, which is an extreme error.
82 */
83
84 extern struct TypeDescription *FindDummyType(void);
85 /**<
86 * <!-- struct TypeDescription *FindDummyType() -->
87 * Find the type description associated with unselected statements.
88 * Returns NULL if never defined, which is an extreme error.
89 */
90
91 extern struct TypeDescription *FindWhenType(void);
92 /**<
93 * <!-- struct TypeDescription *FindWhenType() -->
94 * Find the type description associated with WHEN statements.
95 * Returns NULL if never defined, which is an extreme error.
96 */
97
98 extern struct TypeDescription *FindExternalType(void);
99 /**<
100 * <!-- struct TypeDescription *FindExternalType() -->
101 * Find the type description associated with external statements.
102 * Returns NULL if never defined, which is an extreme error.
103 */
104
105 extern int AddType(struct TypeDescription *desc);
106 /**<
107 * <!-- void AddType(desc) -->
108 * <!-- struct TypeDescription *desc; -->
109 * Add a type to the library.
110 * Returns 1 if kept the new type, 0 if already had it and kept old.
111 */
112
113 extern void DestroyLibrary(void);
114 /**< Clean up after library use. */
115
116 extern struct gl_list_t *FindFundamentalTypes(void);
117 /**<
118 * <!-- struct gl_list_t *FindFundamentalTypes -->
119 * Return a gl_list containing pointers to the fundamental types
120 */
121
122 extern struct gl_list_t *Asc_TypeByModule(CONST struct module_t *module);
123 /**<
124 * <!-- struct gl_list_t *Asc_TypeByModule(module); -->
125 * <!-- const struct module_t *module; -->
126 *
127 * <!-- Comments: -->
128 * Accepts a module and searches the main type library defined in
129 * library.c for the all types that were found in that module.
130 * Builds a list of the types found and returns it.
131 */
132
133 extern struct gl_list_t *TypesThatRefineMe (symchar *name);
134 /**<
135 * <!-- struct gl_list_t *TypesThatRefineMe(name); -->
136 * <!-- symchar *name; -->
137 * <!-- Comments : -->
138 * Accepts the name of a type and searches the main library defined in
139 * library.c for all the types that refine the given type. Builds a list
140 * of all the types found and returns it. This should be an expensive
141 * function and could be made more efficient for certain atomic types.
142 * The list return is the list of immediate refinements only, not
143 * all of the refinements in a chain such as a<-b<-c<-d. Given a, only
144 * b is returned.
145 */
146
147 extern struct gl_list_t *AllTypesThatRefineMe_Flat (symchar *name);
148 /**<
149 * <!-- struct gl_list_t *AllTypesThatRefineMe_Flat(name); -->
150 * <!-- symchar *name; -->
151 * <!-- Comments : -->
152 * Accepts the name of a type and searches the main library defined in
153 * library.c for all the types that refine the given type. Builds a list
154 * of all the types found and returns it. This is only slightly more
155 * expensive than TypesThatRefineMe.
156 * For efficiency atoms and models are handled differently.
157 * The list returned is the list of all refinements in a chain
158 * such as a<-b<-c<-d. if a is input, b,c,d are returned.
159 */
160
161 extern struct HierarchyNode *AllTypesThatRefineMe_Tree (symchar *name);
162 /**<
163 * <!-- struct HierarchyNode *AllTypesThatRefineMe_Tree(name); -->
164 * <!-- const char *name; -->
165 * <!-- Comments : -->
166 * Accepts the name of a type and searches the main library defined in
167 * library.c for all the types that refine the given type. Builds a tree
168 * of HierarchyNodes of all the types found and returns it. This is somewhat
169 * pricey in terms of the number of pointer comparisons.
170 * For efficiency atoms and models are handled separately.
171 * The first node returned is the node of the type given. If it is null,
172 * the type given was not found.
173 */
174
175 extern void DestroyHierarchyNode(struct HierarchyNode *heir);
176 /**<
177 * <!-- struct HierarchyNode *hier; -->
178 * <!-- Comments: -->
179 * Deallocates (recursively) all the memory associated with a HierarchyNode.
180 */
181
182 extern int IsTypeRefined(CONST struct TypeDescription *desc);
183 /**<
184 * <!-- int IsTypeRefined(desc); -->
185 * <!-- CONST struct TypeDescription *desc; -->
186 * <!-- Comments : -->
187 * Searches the main library defined in library.c to see if the type desc,
188 * is refined by any other type, i.e., if the type is the root of a
189 * hierarchy. Returns 1 if TRUE, 0 otherwise.
190 */
191
192 extern struct gl_list_t *DefinitionList(void);
193 /**<
194 * Make a sorted list of all the definitions. In the case of there being
195 * two versions of a given type, the latest version is used. This doesn't
196 * include array type definitions.
197 * The user is responsible for destroying the list (but not its content).
198 */
199
200 extern unsigned int CheckFundamental(symchar *f);
201 /**<
202 * Return true if string is a fundamental type name.
203 * f must be from the symbol table.
204 */
205
206 #endif /* __LIBRARY_H_SEEN__ */
207

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22