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

Annotation of /trunk/base/generic/compiler/instance_types.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (hide annotations) (download) (as text)
Tue Aug 2 11:20:09 2005 UTC (20 years, 3 months ago) by jds
File MIME type: text/x-chdr
File size: 28451 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 jds 54 /*
2 aw0a 1 * Real Ascend Instance Types
3     * by Tom Epperly
4     * Version: $Revision: 1.29 $
5     * Version control file: $RCSfile: instance_types.h,v $
6     * Date last modified: $Date: 1998/02/05 16:36:22 $
7     * Last modified by: $Author: ballan $
8     *
9     * This file is part of the Ascend Language Interpreter.
10     *
11     * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
12     * Copyright (C) 1996 Benjamin Andrew Allan
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 jds 54 */
29    
30     #ifndef __INSTANCE_TYPES_H_SEEN__
31     #define __INSTANCE_TYPES_H_SEEN__
32    
33     /** @file
34     * Real Ascend Instance Types.
35     * <pre>
36     * When #including instance_types.h, make sure these files are #included first:
37     * #include "instance_enum.h"
38 aw0a 1 *
39     * Fields not to be accessed by any client program
40     * except by the read-only functions in headers.
41     * The write functions in atomvalue.h are also reasonable for
42     * clients to use.
43     * Clients should never have to include much beyond instance_enum.h.
44 jds 54 *
45 aw0a 1 * All of the following structures should be a multiple of *8*;
46     * being a multiple of 4 is not sufficient. Pad if necessary.
47 jds 54 * RealInstance
48 aw0a 1 * IntegerInstance
49     * BooleanInstance
50     * SymbolInstance
51     * SetInstance
52     * and in fact any new instances that will be atom children.
53     * Remember that these get *packed* in together and the order of
54     * packing is not predictable in any way. If each is a multiple
55     * of 8, then everybody will be properly aligned.
56     * *AtomInstance and *Rel*Instance also need to be 8 byte
57     * aligned so that we
58     * start children in an 8 byte.
59     *
60     * This has to hold for both 4 and 8 byte ptr/long machines.
61 jds 54 * </pre>
62 aw0a 1 */
63    
64     #if SIZEOF_VOID_P == 8
65     #define LONGCHILDREN 1
66     #else
67     #define LONGCHILDREN 0
68     #endif
69 ben.allan 33 /**< if LONGCHILDREN, then pointers are 8 bytes */
70 aw0a 1
71 jds 54 /* at present, I don't believe the following define is needed */
72     /* # if defined(_HPUX_SOURCE) || defined(_SGI_SOURCE) */
73     /* # define ALIGNSTUPID 1 */
74     /* # endif */
75     /* if ALIGNSTUPID, then 4 byte ptrs must fall on 8 byte boundaries */
76     /* any architecture with such a restrict should be summarily torched */
77 aw0a 1
78    
79 jds 54 /* FUNDAMENTAL INSTANCES */
80 aw0a 1
81 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 32/40 */
82 aw0a 1 struct RealInstance {
83 jds 54 enum inst_t t; /**< must always be first */
84     unsigned assigned; /**< the number of times it has been assigned */
85 aw0a 1 struct Instance *parent_offset;
86     CONST dim_type *dimen;
87     double value;
88 jds 54 unsigned depth; /**< the depth of the assignment */
89     int padding; /**< required for either type of pointer */
90 aw0a 1 };
91    
92 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 24/32 */
93 aw0a 1 struct IntegerInstance {
94 jds 54 enum inst_t t; /**< must always be first */
95     unsigned assigned; /**< the number of times it has been assigned */
96 aw0a 1 struct Instance *parent_offset;
97     long value;
98 jds 54 unsigned depth; /**< the depth of the last assignment */
99     int padding; /**< required for either type of pointer */
100 aw0a 1 };
101    
102 jds 54 /** size 24/24 */
103 aw0a 1 struct BooleanInstance {
104     enum inst_t t;
105 jds 54 unsigned assigned; /**< the number of times it has been assigned */
106 aw0a 1 struct Instance *parent_offset;
107 jds 54 unsigned value; /**< 0 false, 1 true */
108     unsigned depth; /**< the depth of the last assignment */
109 aw0a 1 #if (LONGCHILDREN == 0)
110     int padding;
111     #endif
112     };
113    
114 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 16/24 */
115 aw0a 1 struct SetInstance {
116     enum inst_t t;
117 jds 54 unsigned int_set; /**< 0 indicates string set,
118     1 indicates an integer set */
119 aw0a 1 struct Instance *parent_offset;
120 jds 54 struct set_t *list; /**< list of enumerated values, NULL
121     indicates that it has not been assigned
122     if HP_sUX 9/10 or SGI is stupid enough to misalign
123     this structure, we will have to pad it with an int
124     on both sides of *list */
125 aw0a 1 };
126    
127 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 16/24 */
128 aw0a 1 struct SymbolInstance {
129     enum inst_t t;
130 ben.allan 33 unsigned assigned; /**< the number of times it has been assigned */
131 aw0a 1 struct Instance *parent_offset;
132 jds 54 symchar *value; /**< NULL indicates unassigned */
133 aw0a 1 };
134    
135    
136 jds 54 /* TRUE ATOM INSTANCES */
137     /** the first one is a dummy of some importance. All the atomic
138 aw0a 1 * variable types should be conformable to this structure. It
139     * is not by itself a structure that should ever exist.
140     */
141     struct CommonAtomInstance {
142     enum inst_t t;
143     VOIDPTR interface_ptr;
144 jds 54 struct gl_list_t *parents; /**< link to parents */
145     struct Instance *alike_ptr; /**< circular linked list of clique members */
146     struct TypeDescription *desc; /**< list of children pointers */
147     unsigned long visited; /**< visited counter */
148     unsigned long tmp_num; /**< used when an instance tree is being copied*/
149     unsigned int anon_flags; /**< anonymous field to be manipulated */
150 aw0a 1 };
151    
152 jds 54 /**
153 aw0a 1 * The RealAtomInstance should be reimplemented with a number of
154     * supported attributes (bounds, nominal, several boolean flags)
155     * and then an explicit pointer to the child space since children
156     * are expected to be rare. Making this pointer explicit will allow
157     * the real atoms (of which there are a lot) to be pooled and save
158 jds 54 * a fair amount of memory on large problems.<br><br>
159     *
160     * aligns to 8 byte boundaries on 4 or 8 byte machines. size 56/96
161 aw0a 1 */
162     struct RealAtomInstance {
163     enum inst_t t;
164     VOIDPTR interface_ptr;
165 jds 54 struct gl_list_t *parents; /**< link to parents */
166     struct Instance *alike_ptr; /**< circular linked list of clique members */
167     struct TypeDescription *desc; /**< list of children pointers */
168     unsigned long visited; /**< visited counter */
169     unsigned long tmp_num; /**< used when an instance tree is being copied*/
170     unsigned int anon_flags; /**< anonymous field to be manipulated */
171     /* above should match with CommonAtomInstance */
172     /* atom value part */
173     double value; /**< value of real variable */
174     CONST dim_type *dimen; /**< dimensions */
175     struct gl_list_t *relations; /**< relations where this real appears */
176     unsigned int assigned; /**< the number of times it has been assigned */
177     unsigned int depth; /**< the depth of the last assignment */
178     /* An even number of child pointers are packed here, the last of which
179 aw0a 1 * may not be valid because the number of children may be odd.
180     * This extra should be eliminated for LONG pointer machines.
181     */
182 jds 54 /* After the child pointers comes the data space for the actual
183 aw0a 1 * children.
184     */
185     };
186    
187 jds 54 /** future work.
188     * needs parser and interpretter support. Not yet used.
189     * @todo Implement SolverAtomInstance.
190     */
191 aw0a 1 struct SolverAtomInstance {
192     enum inst_t t;
193     VOIDPTR interface_ptr;
194 jds 54 struct gl_list_t *parents; /**< link to parents */
195     struct Instance *alike_ptr; /**< circular linked list of clique members */
196     struct TypeDescription *desc; /**< list of slow children pointers, by name */
197     unsigned long visited; /**< visited counter */
198     unsigned long tmp_num; /**< used when an instance tree is being copied */
199     /* above should match with CommonAtomInstance */
200     /* atom value part */
201     struct gl_list_t *relations; /**< relations where this real appears */
202     double value; /**< value of variable
203     fast children, all sharing dimens */
204     double nominal; /**< value of variable scaling */
205     double lower; /**< value of variable lower bound */
206     double upper; /**< value of variable upper bound */
207     CONST dim_type *dimen; /**< dimensions */
208     struct Instance **carray; /**< array of pointers to slow children.
209     Keep slow children in pools by type.
210     This should be NULL most of the time. */
211     unsigned int flags; /**< boolean flags of the variable, both
212     internal and external. must be at least
213     32 bit int */
214     unsigned int depth; /**< the depth of the last assignment */
215     /*
216 aw0a 1 * An even number of child pointers are packed here, the last of which
217     * may not be real because the number of children may be odd.
218     * This extra should be eliminated for LONG pointer machines.
219     */
220 jds 54 /* After the child pointers comes the data space for the actual
221 aw0a 1 * children.
222     */
223     };
224 jds 54
225     /*
226 aw0a 1 * Bit field definition for boolean attributes. room to grow.
227     * Define all these fields so that a default value of (0,OFF,FALSE)
228     * is the appropriate setting for 'typical' uses of ASCEND.
229     */
230 jds 54 /* internal flags (compiler use) for solveratominstances: */
231     #define SOL_ASSIGNED 0x1 /**< atom value ever assigned */
232     /* external flags (user interface/solver use) for solveratominstances: */
233     #define SOL_FIXED 0x2 /**< variable fixed for solvers */
234     #define SOL_INACTIVELB 0x4 /**< lower bound to be ignored in solving */
235     #define SOL_INACTIVEUB 0x8 /**< upper bound to be ignored in solving */
236     #define SOL_ODESTATE 0x10 /**< variable state for ivp solver */
237     #define SOL_ODEOBSERVE 0x20 /**< variable recording for ivp */
238     #define SOL_ISZERO 0x40 /**< semicontinuous set 0 for sciconic */
239     #define SOL_INTEGER 0x80 /**< integer variable */
240     #define SOL_RELAXEDINT 0x100 /**< integer variable treat as relaxed */
241     #define SOL_INTERVAL 0x200 /**< interval real variable */
242     #define SOL_COMPLEX 0x400 /**< complex variable. lower -> imaginary part
243     upper -> magnitude bound. ASCEND -> pot */
244     #define SOL_DOMAIN 0x800 /**< continuous variable defines domain */
245     #define SOL_ODEINDEP 0x1000 /**< independent variable in ODE/BVP */
246     #define SOL_NODOF 0x2000 /**< user doesn't want to see var in DOF */
247     #define SOL_PARAMETRIC 0x4000 /**< whatever that means to a solver */
248     #define SOL_INTENSIVE 0x8000 /**< physics/che intensive property variable */
249     #define SOL_NONBASIC 0x10000 /**< in DOF of optimization problem
250     2,4,8-0000 reserved for future */
251     /* external flags (solver/interface tool use) for solveratominstances: */
252     #define SOL_TIGHTLB 0x100000 /**< value at or near lower */
253     #define SOL_TIGHTUB 0x200000 /**< value at or near upper */
254     #define SOL_NOELIG 0x400000 /**< variable not eligible to be fixed in DOF */
255     /* note that the above bit positions need to be settled on still. */
256 aw0a 1
257 jds 54 /** aligns to 8 on 4 and 8 byte compilers with compiler pad after t, depth */
258 aw0a 1 struct IntegerAtomInstance {
259     enum inst_t t;
260     VOIDPTR interface_ptr;
261 jds 54 struct gl_list_t *parents; /**< link to parents */
262 aw0a 1 struct Instance *alike_ptr;
263 jds 54 struct TypeDescription *desc; /**< usefull type description information */
264 aw0a 1 unsigned long visited;
265 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
266     unsigned int anon_flags; /**< anonymous field to be manipulated */
267     /* above should match with CommonAtomInstance */
268     /* atom value part */
269     unsigned int assigned; /**< the number of times it has been assigned */
270     struct gl_list_t *whens; /**< link to whens on which it appears */
271     unsigned int depth; /**< the depth of the last assignment */
272     long value; /**< integer value */
273     /*
274 aw0a 1 * An even number of child pointers are packed here, the last of which
275     * may not be real because the number of children may be odd.
276     * This extra should be eliminated for LONG pointer machines.
277     */
278 jds 54 /* After the child pointers comes the data space for the actual
279 aw0a 1 * children.
280     */
281     };
282    
283 jds 54 /** this structure aligns (with compiler generated pad after t and flags
284     * on 4 or 8 byte ptr machines. */
285 aw0a 1 struct BooleanAtomInstance {
286     enum inst_t t;
287     VOIDPTR interface_ptr;
288 jds 54 struct gl_list_t *parents; /**< link to parent instances */
289 aw0a 1 struct Instance *alike_ptr;
290 jds 54 struct TypeDescription *desc; /**< description of name,children, and size */
291 aw0a 1 unsigned long visited;
292 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
293     unsigned int anon_flags; /**< anonymous field to be manipulated */
294     /* above should match with CommonAtomInstance */
295     /* atom value part */
296 ben.allan 33 struct gl_list_t *logrelations; /**< logrelations where this boolean appears */
297     struct gl_list_t *whens; /**< whens where this boolean appears*/
298 jds 54 unsigned assigned; /**< the number of times it has been assigned */
299     unsigned depth; /**< the depth of the assignment */
300     unsigned value; /**< 0 false, 1 true */
301     int padding; /**< so that children have a square address */
302     /*
303 aw0a 1 * An even number of child pointers are packed here, the last of which
304     * may not be real because the number of children may be odd.
305     * This extra should be eliminated for LONG pointer machines.
306     */
307 jds 54 /* After the child pointers comes the data space for the actual
308 aw0a 1 * children.
309     */
310     };
311    
312 jds 54 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t */
313 aw0a 1 struct SetAtomInstance {
314 jds 54 enum inst_t t; /**< type */
315 aw0a 1 VOIDPTR interface_ptr;
316 jds 54 struct gl_list_t *parents; /**< link to parents instances */
317 aw0a 1 struct Instance *alike_ptr;
318 jds 54 struct TypeDescription *desc; /**< description of name,children, and size */
319 aw0a 1 unsigned long visited;
320 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied */
321     unsigned int anon_flags; /**< anonymous field to be manipulated */
322     /* above should match with CommonAtomInstance */
323     /* atom value part */
324     unsigned int_set; /**< 0 indicates string set,
325     1 indicates integer set */
326     struct set_t *list; /**< list of enumerated values NULL indicates
327     that is has not been assigned */
328     /*
329 aw0a 1 * An even number of child pointers are packed here, the last of which
330     * may not be real because the number of children may be odd.
331     * This extra should be eliminated for LONG pointer machines.
332     */
333 jds 54 /* After the child pointers comes the data space for the actual
334 aw0a 1 * children.
335     */
336     };
337    
338 jds 54 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t, flags */
339 aw0a 1 struct SymbolAtomInstance {
340 jds 54 enum inst_t t; /**< type */
341 aw0a 1 VOIDPTR interface_ptr;
342 jds 54 struct gl_list_t *parents; /**< link to parent instances */
343     struct Instance *alike_ptr; /**< ALIKE clique link */
344     struct TypeDescription *desc; /**< description of name, children, and size */
345 aw0a 1 unsigned long visited;
346 jds 54 unsigned long tmp_num; /**< used when an instance is being copied */
347     unsigned int anon_flags; /**< anonymous field to be manipulated */
348     /* above should match with CommonAtomInstance */
349     struct gl_list_t *whens; /**< link to whens on which it appears */
350     /* atom value part */
351     symchar *value; /**< NULL indicates unassigned */
352     /*
353 aw0a 1 * An even number of child pointers are packed here, the last of which
354     * may not be real because the number of children may be odd.
355     * This extra should be eliminated for LONG pointer machines.
356     */
357 jds 54 /* After the child pointers comes the data space for the actual
358 aw0a 1 * children.
359     */
360     };
361    
362 jds 54 /* CONSTANT INSTANCES */
363     /** The first one is a dummy of some importance. All the Constant
364 aw0a 1 * types should be conformable to this structure. It
365     * is not by itself a structure that should ever exist.
366     */
367     struct CommonConstantInstance {
368     enum inst_t t;
369     unsigned int vflag;
370 jds 54 unsigned long visited; /**< visited counter */
371     unsigned long tmp_num; /**< used when an instance tree is being copied*/
372 aw0a 1 VOIDPTR interface_ptr;
373 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated
374     vflag is 32 bits with particular meanings: */
375     #define ci_ASSIGNED 0x1 /**< instance assigned yet? */
376     #define ci_BVAL 0x2 /**< boolean const instance value, reserved */
377     /* other binary flags constants need to be added here. */
378 aw0a 1 };
379    
380 jds 54 /** @todo RealConstantInstance should probably be pooled, but isn't yet */
381 aw0a 1 struct RealConstantInstance {
382     enum inst_t t;
383 jds 54 unsigned vflag; /**< assigned? */
384     unsigned long visited; /**< visited counter */
385     unsigned long tmp_num; /**< used when an instance tree is being copied*/
386 aw0a 1 VOIDPTR interface_ptr;
387 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
388     /* above should match with CommonConstantInstance */
389 aw0a 1 double value;
390 jds 54 struct gl_list_t *parents; /**< link to parents */
391     struct Instance *alike_ptr; /**< circular linked list of clique members?*/
392     struct TypeDescription *desc; /**< description of name, size */
393 aw0a 1 CONST dim_type *dimen;
394     };
395    
396     struct IntegerConstantInstance {
397     enum inst_t t;
398 jds 54 unsigned vflag; /**< assigned? */
399     unsigned long visited; /**< visited counter */
400     unsigned long tmp_num; /**< used when an instance tree is being copied*/
401 aw0a 1 VOIDPTR interface_ptr;
402 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
403     /* above should match with CommonConstantInstance */
404 aw0a 1 long value;
405 jds 54 struct gl_list_t *parents; /**< link to parents */
406 ben.allan 33 struct gl_list_t *whens; /**< whens where this integer appears*/
407 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
408     struct TypeDescription *desc; /**< description of name, size */
409 aw0a 1 };
410    
411     struct BooleanConstantInstance {
412     enum inst_t t;
413 jds 54 unsigned vflag; /**< assigned? */
414     unsigned long visited; /**< visited counter */
415     unsigned long tmp_num; /**< used when an instance tree is being copied*/
416 aw0a 1 VOIDPTR interface_ptr;
417 jds 54 /* above should match with CommonConstantInstance */
418     unsigned int anon_flags; /**< anonymous field to be manipulated */
419     struct gl_list_t *parents; /**< link to parents */
420 ben.allan 33 struct gl_list_t *whens; /**< whens where this boolean appears*/
421 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
422     struct TypeDescription *desc; /**< description of name, size */
423 aw0a 1 };
424    
425     struct SymbolConstantInstance {
426     enum inst_t t;
427 jds 54 unsigned vflag; /**< assigned */
428     unsigned long visited; /**< visited counter */
429     unsigned long tmp_num; /**< used when an instance tree is being copied*/
430 aw0a 1 VOIDPTR interface_ptr;
431 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
432     /* above should match with CommonConstantInstance */
433     struct gl_list_t *parents; /**< link to parents */
434 ben.allan 33 struct gl_list_t *whens; /**< whens where this symbol appears*/
435 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
436     struct TypeDescription *desc; /**< description of name, size */
437 aw0a 1 symchar *value;
438     };
439    
440 jds 54 /** aligns on 4 or 8 byte ptr machines. size 48/88
441     *
442     * @todo RelationInstance should probably be pooled, as RealAtomInstance,
443     * but isn't yet for the same reasons.
444 aw0a 1 */
445     struct RelationInstance {
446     enum inst_t t;
447 jds 54 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
448 aw0a 1 VOIDPTR interface_ptr;
449 jds 54 struct Instance *parent[2]; /**< relations can have only two parents and
450     normally they only have one. They have
451     two only during an ARE_THE_SAME */
452     struct TypeDescription *desc; /**< holds the child list stuff */
453 aw0a 1 unsigned long visited;
454 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
455     unsigned int anon_flags; /**< anonymous field to be manipulated */
456     enum Expr_enum type; /**< what kind of the 5 possible types of reln
457     type should be down in union RelationUnion*/
458     struct relation *ptr; /**< pointer to an instance relation */
459     struct gl_list_t *whens; /**< link to whens on which the rel appears */
460     struct gl_list_t *logrels; /**< link to satified's on which rel appears */
461     /* So child insts start packing on 8byte address after child ptrs, of
462 aw0a 1 * which there are (currently, 2/97) always an even number.
463     */
464 jds 54 /* Not required anymore:
465 aw0a 1 *
466     * #if (LONGCHILDREN == 0)
467     * int padding;
468     * #endif
469     *
470     * Not valid anymore:
471     *
472     * An even number of child pointers are packed here, the last of which
473     * may not be real because the number of children may be odd.
474     * This extra should be eliminated for LONG pointer machines.
475     */
476    
477 jds 54 /* After the child pointers comes the data space for the actual
478 aw0a 1 * children.
479     */
480     };
481    
482 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 48/88 */
483 aw0a 1 struct LogRelInstance {
484     enum inst_t t;
485 jds 54 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
486 aw0a 1 VOIDPTR interface_ptr;
487 jds 54 struct Instance *parent[2]; /**< log relations can have only two parents
488     and normally they only have one.They have
489     two only during an ARE_THE_SAME */
490     struct TypeDescription *desc; /**< holds the child list stuff */
491 aw0a 1 unsigned long visited;
492 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
493     struct logrelation *ptr; /**< pointer to an instance logical relation */
494     struct gl_list_t *whens; /**< link to whens on which the logrel appears */
495     struct gl_list_t *logrels; /**< link to satified's on which lrel appears */
496     unsigned int anon_flags; /**< anonymous field to be manipulated */
497     int padding; /**< so child insts start packing on 8byte
498     address after child ptrs */
499     /*
500 aw0a 1 * All logrelations are the same type/size, because we require
501     * exactly 1 refinement of the base definition.
502     */
503 jds 54 /* After the child pointers comes the data space for the actual
504 aw0a 1 * children. This space must start on an 8 byte address.
505     */
506     };
507    
508 jds 54 /** Never, ever, allocate either one of these types. it's a dummy for the
509 aw0a 1 * instantiator.
510     */
511     struct PendInstance {
512     enum inst_t t;
513     VOIDPTR p;
514     };
515    
516    
517 jds 54 /* COMPOUND INSTANCES */
518     /* Note: All the compound instance structs, except ArrayChild,
519 aw0a 1 * and Automatic should have
520     enum inst_t t;
521     VOIDPTR pending_entry;
522     * as the first two lines to match PendInstance above.
523     * Relations of any type are NOT compound, other errors in
524     * this file not withstanding.
525     */
526 jds 54 /** this structure doesn't have to align on 4 byte ptr machines. size 48/88 */
527 aw0a 1 struct ModelInstance {
528     enum inst_t t;
529 jds 54 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
530 aw0a 1 VOIDPTR interface_ptr;
531 jds 54 struct gl_list_t *parents; /**< link to parent instances */
532     struct gl_list_t *whens; /**< link to whens on which the model appears */
533 aw0a 1 struct TypeDescription *desc;
534     struct Instance *alike_ptr;
535 jds 54 struct BitList *executed; /**< bit list to keep track of which
536     statements have been executed */
537 aw0a 1 unsigned long visited;
538 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
539     unsigned int anon_flags; /**< anonymous field to be manipulated */
540 aw0a 1 #if (LONGCHILDREN == 1)
541 jds 54 int padding; /**< so ptrs start packing on 8byte address */
542 aw0a 1 #endif
543 jds 54 /* The child pointers of model instances are packed here, but each is
544 aw0a 1 * different and there may not even be children. They are not
545     * accessible through the struct, but only through InstanceChild.
546     */
547     };
548    
549 jds 54 /** This struct not in use anywhere yet, pending more semantics */
550 aw0a 1 struct AutomaticInstance {
551     enum inst_t t;
552 jds 54 /* this object never pending since it has no statements */
553 aw0a 1 VOIDPTR interface_ptr;
554 ben.allan 33 struct Instance *sim_parent; /**< exactly one of these */
555     struct TypeDescription *desc; /**< UNIVERSAL and made at startup */
556 aw0a 1 unsigned long visited;
557 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
558     unsigned int anon_flags; /**< anonymous field to be manipulated */
559 aw0a 1
560 jds 54 struct gl_list_t *children; /**< unique unsorted list of child insts */
561 aw0a 1
562 jds 54 /* struct hashtable *childdata;
563 aw0a 1 * hash lookup of children.
564     */
565 jds 54 /* note that in table there may be multiple names for a child that
566 aw0a 1 * occurs once in childdata.
567     */
568 jds 54 /* HANDS OFF! --Ben */
569 aw0a 1 };
570    
571 jds 54 /** First try of a WhenInstance needs to migrate toward the relations
572     *
573     * Would be nice to have a commoneqninstance type (CE_INST)
574 aw0a 1 * for rel,log,when.
575 jds 54 *
576     * doesn't align as never has children.
577 aw0a 1 */
578     struct WhenInstance {
579     enum inst_t t;
580     VOIDPTR interface_ptr;
581 jds 54 struct Instance *parent[2]; /**< relations can have only two parents and
582     normally they only have one. They have
583     two only during an ARE_THE_SAME */
584 ben.allan 33 struct gl_list_t *whens; /**< used in case of nested whens */
585     struct gl_list_t *cases; /**< list of cases */
586 jds 54 struct gl_list_t *bvar; /**< list of references to boolean variables */
587     struct TypeDescription *desc; /**< holds the child list stuff */
588 aw0a 1 unsigned long visited;
589 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
590     unsigned int anon_flags; /**< anonymous field to be manipulated */
591 aw0a 1 };
592    
593 jds 54 /** are pooled, and therefore must align, but does so on its own */
594 aw0a 1 struct ArrayChild {
595 jds 54 /* this object never pending, but member inst may be */
596     struct Instance *inst; /**< The instance. */
597 aw0a 1 union {
598     symchar *str;
599 jds 54 long index; /**< The name, may be string or index. */
600 aw0a 1 } name;
601     };
602    
603 jds 54 /** never has packed children. see gllist instead. */
604 aw0a 1 struct ArrayInstance {
605     enum inst_t t;
606 jds 54 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
607 aw0a 1 VOIDPTR interface_ptr;
608 jds 54 struct TypeDescription *desc; /**< holds the child list stuff */
609     struct gl_list_t *parents; /**< link to parent instances */
610     struct gl_list_t *children; /**< link to children */
611     unsigned long indirected; /**< number of times of indirected */
612 aw0a 1 unsigned long visited;
613 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
614     unsigned int anon_flags; /**< anonymous field to be manipulated */
615 aw0a 1 };
616    
617 jds 54 /** CONTAINER INSTANCE for interfaces. never pending.
618     * no packed children, so never need align
619     */
620     struct SimulationInstance {
621     /* these have *no* parents, yet */
622 aw0a 1 enum inst_t t;
623     VOIDPTR interface_ptr;
624 jds 54 struct TypeDescription *desc; /**< copy of the typedesc of its lone child */
625     symchar *name; /**< name of its lone child */
626     struct Instance **extvars; /**< external variables handles hack */
627     unsigned long tmp_num; /**< used when an instance tree is being copied*/
628     unsigned int anon_flags; /**< anonymous field to be manipulated */
629     /* add other interesting stuff here */
630 aw0a 1 };
631    
632 jds 54 /** dummy instance for unselected children of models
633     * no alignment issue
634     */
635 aw0a 1 struct GlobalDummyInstance {
636     enum inst_t t;
637 jds 54 /* never pending */
638 aw0a 1 VOIDPTR interface_ptr;
639 jds 54 /**no link to parent instances */
640     /* when instances should ignore dummy completely */
641 aw0a 1 struct TypeDescription *desc;
642 jds 54 /* all dummies are alike -- and the same */
643     /* dummy has not statements */
644 aw0a 1 unsigned long visited;
645 jds 54 unsigned long ref_count; /**< mainly for debugging purposes */
646     unsigned long tmp_num; /**< used when an instance tree is being copied
647     but CopyDummy==dummy always */
648     unsigned int anon_flags; /**< anonymous field to be manipulated */
649     /* why make life hell for the unsuspecting client? */
650     /*
651 aw0a 1 * In particular, the DUMMY_INST doesn't look like any category
652     * (EQN,Compound,Atom,Constant) because a single statically allocated
653     * instance of it stands in for all UNSELECTED_INSTANCEs that are
654     * not compiled.
655     * (This has nothing to do with the DummyIndexType.)
656     */
657     };
658    
659 jds 54 #endif /* __INSTANCE_TYPES_H_SEEN__ */
660    

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