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

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

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