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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.11  
changed lines
  Added in v.33

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