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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 74 - (show annotations) (download) (as text)
Fri Dec 2 23:33:32 2005 UTC (18 years, 6 months ago) by jds
File MIME type: text/x-chdr
File size: 10068 byte(s)
Doxygen comment update for a few headers.
1 /*
2 * Ascend Type Definition Module
3 * by Tom Epperly
4 * Created: 1/11/90
5 * Version: $Revision: 1.15 $
6 * Version control file: $RCSfile: typedef.h,v $
7 * Date last modified: $Date: 1998/03/25 06:45:50 $
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
25 * along with the program; if not, write to the Free Software Foundation,
26 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27 * COPYING.
28 */
29
30 /** @file
31 * Ascend Type Definition Module.
32 * This module provides functions for creating new types.
33 * <pre>
34 * When #including typedef.h, make sure these files are #included first:
35 * #include "utilities/ascConfig.h"
36 * #include "compiler/fractions.h"
37 * #include "compiler/instance_enum.h"
38 * #include "compiler/compiler.h"
39 * #include "compiler/module.h"
40 * #include "compiler/list.h"
41 * #include "compiler/slist.h"
42 * #include "compiler/dimen.h"
43 * #include "compiler/child.h"
44 * #include "compiler/type_desc.h"
45 * </pre>
46 */
47
48 #ifndef typedef_h_seen__
49 #define typedef_h_seen__
50
51 extern void DestroyTypedefRecycle(void);
52 /**<
53 * Clears recycled memory.
54 * To work efficiently the typedef module recycles certain pieces
55 * of memory internally. This function may be called any time (from
56 * outside this file) to clear out this recycled memory. The only
57 * time it makes _sense_ to do so is after deleting all types in the
58 * library or when shutting down the system, but it is safe regardless.
59 */
60
61 extern struct TypeDescription
62 *CreateModelTypeDef(symchar *name, /* model name */
63 symchar *refines, /* refines name*/
64 struct module_t *mod,
65 int univ, /* universal ? */
66 struct StatementList *sl, /* declarative statements*/
67 struct gl_list_t *pl, /* initialization procs */
68 struct StatementList *psl, /* parameter statements */
69 struct StatementList *rsl, /* parameter reductions */
70 struct StatementList *wsl, /* parameter wheres */
71 unsigned int err);
72 /**<
73 * Creates a model type definition.
74 *
75 * Note sl, psl and rsl have restrictions on the statements allowed:
76 * - sl cannot contain WILL_BEs
77 * - psl cannot contain other than WILL_BEs/IS_As
78 * - rsl cannot contain other than constant assignments
79 * - wsl cannot contain other than WILL_BE_THE_SAMEs
80 *
81 * Note that, per ascParse.y, this function destroys several of its
82 * args if it is going to return NULL. (OTHERWISE the args become
83 * parts of the returned object). These destroyed args are:
84 * sl, pl, psl, rsl, wsl.
85 *
86 * @param name Name of the type to define.
87 * @param refines Name of the type it refines or NULL.
88 * @param mod Module where the type is defined.
89 * @param univ FALSE non-universal, TRUE universal type.
90 * @param sl Declarative statements.
91 * @param pl List of procedures or NULL.
92 * @param psl Declarative parameter statements.
93 * @param rsl Parameter reductions.
94 * @param wsl Conditions on WILL_BE parameter structure.
95 * @param err If !=0, abandon input.
96 * @return A pointer to the new TypeDescription structure.
97 */
98
99 extern struct TypeDescription
100 *CreateConstantTypeDef(symchar *name, /* constant name */
101 symchar *refines, /* refines name*/
102 struct module_t *mod, /* module */
103 int univ, /* universal ? */
104 int defaulted, /* defaulted ? */
105 double rval, /* default real value */
106 long ival, /* default integer/boolean value */
107 symchar *sval, /* default symbol value */
108 CONST dim_type *dim, /* default dimensions */
109 unsigned int err);
110 /**<
111 * Creates a refinement of refines. refines cannot be NULL.
112 * If refines is already defaulted, defaulted must be FALSE.
113 * Only the value (among rval,ival,sval) that matches refines is used.
114 * An appropriate dim should be supplied for all types.
115 *
116 * @param name Name of the type.
117 * @param refines Name of the type it refines.
118 * @param mod Module where the type is defined.
119 * @param univ FALSE non-universal, TRUE universal type.
120 * @param defaulted FALSE no default assigned, TRUE default.
121 * @param rval Default value for reals only.
122 * @param ival Default value for integers/booleans.
123 * @param sval Default for symbols.
124 * @param dim Dimensions of default real value.
125 * @param err If !=0, abandon input.
126 * @return A pointer to the new TypeDescription structure.
127 */
128
129 extern struct TypeDescription
130 *CreateAtomTypeDef(symchar *name, /* atom name */
131 symchar *refines, /* refines name*/
132 enum type_kind t,
133 struct module_t *mod, /* module */
134 int univ, /* universal ? */
135 struct StatementList *sl, /* declarative statements */
136 struct gl_list_t *pl, /* initialization procedures*/
137 int defaulted,
138 double val, /* default value */
139 CONST dim_type *dim, /* default dimensions */
140 long ival, /* default int/bool */
141 symchar *sval, /* default sym*/
142 unsigned int err);
143 /**<
144 * Creates an atom type definition.
145 * Note: val,ival,sval are digested according to the type_kind.
146 * Those which are irrelevant are ignored.<br><br>
147 *
148 * Note that, per ascParse.y, this function destroys several of its
149 * args if it is going to return NULL. (OTHERWISE the args become
150 * parts of the returned object). These destroyed args are:
151 * sl, pl.<br><br>
152 *
153 * We should very much like to require that pl be NULL.
154 *
155 * @param name Name of the type.
156 * @param refines Name of the type it refines OR NULL.
157 * @param t Ignored when refines!=NULL.
158 * @param mod Module where the type is defined.
159 * @param univ; FALSE non-universal, TRUE universal type.
160 * @param sl List of declarative statements.
161 * @param pl List of initialization procedures OR NULL.
162 * @param defaulted FALSE no default assigned, TRUE default.
163 * @param val Default value for reals only.
164 * @param dim Dimensions of default value.
165 * @param ival Default integer or boolean.
166 * @param sval Default symbol.
167 * @param err If !=0 --> abandon input.
168 * @return A pointer to the new TypeDescription structure.
169 */
170
171 extern struct TypeDescription
172 *CreateRelationTypeDef(struct module_t *mod,
173 symchar *name,
174 struct StatementList *sl,
175 struct gl_list_t *pl);
176 /**<
177 * Creates a relation type definition.
178 *
179 * @param mod The module the type is defined in.
180 * @param name The name to assign to the relation type.
181 * @param sl The list of declarative statements.
182 * @param pl The list of initialization procedures OR NULL.
183 * @return A pointer to the new TypeDescription structure.
184 */
185
186 extern struct TypeDescription
187 *CreateLogRelTypeDef(struct module_t *mod,
188 symchar *name,
189 struct StatementList *sl,
190 struct gl_list_t *pl);
191 /**<
192 * Creates a logical relation type definition.
193 *
194 * @param mod The module the type is defined in.
195 * @param name The name to assign to the logical relation type.
196 * @param sl The list of declarative statements.
197 * @param pl The list of initialization procedures OR NULL.
198 * @return A pointer to the new TypeDescription structure.
199 */
200
201 extern struct TypeDescription
202 *CreatePatchTypeDef(symchar *patch,
203 symchar *original,
204 symchar *orig_mod,
205 struct module_t *mod,
206 struct StatementList *sl,
207 struct gl_list_t *pl,
208 unsigned int err);
209 /**<
210 * Creates a patch type definition.
211 * Note that, per ascParse.y, this function destroys several of its
212 * args if it is going to return NULL. (OTHERWISE the args become
213 * parts of the returned object). These destroyed args are: sl, pl.
214 *
215 * @param patch Name of the patch.
216 * @param original Name of the original type being patched.
217 * @param orig_mod Name of module for the orig type or NULL.
218 * @param mod The module it is defined in.
219 * @param sl The list of declarative statements OR NULL.
220 * @param pl The list of initialization procedures OR NULL.
221 * @param err If !=0 abandon input.
222 * @return A pointer to the new TypeDescription structure.
223 */
224
225 extern void DefineFundamentalTypes(void);
226 /**<
227 * Define the fundamental and constant basetypes used in ascend.
228 * They will be named following the defines in type_desc.h.
229 *
230 * @bug compiler/typedef:DefineFundamentalTypes() doesn't specify the
231 * name "relation". Doing so is problematic wrt instantiate.c.
232 */
233
234 #endif /* typedef_h_seen__ */
235

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