/[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 256 - (hide annotations) (download) (as text)
Thu Feb 2 14:09:44 2006 UTC (18 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 28437 byte(s)
Standardising header #ifdef
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 johnpye 256 #ifndef ASC_INSTANCE_TYPES_H
31     #define ASC_INSTANCE_TYPES_H
32 jds 54
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 johnpye 256
256 jds 54 /* note that the above bit positions need to be settled on still. */
257 aw0a 1
258 jds 54 /** aligns to 8 on 4 and 8 byte compilers with compiler pad after t, depth */
259 aw0a 1 struct IntegerAtomInstance {
260     enum inst_t t;
261     VOIDPTR interface_ptr;
262 jds 54 struct gl_list_t *parents; /**< link to parents */
263 aw0a 1 struct Instance *alike_ptr;
264 jds 54 struct TypeDescription *desc; /**< usefull type description information */
265 aw0a 1 unsigned long visited;
266 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
267     unsigned int anon_flags; /**< anonymous field to be manipulated */
268     /* above should match with CommonAtomInstance */
269     /* atom value part */
270     unsigned int assigned; /**< the number of times it has been assigned */
271     struct gl_list_t *whens; /**< link to whens on which it appears */
272     unsigned int depth; /**< the depth of the last assignment */
273     long value; /**< integer value */
274     /*
275 aw0a 1 * An even number of child pointers are packed here, the last of which
276     * may not be real because the number of children may be odd.
277     * This extra should be eliminated for LONG pointer machines.
278     */
279 jds 54 /* After the child pointers comes the data space for the actual
280 aw0a 1 * children.
281     */
282     };
283    
284 jds 54 /** this structure aligns (with compiler generated pad after t and flags
285     * on 4 or 8 byte ptr machines. */
286 aw0a 1 struct BooleanAtomInstance {
287     enum inst_t t;
288     VOIDPTR interface_ptr;
289 jds 54 struct gl_list_t *parents; /**< link to parent instances */
290 aw0a 1 struct Instance *alike_ptr;
291 jds 54 struct TypeDescription *desc; /**< description of name,children, and size */
292 aw0a 1 unsigned long visited;
293 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
294     unsigned int anon_flags; /**< anonymous field to be manipulated */
295     /* above should match with CommonAtomInstance */
296     /* atom value part */
297 ben.allan 33 struct gl_list_t *logrelations; /**< logrelations where this boolean appears */
298     struct gl_list_t *whens; /**< whens where this boolean appears*/
299 jds 54 unsigned assigned; /**< the number of times it has been assigned */
300     unsigned depth; /**< the depth of the assignment */
301     unsigned value; /**< 0 false, 1 true */
302     int padding; /**< so that children have a square address */
303     /*
304 aw0a 1 * An even number of child pointers are packed here, the last of which
305     * may not be real because the number of children may be odd.
306     * This extra should be eliminated for LONG pointer machines.
307     */
308 jds 54 /* After the child pointers comes the data space for the actual
309 aw0a 1 * children.
310     */
311     };
312    
313 jds 54 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t */
314 aw0a 1 struct SetAtomInstance {
315 jds 54 enum inst_t t; /**< type */
316 aw0a 1 VOIDPTR interface_ptr;
317 jds 54 struct gl_list_t *parents; /**< link to parents instances */
318 aw0a 1 struct Instance *alike_ptr;
319 jds 54 struct TypeDescription *desc; /**< description of name,children, and size */
320 aw0a 1 unsigned long visited;
321 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied */
322     unsigned int anon_flags; /**< anonymous field to be manipulated */
323     /* above should match with CommonAtomInstance */
324     /* atom value part */
325     unsigned int_set; /**< 0 indicates string set,
326     1 indicates integer set */
327     struct set_t *list; /**< list of enumerated values NULL indicates
328     that is has not been assigned */
329     /*
330 aw0a 1 * An even number of child pointers are packed here, the last of which
331     * may not be real because the number of children may be odd.
332     * This extra should be eliminated for LONG pointer machines.
333     */
334 jds 54 /* After the child pointers comes the data space for the actual
335 aw0a 1 * children.
336     */
337     };
338    
339 jds 54 /** this aligns to 8 on 4 or 8 byte compilers with compiler pad after t, flags */
340 aw0a 1 struct SymbolAtomInstance {
341 jds 54 enum inst_t t; /**< type */
342 aw0a 1 VOIDPTR interface_ptr;
343 jds 54 struct gl_list_t *parents; /**< link to parent instances */
344     struct Instance *alike_ptr; /**< ALIKE clique link */
345     struct TypeDescription *desc; /**< description of name, children, and size */
346 aw0a 1 unsigned long visited;
347 jds 54 unsigned long tmp_num; /**< used when an instance is being copied */
348     unsigned int anon_flags; /**< anonymous field to be manipulated */
349     /* above should match with CommonAtomInstance */
350     struct gl_list_t *whens; /**< link to whens on which it appears */
351     /* atom value part */
352     symchar *value; /**< NULL indicates unassigned */
353     /*
354 aw0a 1 * An even number of child pointers are packed here, the last of which
355     * may not be real because the number of children may be odd.
356     * This extra should be eliminated for LONG pointer machines.
357     */
358 jds 54 /* After the child pointers comes the data space for the actual
359 aw0a 1 * children.
360     */
361     };
362    
363 jds 54 /* CONSTANT INSTANCES */
364     /** The first one is a dummy of some importance. All the Constant
365 aw0a 1 * types should be conformable to this structure. It
366     * is not by itself a structure that should ever exist.
367     */
368     struct CommonConstantInstance {
369     enum inst_t t;
370     unsigned int vflag;
371 jds 54 unsigned long visited; /**< visited counter */
372     unsigned long tmp_num; /**< used when an instance tree is being copied*/
373 aw0a 1 VOIDPTR interface_ptr;
374 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated
375     vflag is 32 bits with particular meanings: */
376     #define ci_ASSIGNED 0x1 /**< instance assigned yet? */
377     #define ci_BVAL 0x2 /**< boolean const instance value, reserved */
378     /* other binary flags constants need to be added here. */
379 aw0a 1 };
380    
381 jds 54 /** @todo RealConstantInstance should probably be pooled, but isn't yet */
382 aw0a 1 struct RealConstantInstance {
383     enum inst_t t;
384 jds 54 unsigned vflag; /**< assigned? */
385     unsigned long visited; /**< visited counter */
386     unsigned long tmp_num; /**< used when an instance tree is being copied*/
387 aw0a 1 VOIDPTR interface_ptr;
388 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
389     /* above should match with CommonConstantInstance */
390 aw0a 1 double value;
391 jds 54 struct gl_list_t *parents; /**< link to parents */
392     struct Instance *alike_ptr; /**< circular linked list of clique members?*/
393     struct TypeDescription *desc; /**< description of name, size */
394 aw0a 1 CONST dim_type *dimen;
395     };
396    
397     struct IntegerConstantInstance {
398     enum inst_t t;
399 jds 54 unsigned vflag; /**< assigned? */
400     unsigned long visited; /**< visited counter */
401     unsigned long tmp_num; /**< used when an instance tree is being copied*/
402 aw0a 1 VOIDPTR interface_ptr;
403 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
404     /* above should match with CommonConstantInstance */
405 aw0a 1 long value;
406 jds 54 struct gl_list_t *parents; /**< link to parents */
407 ben.allan 33 struct gl_list_t *whens; /**< whens where this integer appears*/
408 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
409     struct TypeDescription *desc; /**< description of name, size */
410 aw0a 1 };
411    
412     struct BooleanConstantInstance {
413     enum inst_t t;
414 jds 54 unsigned vflag; /**< assigned? */
415     unsigned long visited; /**< visited counter */
416     unsigned long tmp_num; /**< used when an instance tree is being copied*/
417 aw0a 1 VOIDPTR interface_ptr;
418 jds 54 /* above should match with CommonConstantInstance */
419     unsigned int anon_flags; /**< anonymous field to be manipulated */
420     struct gl_list_t *parents; /**< link to parents */
421 ben.allan 33 struct gl_list_t *whens; /**< whens where this boolean appears*/
422 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
423     struct TypeDescription *desc; /**< description of name, size */
424 aw0a 1 };
425    
426     struct SymbolConstantInstance {
427     enum inst_t t;
428 jds 54 unsigned vflag; /**< assigned */
429     unsigned long visited; /**< visited counter */
430     unsigned long tmp_num; /**< used when an instance tree is being copied*/
431 aw0a 1 VOIDPTR interface_ptr;
432 jds 54 unsigned int anon_flags; /**< anonymous field to be manipulated */
433     /* above should match with CommonConstantInstance */
434     struct gl_list_t *parents; /**< link to parents */
435 ben.allan 33 struct gl_list_t *whens; /**< whens where this symbol appears*/
436 jds 54 struct Instance *alike_ptr; /**< circular linked list of clique members?*/
437     struct TypeDescription *desc; /**< description of name, size */
438 aw0a 1 symchar *value;
439     };
440    
441 jds 54 /** aligns on 4 or 8 byte ptr machines. size 48/88
442     *
443     * @todo RelationInstance should probably be pooled, as RealAtomInstance,
444     * but isn't yet for the same reasons.
445 aw0a 1 */
446     struct RelationInstance {
447     enum inst_t t;
448 jds 54 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
449 aw0a 1 VOIDPTR interface_ptr;
450 jds 54 struct Instance *parent[2]; /**< relations can have only two parents and
451     normally they only have one. They have
452     two only during an ARE_THE_SAME */
453     struct TypeDescription *desc; /**< holds the child list stuff */
454 aw0a 1 unsigned long visited;
455 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
456     unsigned int anon_flags; /**< anonymous field to be manipulated */
457     enum Expr_enum type; /**< what kind of the 5 possible types of reln
458     type should be down in union RelationUnion*/
459     struct relation *ptr; /**< pointer to an instance relation */
460     struct gl_list_t *whens; /**< link to whens on which the rel appears */
461     struct gl_list_t *logrels; /**< link to satified's on which rel appears */
462     /* So child insts start packing on 8byte address after child ptrs, of
463 aw0a 1 * which there are (currently, 2/97) always an even number.
464     */
465 jds 54 /* Not required anymore:
466 aw0a 1 *
467     * #if (LONGCHILDREN == 0)
468     * int padding;
469     * #endif
470     *
471     * Not valid anymore:
472     *
473     * An even number of child pointers are packed here, the last of which
474     * may not be real because the number of children may be odd.
475     * This extra should be eliminated for LONG pointer machines.
476     */
477    
478 jds 54 /* After the child pointers comes the data space for the actual
479 aw0a 1 * children.
480     */
481     };
482    
483 jds 54 /** this aligns to 8 bytes with 4 or 8 byte pointers. size 48/88 */
484 aw0a 1 struct LogRelInstance {
485     enum inst_t t;
486 jds 54 /* on long pointer machines, we expect C compiler to pad 4 bytes here */
487 aw0a 1 VOIDPTR interface_ptr;
488 jds 54 struct Instance *parent[2]; /**< log relations can have only two parents
489     and normally they only have one.They have
490     two only during an ARE_THE_SAME */
491     struct TypeDescription *desc; /**< holds the child list stuff */
492 aw0a 1 unsigned long visited;
493 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
494     struct logrelation *ptr; /**< pointer to an instance logical relation */
495     struct gl_list_t *whens; /**< link to whens on which the logrel appears */
496     struct gl_list_t *logrels; /**< link to satified's on which lrel appears */
497     unsigned int anon_flags; /**< anonymous field to be manipulated */
498     int padding; /**< so child insts start packing on 8byte
499     address after child ptrs */
500     /*
501 aw0a 1 * All logrelations are the same type/size, because we require
502     * exactly 1 refinement of the base definition.
503     */
504 jds 54 /* After the child pointers comes the data space for the actual
505 aw0a 1 * children. This space must start on an 8 byte address.
506     */
507     };
508    
509 jds 54 /** Never, ever, allocate either one of these types. it's a dummy for the
510 aw0a 1 * instantiator.
511     */
512     struct PendInstance {
513     enum inst_t t;
514     VOIDPTR p;
515     };
516    
517    
518 jds 54 /* COMPOUND INSTANCES */
519     /* Note: All the compound instance structs, except ArrayChild,
520 aw0a 1 * and Automatic should have
521     enum inst_t t;
522     VOIDPTR pending_entry;
523     * as the first two lines to match PendInstance above.
524     * Relations of any type are NOT compound, other errors in
525     * this file not withstanding.
526     */
527 jds 54 /** this structure doesn't have to align on 4 byte ptr machines. size 48/88 */
528 aw0a 1 struct ModelInstance {
529     enum inst_t t;
530 jds 54 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
531 aw0a 1 VOIDPTR interface_ptr;
532 jds 54 struct gl_list_t *parents; /**< link to parent instances */
533     struct gl_list_t *whens; /**< link to whens on which the model appears */
534 aw0a 1 struct TypeDescription *desc;
535     struct Instance *alike_ptr;
536 jds 54 struct BitList *executed; /**< bit list to keep track of which
537     statements have been executed */
538 aw0a 1 unsigned long visited;
539 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
540     unsigned int anon_flags; /**< anonymous field to be manipulated */
541 aw0a 1 #if (LONGCHILDREN == 1)
542 jds 54 int padding; /**< so ptrs start packing on 8byte address */
543 aw0a 1 #endif
544 jds 54 /* The child pointers of model instances are packed here, but each is
545 aw0a 1 * different and there may not even be children. They are not
546     * accessible through the struct, but only through InstanceChild.
547     */
548     };
549    
550 jds 54 /** This struct not in use anywhere yet, pending more semantics */
551 aw0a 1 struct AutomaticInstance {
552     enum inst_t t;
553 jds 54 /* this object never pending since it has no statements */
554 aw0a 1 VOIDPTR interface_ptr;
555 ben.allan 33 struct Instance *sim_parent; /**< exactly one of these */
556     struct TypeDescription *desc; /**< UNIVERSAL and made at startup */
557 aw0a 1 unsigned long visited;
558 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
559     unsigned int anon_flags; /**< anonymous field to be manipulated */
560 aw0a 1
561 jds 54 struct gl_list_t *children; /**< unique unsorted list of child insts */
562 aw0a 1
563 jds 54 /* struct hashtable *childdata;
564 aw0a 1 * hash lookup of children.
565     */
566 jds 54 /* note that in table there may be multiple names for a child that
567 aw0a 1 * occurs once in childdata.
568     */
569 jds 54 /* HANDS OFF! --Ben */
570 aw0a 1 };
571    
572 jds 54 /** First try of a WhenInstance needs to migrate toward the relations
573     *
574     * Would be nice to have a commoneqninstance type (CE_INST)
575 aw0a 1 * for rel,log,when.
576 jds 54 *
577     * doesn't align as never has children.
578 aw0a 1 */
579     struct WhenInstance {
580     enum inst_t t;
581     VOIDPTR interface_ptr;
582 jds 54 struct Instance *parent[2]; /**< relations can have only two parents and
583     normally they only have one. They have
584     two only during an ARE_THE_SAME */
585 ben.allan 33 struct gl_list_t *whens; /**< used in case of nested whens */
586     struct gl_list_t *cases; /**< list of cases */
587 jds 54 struct gl_list_t *bvar; /**< list of references to boolean variables */
588     struct TypeDescription *desc; /**< holds the child list stuff */
589 aw0a 1 unsigned long visited;
590 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
591     unsigned int anon_flags; /**< anonymous field to be manipulated */
592 aw0a 1 };
593    
594 jds 54 /** are pooled, and therefore must align, but does so on its own */
595 aw0a 1 struct ArrayChild {
596 jds 54 /* this object never pending, but member inst may be */
597     struct Instance *inst; /**< The instance. */
598 aw0a 1 union {
599     symchar *str;
600 jds 54 long index; /**< The name, may be string or index. */
601 aw0a 1 } name;
602     };
603    
604 jds 54 /** never has packed children. see gllist instead. */
605 aw0a 1 struct ArrayInstance {
606     enum inst_t t;
607 jds 54 VOIDPTR pending_entry; /**< hold a word only pending.c can touch */
608 aw0a 1 VOIDPTR interface_ptr;
609 jds 54 struct TypeDescription *desc; /**< holds the child list stuff */
610     struct gl_list_t *parents; /**< link to parent instances */
611     struct gl_list_t *children; /**< link to children */
612     unsigned long indirected; /**< number of times of indirected */
613 aw0a 1 unsigned long visited;
614 jds 54 unsigned long tmp_num; /**< used when an instance tree is being copied*/
615     unsigned int anon_flags; /**< anonymous field to be manipulated */
616 aw0a 1 };
617    
618 jds 54 /** CONTAINER INSTANCE for interfaces. never pending.
619     * no packed children, so never need align
620     */
621     struct SimulationInstance {
622     /* these have *no* parents, yet */
623 aw0a 1 enum inst_t t;
624     VOIDPTR interface_ptr;
625 jds 54 struct TypeDescription *desc; /**< copy of the typedesc of its lone child */
626     symchar *name; /**< name of its lone child */
627     struct Instance **extvars; /**< external variables handles hack */
628     unsigned long tmp_num; /**< used when an instance tree is being copied*/
629     unsigned int anon_flags; /**< anonymous field to be manipulated */
630     /* add other interesting stuff here */
631 aw0a 1 };
632    
633 jds 54 /** dummy instance for unselected children of models
634     * no alignment issue
635     */
636 aw0a 1 struct GlobalDummyInstance {
637     enum inst_t t;
638 jds 54 /* never pending */
639 aw0a 1 VOIDPTR interface_ptr;
640 jds 54 /**no link to parent instances */
641     /* when instances should ignore dummy completely */
642 aw0a 1 struct TypeDescription *desc;
643 jds 54 /* all dummies are alike -- and the same */
644     /* dummy has not statements */
645 aw0a 1 unsigned long visited;
646 jds 54 unsigned long ref_count; /**< mainly for debugging purposes */
647     unsigned long tmp_num; /**< used when an instance tree is being copied
648     but CopyDummy==dummy always */
649     unsigned int anon_flags; /**< anonymous field to be manipulated */
650     /* why make life hell for the unsuspecting client? */
651     /*
652 aw0a 1 * In particular, the DUMMY_INST doesn't look like any category
653     * (EQN,Compound,Atom,Constant) because a single statically allocated
654     * instance of it stands in for all UNSELECTED_INSTANCEs that are
655     * not compiled.
656     * (This has nothing to do with the DummyIndexType.)
657     */
658     };
659    
660 johnpye 256 #endif /* ASC_INSTANCE_TYPES_H */
661 jds 54

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