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

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

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

revision 73 by jds, Tue Aug 2 11:20:09 2005 UTC revision 74 by jds, Fri Dec 2 23:33:32 2005 UTC
# Line 32  Line 32 
32   *  When #including type_desc.h, make sure these files are #included first:   *  When #including type_desc.h, make sure these files are #included first:
33   *         #include <stdio.h>   *         #include <stdio.h>
34   *         #include "utilities/ascConfig.h"   *         #include "utilities/ascConfig.h"
35   *         #include "fractions.h"   *         #include "compiler/fractions.h"
36   *         #include "compiler.h"   *         #include "compiler/compiler.h"
37   *         #include "dimen.h"   *         #include "compiler/dimen.h"
38   *         #include "child.h"   *         #include "compiler/child.h"
39   *         #include "list.h"   *         #include "compiler/list.h"
40   *         #include "module.h"   *         #include "compiler/module.h"
41   *         #include "childinfo.h"   *         #include "compiler/childinfo.h"
42   *         #include "slist.h"   *         #include "compiler/slist.h"
43   *  </pre>   *  </pre>
44   */   */
45    
46  #ifndef __TYPE_DESC_H_SEEN__  #ifndef type_desc_h_seen__
47  #define __TYPE_DESC_H_SEEN__  #define type_desc_h_seen__
48    
49  /** Bad pointer for a patently bogus definition when needed.  /**
50   * This token is an illegal address for any type definition,   *  Bad pointer for a patently bogus type definition when needed.
51   * (illegal for alignment reasons) which we can use to denote   *  This token is an illegal address for any type definition,
52   * the UNIVERSAL root MODEL which does not exist as a real   *  (illegal for alignment reasons) which we can use to denote
53   * type description in the library.   *  the UNIVERSAL root MODEL which does not exist as a real
54     *  type description in the library.
55   */   */
56  #define ILLEGAL_DEFINITION ((struct TypeDescription *)0xF0F0F0F7)  #define ILLEGAL_DEFINITION ((struct TypeDescription *)0xF0F0F0F7)
57    
# Line 149  struct AtomTypeDesc { Line 150  struct AtomTypeDesc {
150   */   */
151  struct IndexType {  struct IndexType {
152    struct Set *set;    /**< the original set */    struct Set *set;    /**< the original set */
153    symchar *sptr;      /**< a string representation off the set */    symchar *sptr;      /**< a string representation of the set */
154    unsigned int_index; /**< 0 this index is an enumerate one,    unsigned int_index; /**< 0 this index is an enumerate one,
155                             1 this index is an integer one */                             1 this index is an integer one */
156  };  };
157    
# Line 194  struct ModelArgs { Line 195  struct ModelArgs {
195    /**< number of args required in an IS_A of this type. */    /**< number of args required in an IS_A of this type. */
196  };  };
197    
198    /** Type definition data structure. */
199  struct TypeDescription {  struct TypeDescription {
200    symchar *name;                /**< type name */    symchar *name;                    /**< type name */
201    enum type_kind t;             /**< base type of the type */    enum type_kind t;                 /**< base type of the type */
202    short universal;              /**< TRUE universal type, FALSE non-universal */    short universal;                  /**< TRUE universal type, FALSE non-universal */
203    unsigned short flags;         /**< various boolean flags */    unsigned short flags;             /**< various boolean flags */
204    struct TypeDescription *refines;  /**< the type it refines or NULL */    struct TypeDescription *refines;  /**< the type it refines or NULL */
205    struct module_t *mod;         /**< module where it is defined */    struct module_t *mod;             /**< module where it is defined */
206    ChildListPtr children;        /**< list of children. Never NULL for models */    ChildListPtr children;            /**< list of children. Never NULL for models */
207    struct gl_list_t *init;       /**< initialization procedures */    struct gl_list_t *init;           /**< initialization procedures */
208    struct StatementList *stats;  /**< statements */    struct StatementList *stats;      /**< statements */
209    struct gl_list_t *refiners;   /**< list of types that refine this. alpha */    struct gl_list_t *refiners;       /**< list of types that refine this. alpha */
210    unsigned long ref_count;      /**< count includes instances, other types */    unsigned long ref_count;          /**< count includes instances, other types */
211    long int parseid;             /**< n as in 'nth definition made' */    long int parseid;                 /**< n as in 'nth definition made' */
212    union {    union {
213      struct ArrayDesc array;           /**< description of array things */      struct ArrayDesc array;           /**< description of array things */
214      struct AtomTypeDesc atom;         /**< atom description stuff */      struct AtomTypeDesc atom;         /**< atom description stuff */
# Line 236  struct TypeDescription { Line 238  struct TypeDescription {
238   */   */
239  extern ChildListPtr GetChildListF(CONST struct TypeDescription *d);  extern ChildListPtr GetChildListF(CONST struct TypeDescription *d);
240  /**<  /**<
241   *  <!--  macro GetChildList(d)                                        -->   *  Returns the childlist field of d.
  *  <!--  const ChildListPtr GetChildListF(d)                          -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the childlist field of d.                             -->  
242   *  Implementation function for GetChildList() (debug mode).   *  Implementation function for GetChildList() (debug mode).
243   *  Do not call this function directly - use GetChildList() instead.   *  Do not call this function directly - use GetChildList() instead.
244   */   */
# Line 257  extern ChildListPtr GetChildListF(CONST Line 256  extern ChildListPtr GetChildListF(CONST
256   */   */
257  extern enum type_kind GetBaseTypeF(CONST struct TypeDescription *d);  extern enum type_kind GetBaseTypeF(CONST struct TypeDescription *d);
258  /**<  /**<
  *  <!--  macro GetBaseType(d)                                         -->  
  *  <!--  enum type_kind GetBaseTypeF(d)                               -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the base type of a type description.  It returns an   -->  
  *  <!--  enum type_kind value.                                        -->  
259   *  Implementation function for GetBaseType() (debug mode).   *  Implementation function for GetBaseType() (debug mode).
260   *  Do not call this function directly - use GetBaseType() instead.   *  Do not call this function directly - use GetBaseType() instead.
261   */   */
# Line 302  extern enum type_kind GetBaseTypeF(CONST Line 296  extern enum type_kind GetBaseTypeF(CONST
296   *  and so are not considered simple. Obviously arrays and models are   *  and so are not considered simple. Obviously arrays and models are
297   *  compound.   *  compound.
298   */   */
 /* OLD GROUP COMMENT */  
 /*  
  *  const struct d;  
  *  int truth;  
  *  
  *  macro BaseTypeIsReal(d)  
  *  truth =  BaseTypeIsReal(d)  
  *  Returns TRUE if basetype of d is real valued.  
  *  
  *  macro BaseTypeIsInteger(d)  
  *  truth =  BaseTypeIsInteger(d)  
  *  Returns TRUE if basetype of d is integer valued.  
  *  
  *  macro BaseTypeIsBoolean(d)  
  *  truth =  BaseTypeIsBoolean(d)  
  *  Returns TRUE if basetype of d is truth valued.  
  *  
  *  macro BaseTypeIsSymbol(d)  
  *  truth =  BaseTypeIsSymbol(d)  
  *  Returns TRUE if basetype of d is char * valued.  
  *  
  *  macro BaseTypeIsSet(d)  
  *  truth =  BaseTypeIsSet(d)  
  *  Returns TRUE if basetype of d is a set of anything.  
  *  
  *  macro BaseTypeIsAtomic(d)  
  *  truth =  BaseTypeIsAtomic(d)  
  *  Returns TRUE if basetype of d is among the atoms.  
  *  
  *  macro BaseTypeIsConstant(d)  
  *  truth =  BaseTypeIsConstant(d)  
  *  Returns TRUE if basetype of d is among the constants.  
  *  
  *  Note on the next two: several types are not simple or compound --  
  *  we can't really make up our minds whether relations/whens/etc are  
  *  simple or compound. In general simple means having a scalar(set)  
  *  value. Relations have several values (satisfaction, residual,etc)  
  *  and so are not considered simple. Obviously arrays and models are  
  *  compound.  
  *  
  *  macro BaseTypeIsCompound(d)  
  *  truth =  BaseTypeIsCompound(d)  
  *  Returns TRUE if basetype of d is among the compound types.  
  *  
  *  macro BaseTypeIsEquation(d)  
  *  truth =  BaseTypeIsEquations(d)  
  *  Returns TRUE if basetype of d is among the simple types.  
  *  
  *  macro BaseTypeIsSimple(d)  
  *  truth =  BaseTypeIsSimple(d)  
  *  Returns TRUE if basetype of d is among the simple types.  
  */  
299    
300  #ifdef NDEBUG  #ifdef NDEBUG
301  #define GetStatementList(d) ((d)->stats)  #define GetStatementList(d) ((d)->stats)
# Line 361  extern enum type_kind GetBaseTypeF(CONST Line 303  extern enum type_kind GetBaseTypeF(CONST
303  #define GetStatementList(d) GetStatementListF(d)  #define GetStatementList(d) GetStatementListF(d)
304  #endif  #endif
305  /**<  /**<
306   *  Return the statement list for models and atoms.  In the case of   *  Returns the statement list for models and atoms.  In the case of
307   *  models this will never return NULL.  In some cases of atoms, this may   *  models this will never return NULL.  In some cases of atoms, this may
308   *  return NULL which indicates that the instance doesn't have any   *  return NULL which indicates that the instance doesn't have any
309   *  pending statements.   *  pending statements.
# Line 373  extern enum type_kind GetBaseTypeF(CONST Line 315  extern enum type_kind GetBaseTypeF(CONST
315  extern CONST struct StatementList  extern CONST struct StatementList
316  *GetStatementListF(CONST struct TypeDescription *d);  *GetStatementListF(CONST struct TypeDescription *d);
317  /**<  /**<
  *  <!--  macro GetStatementList(d)                                    -->  
  *  <!--  const struct StatementList *GetStatementListF(d)             -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the statement list for models and atoms.  In the case of       -->  
  *  <!--  models this will never return NULL.  In some cases of atoms, this may -->  
  *  <!--  return NULL which indicates that the instance doesn't have any        -->  
  *  <!--  pending statements.                                          -->  
  *  <!--  A nonNULL list may, however, be an empty list.               -->  
318   *  Implementation function for GetStatementList() (debug mode).   *  Implementation function for GetStatementList() (debug mode).
319   *  Do not call this function directly - use GetStatementList() instead.   *  Do not call this function directly - use GetStatementList() instead.
320   */   */
# Line 399  extern CONST struct StatementList Line 333  extern CONST struct StatementList
333  extern struct gl_list_t  extern struct gl_list_t
334  *GetInitializationListF(CONST struct TypeDescription *d);  *GetInitializationListF(CONST struct TypeDescription *d);
335  /**<  /**<
  *  <!--  macro GetInitializationList(d)                               -->  
  *  <!--  struct gl_list_t *GetInitializationListF(d)                  -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Returns the list of initialization procedures.               -->  
336   *  Implementation function for GetInitializationList() (debug mode).   *  Implementation function for GetInitializationList() (debug mode).
337   *  Do not call this function directly - use GetInitializationList() instead.   *  Do not call this function directly - use GetInitializationList() instead.
338   */   */
# Line 419  extern int AddMethods(struct TypeDescrip Line 349  extern int AddMethods(struct TypeDescrip
349                        struct gl_list_t *pl,                        struct gl_list_t *pl,
350                        int err);                        int err);
351  /**<  /**<
352   *  <!--  struct gl_list_t *AddMethods(d,pl,err)                       -->   *  Inserts new methods into a type and all its refinements.
353   *  <!--  const struct TypeDescription *d;                             -->   *  pl should contain (struct InitProcedure *) to the methods to
354   *  <!--  struct gl_list_t *pl;                                        -->   *  add to d.  The methods named in pl must not conflict with any
355   *  Inserts new methods into a type and all its refinements. The methods   *  method in d or its refinements.  If err != 0, rejects pl.<br><br>
  *  named on the list given must not conflict with any method in d or  
  *  its refinements. If err != 0, rejects pl.<br><br>  
356   *   *
  *  Returns 0 if successful, 1 if not.  
357   *  If return is 1, caller is responsible for pl, OTHERWISE we manage it   *  If return is 1, caller is responsible for pl, OTHERWISE we manage it
358   *  from here on. If caller supplied d == ILLEGAL_DEFINITION, the caller   *  from here on.  If caller supplied d == ILLEGAL_DEFINITION, the caller
359   *  can unconditionally forget pl.   *  can unconditionally forget pl.
360     *
361     *  @param d   The type to which the methods in pl should be added.
362     *  @param pl  A gl_list_t of (struct InitProcedure *) to add to d.
363     *  @param err If non-zero, pl is rejected and no methods are added.
364     *  @return Returns 0 if successful, 1 if not.
365   */   */
366    
367  extern int ReplaceMethods(struct TypeDescription *d,  extern int ReplaceMethods(struct TypeDescription *d,
368                            struct gl_list_t *pl,                            struct gl_list_t *pl,
369                            int err);                            int err);
370  /**<  /**<
371   *  <!--  struct gl_list_t *ReplaceMethods(d,pl,err)                   -->   *  Replaces listed methods in a type and all its refinements that do not
372   *  <!--  const struct TypeDescription *d;                             -->   *  themselves redefine the methods.  The methods in pl must exist in d or
373   *  <!--  struct gl_list_t *pl;                                        -->   *  else an error condition is returned.  Methods not named in pl but found
374   *  Replaces methods into a type and all its refinements that do not   *  in d or its refinements are left undisturbed. If err != 0, rejects pl.<br><br>
  *  themselves redefine the methods.  
  *  The methods given must all exist in d (?).  
  *  Methods not named in pl but are found in d or refinements are left  
  *  undisturbed. If err != 0, rejects pl.<br><br>  
375   *   *
  *  Returns 0 if successful, 1 if not.  
376   *  If return is 1, caller is responsible for pl, OTHERWISE we manage it   *  If return is 1, caller is responsible for pl, OTHERWISE we manage it
377   *  from here on.   *  from here on.
378     *
379     *  @param d   The type to which the methods in pl should be replaced.
380     *  @param pl  A gl_list_t of (struct InitProcedure *) to replace in.
381     *  @param err If non-zero, pl is rejected and no methods are replaced.
382     *  @return Returns 0 if successful, 1 if not.
383   */   */
384    
385  #ifdef NDEBUG  #ifdef NDEBUG
# Line 463  extern int ReplaceMethods(struct TypeDes Line 395  extern int ReplaceMethods(struct TypeDes
395   */   */
396  extern void CopyTypeDescF(struct TypeDescription *d);  extern void CopyTypeDescF(struct TypeDescription *d);
397  /**<  /**<
  *  <!--  macro CopyTypeDesc(d)                                        -->  
  *  <!--  void CopyTypeDescF(d)                                        -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  Increment the reference count.                               -->  
398   *  Implementation function for CopyTypeDesc() (debug mode).   *  Implementation function for CopyTypeDesc() (debug mode).
399   *  Do not call this function directly - use CopyTypeDesc() instead.   *  Do not call this function directly - use CopyTypeDesc() instead.
400   */   */
401    
402  extern void DeleteTypeDesc(struct TypeDescription *d);  extern void DeleteTypeDesc(struct TypeDescription *d);
403  /**<  /**<
  *  <!--  void DeleteTypeDesc(d)                                       -->  
  *  <!--  struct TypeDescription *d;                                   -->  
404   *  Decrement the reference count.  Eventually, this should delete it   *  Decrement the reference count.  Eventually, this should delete it
405   *  when ref_count == 0.  Note to myself:  Remeber that array type   *  when ref_count == 0.  Note to myself:  Remember that array type
406   *  descriptions need to be removed from a list too.   *  descriptions need to be removed from a list too.
407   */   */
408    
409  extern void DeleteNewTypeDesc(struct TypeDescription *d);  extern void DeleteNewTypeDesc(struct TypeDescription *d);
410  /**<  /**<
  *  <!--  void DeleteNewTypeDesc(d)                                    -->  
  *  <!--  struct TypeDescription *d;                                   -->  
411   *  Checks that the type has a refcount of 1 before passing it on to   *  Checks that the type has a refcount of 1 before passing it on to
412   *  DeleteTypeDesc. This is (or should be) the case when deleting   *  DeleteTypeDesc. This is (or should be) the case when deleting
413   *  types that are newly parsed but not yet in the type library.   *  types that are newly parsed but not yet in the type library.
# Line 503  extern void DeleteNewTypeDesc(struct Typ Line 427  extern void DeleteNewTypeDesc(struct Typ
427   */   */
428  extern unsigned GetByteSizeF(CONST struct TypeDescription *d);  extern unsigned GetByteSizeF(CONST struct TypeDescription *d);
429  /**<  /**<
  *  <!--  macro GetByteSize(d)                                         -->  
  *  <!--  unsigned long GetByteSizeF(d)                                -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the byte size of an atom type description.            -->  
430   *  Implementation function for GetByteSize() (debug mode).   *  Implementation function for GetByteSize() (debug mode).
431   *  Do not call this function directly - use GetByteSize() instead.   *  Do not call this function directly - use GetByteSize() instead.
432   */   */
# Line 524  extern unsigned GetByteSizeF(CONST struc Line 444  extern unsigned GetByteSizeF(CONST struc
444   */   */
445  extern CONST struct ChildDesc *GetChildDescF(CONST struct TypeDescription *d);  extern CONST struct ChildDesc *GetChildDescF(CONST struct TypeDescription *d);
446  /**<  /**<
  *  <!--  macro GetChildDesc(d)                                        -->  
  *  <!--  const struct ChildDesc *GetChildDescF(d)                     -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the child description field of an atom type description. -->  
447   *  Implementation function for GetChildDesc() (debug mode).   *  Implementation function for GetChildDesc() (debug mode).
448   *  Do not call this function directly - use GetChildDesc() instead.   *  Do not call this function directly - use GetChildDesc() instead.
449   */   */
# Line 546  extern CONST struct ChildDesc *GetChildD Line 462  extern CONST struct ChildDesc *GetChildD
462   */   */
463  extern int GetUniversalFlagF(CONST struct TypeDescription *d);  extern int GetUniversalFlagF(CONST struct TypeDescription *d);
464  /**<  /**<
  *  <!--  macro GetUniversalFlag(d)                                    -->  
  *  <!--  short GetUniversalFlagF(d)                                   -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the universal flag of a type definition               -->  
  *  <!--  Gets a short all to itself for no apparent reason.           -->  
465   *  Implementation function for GetUniversalFlag() (debug mode).   *  Implementation function for GetUniversalFlag() (debug mode).
466   *  Do not call this function directly - use GetUniversalFlag() instead.   *  Do not call this function directly - use GetUniversalFlag() instead.
467   */   */
# Line 569  extern int GetUniversalFlagF(CONST struc Line 480  extern int GetUniversalFlagF(CONST struc
480   */   */
481  extern unsigned short GetTypeFlagsF(CONST struct TypeDescription *d);  extern unsigned short GetTypeFlagsF(CONST struct TypeDescription *d);
482  /**<  /**<
  *  <!--  macro GetTypeFlags(d)                                        -->  
  *  <!--  unsigned short GetTypeFlagsF(d)                              -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the type flags of a type definition                   -->  
  *  <!--  There are a number of flags we might want in various bit positions. -->  
483   *  Implementation function for GetTypeFlags() (debug mode).   *  Implementation function for GetTypeFlags() (debug mode).
484   *  Do not call this function directly - use GetTypeFlags() instead.   *  Do not call this function directly - use GetTypeFlags() instead.
485   */   */
# Line 603  extern unsigned short GetTypeFlagsF(CONS Line 509  extern unsigned short GetTypeFlagsF(CONS
509   */   */
510  extern unsigned TypeHasDefaultStatementsF(CONST struct TypeDescription *d);  extern unsigned TypeHasDefaultStatementsF(CONST struct TypeDescription *d);
511  /**<  /**<
  *  <!--  macro TypeHasDefaultStatements(d)                            -->  
  *  <!--  unsigned TypeHasDefaultStatementsF(d)                        -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Tells if the statement list of a type has any default ( := ) statements. -->  
  *  <!--  Returns 0 if not.                                            -->  
  *  <!--  This does not refer to the DEFAULT keyword in atoms.         -->  
512   *  Implementation function for TypeHasDefaultStatements() (debug mode).   *  Implementation function for TypeHasDefaultStatements() (debug mode).
513   *  Do not call this function directly - use TypeHasDefaultStatements() instead.   *  Do not call this function directly - use TypeHasDefaultStatements() instead.
514   */   */
# Line 630  extern unsigned TypeHasDefaultStatements Line 530  extern unsigned TypeHasDefaultStatements
530   */   */
531  extern unsigned TypeHasParameterizedInstsF(CONST struct TypeDescription *d);  extern unsigned TypeHasParameterizedInstsF(CONST struct TypeDescription *d);
532  /**<  /**<
  *  <!--  macro TypeHasParameterizedInsts(d)                           -->  
  *  <!--  unsigned TypeHasParameterizedInstsF(d)                       -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Tells if the statement lists of a type involve parameters in any way. -->  
  *  <!--  A type that has parameters, or has children that have parameters or  -->  
  *  <!--  recursively so returns nonzero result (TYPECONTAINSPARINSTS). -->  
  *  <!--  Returns 0 if not.                                            -->  
  *  <!--  This does not refer to the DEFAULT keyword in atoms.         -->  
533   *  Implementation function for TypeHasParameterizedInsts() (debug mode).   *  Implementation function for TypeHasParameterizedInsts() (debug mode).
534   *  Do not call this function directly - use TypeHasParameterizedInsts() instead.   *  Do not call this function directly - use TypeHasParameterizedInsts() instead.
535   */   */
536    
537  #define AtomDefaulted(d) ((d)->u.atom.defaulted)  #define AtomDefaulted(d) ((d)->u.atom.defaulted)
538  /**<  /**<
539   *  <!--  macro AtomDefaulted(d)                                       -->   *  Returns TRUE if the atom has a default value; otherwise returns FALSE.
  *  <!--  struct TypeDescription *d;                                   -->  
  *  Return TRUE if the atom has a default value; otherwise return FALSE.  
540   */   */
541    
542  #define ConstantDefaulted(d) ((d)->u.constant.defaulted)  #define ConstantDefaulted(d) ((d)->u.constant.defaulted)
543  /**<  /**<
544   *  <!--  macro ConstantDefaulted(d)                                   -->   *  Returns TRUE if the Constant has a default value; otherwise returns FALSE.
  *  <!--  struct TypeDescription *d;                                   -->  
  *  Return TRUE if the Constant has a default value; otherwise return FALSE.  
545   */   */
546    
547  #define GetIntDefault(d) ((d)->u.atom.u.defint)  #define GetIntDefault(d) ((d)->u.atom.u.defint)
548  /**<  Return the long default value of TypeDescription *d. */  /**<  Returns the long default value of TypeDescription *d. */
549  #define GetSymDefault(d) ((d)->u.atom.u.defsym)  #define GetSymDefault(d) ((d)->u.atom.u.defsym)
550  /**<  Return the symchar* default value of TypeDescription *d. */  /**<  Returns the symchar* default value of TypeDescription *d. */
551  #ifdef NDEBUG  #ifdef NDEBUG
552  #define GetRealDefault(d) ((d)->u.atom.u.defval)  #define GetRealDefault(d) ((d)->u.atom.u.defval)
553  #else  #else
554  #define GetRealDefault(d) GetRealDefaultF((d),__FILE__,__LINE__)  #define GetRealDefault(d) GetRealDefaultF((d),__FILE__,__LINE__)
555  #endif  #endif
556  /**<  Return the double default value of TypeDescription *d. */  /**<  Returns the double default value of TypeDescription *d. */
557  #ifdef NDEBUG  #ifdef NDEBUG
558  #define GetBoolDefault(d) ((d)->u.atom.u.defbool)  #define GetBoolDefault(d) ((d)->u.atom.u.defbool)
559  #else  #else
560  #define GetBoolDefault(d) GetBoolDefaultF((d),__FILE__,__LINE__)  #define GetBoolDefault(d) GetBoolDefaultF((d),__FILE__,__LINE__)
561  #endif  #endif
562  /**<  Return the unsigned default value of TypeDescription *d. */  /**<  Returns the unsigned default value of TypeDescription *d. */
563  extern double GetRealDefaultF(CONST struct TypeDescription *d,  extern double GetRealDefaultF(CONST struct TypeDescription *d,
564                                CONST char *f, CONST int l);                                CONST char *f, CONST int l);
565  /**<  /**<
  *  <!--  macro GetIntDefault(d)        returns long                         -->  
  *  <!--  macro GetSymDefault(d)        returns symchar *                    -->  
  *  <!--  macro GetBoolDefault(d)       returns unsigned                    -->  
  *  <!--  macro GetRealDefault(d)       returns double                      -->  
  *  <!--  double GetRealDefaultF(d,f,l)                                -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  FILE *f;                                                     -->  
  *  <!--  int l;                                                       -->  
  *  <!--  Return the double default value of an atom.                  -->  
  *  <!--  Given the typedescription, returns the default requested.    -->  
  *  <!--  Not to be confused with RealDefault in another file.         -->  
566   *  Implementation function for GetRealDefault() (debug mode).   *  Implementation function for GetRealDefault() (debug mode).
567   *  Do not call this function directly - use GetRealDefault() instead.   *  Do not call this function directly - use GetRealDefault() instead.
568   */   */
# Line 693  extern double GetRealDefaultF(CONST stru Line 570  extern double GetRealDefaultF(CONST stru
570  extern unsigned GetBoolDefaultF(CONST struct TypeDescription *d,  extern unsigned GetBoolDefaultF(CONST struct TypeDescription *d,
571                                  CONST char *f, CONST int l);                                  CONST char *f, CONST int l);
572  /**<  /**<
  *  <!--  unsigned GetBoolDefaultF(d,f,l)                              -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  FILE *f;                                                     -->  
  *  <!--  int l;                                                       -->  
  *  <!--  Return the integer default value of an atom.                 -->  
  *  <!--  Given the typedescription, returns the default requested.    -->  
  *  <!--  Not to be confused with BooleanDefault in another file.      -->  
573   *  Implementation function for GetBoolDefault() (debug mode).   *  Implementation function for GetBoolDefault() (debug mode).
574   *  Do not call this function directly - use GetBoolDefault() instead.   *  Do not call this function directly - use GetBoolDefault() instead.
575   */   */
576    
577  #define GetConstantDefReal(d)    ((d)->u.constant.u.defreal)  #define GetConstantDefReal(d)    ((d)->u.constant.u.defreal)
578  /**<  Return the double default value of a constant. */  /**<  Returns the double default value of constant TypeDescription *d. */
579  #define GetConstantDefInteger(d) ((d)->u.constant.u.definteger)  #define GetConstantDefInteger(d) ((d)->u.constant.u.definteger)
580  /**<  Return the long default value of a constant. */  /**<  Returns the long default value of constant TypeDescription *d. */
581  #define GetConstantDefBoolean(d) ((d)->u.constant.u.defboolean)  #define GetConstantDefBoolean(d) ((d)->u.constant.u.defboolean)
582  /**<  Return the short default value of a constant. */  /**<  Returns the short default value of constant TypeDescription *d. */
583  #define GetConstantDefSymbol(d)  ((d)->u.constant.u.defsymbol)  #define GetConstantDefSymbol(d)  ((d)->u.constant.u.defsymbol)
584  /**<  Return the symchar* default value of a constant. */  /**<  Returns the symchar* default value of constant TypeDescription *d. */
 /*  
  *  macro GetConstantDefReal(d)  
  *  macro GetConstantDefInteger(d)  
  *  macro GetConstantDefBoolean(d)  
  *  macro GetConstantDefSymbol(d)  
  *  struct TypeDescription *d;  
  *  Return the default value of a constant.  
  */  
585    
586  #ifdef NDEBUG  #ifdef NDEBUG
587  #define GetRealDimens(d) ((d)->u.atom.dimp)  #define GetRealDimens(d) ((d)->u.atom.dimp)
# Line 727  extern unsigned GetBoolDefaultF(CONST st Line 589  extern unsigned GetBoolDefaultF(CONST st
589  #define GetRealDimens(d) GetRealDimensF((d),__FILE__,__LINE__)  #define GetRealDimens(d) GetRealDimensF((d),__FILE__,__LINE__)
590  #endif  #endif
591  /**<  /**<
592   *  Return the dimensions of the atom.   *  Returns the dimensions of the atom.
593   *  If atoms is not numeric, return value is uncertain.   *  If atoms is not numeric, return value is uncertain.
594   *  Will not work on constants.   *  Will not work on constants.
595   *  @param d CONST struct TypeDescription*, the type description to query.   *  @param d CONST struct TypeDescription*, the type description to query.
# Line 737  extern unsigned GetBoolDefaultF(CONST st Line 599  extern unsigned GetBoolDefaultF(CONST st
599  extern CONST dim_type *GetRealDimensF(CONST struct TypeDescription *d,  extern CONST dim_type *GetRealDimensF(CONST struct TypeDescription *d,
600                                        CONST char *f, CONST int l);                                        CONST char *f, CONST int l);
601  /**<  /**<
  *  <!--  macro GetRealDimens(d)                                       -->  
  *  <!--  CONST dim_type *GetRealDimensF(d,f,l);                       -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  FILE *f;                                                     -->  
  *  <!--  int l;                                                       -->  
  *  <!--  Return the dimensions of the atom.                           -->  
  *  <!--  If atoms is not numeric, return value is uncertain.          -->  
  *  <!--  Will not work on constants.                                  -->  
602   *  Implementation function for GetRealDimens() (debug mode).   *  Implementation function for GetRealDimens() (debug mode).
603   *  Do not call this function directly - use GetRealDimens() instead.   *  Do not call this function directly - use GetRealDimens() instead.
604   */   */
# Line 755  extern CONST dim_type *GetRealDimensF(CO Line 609  extern CONST dim_type *GetRealDimensF(CO
609  #define GetConstantDimens(d) GetConstantDimensF((d),__FILE__,__LINE__)  #define GetConstantDimens(d) GetConstantDimensF((d),__FILE__,__LINE__)
610  #endif  #endif
611  /**<  /**<
612   *  Return the dimensions of the constant.   *  Returns the dimensions of the constant.
613   *  All constants have dimensionality. nonreal constants have the   *  All constants have dimensionality. nonreal constants have the
614   *  dim for DIMENSIONLESS. nonconstants and unassigned real constants   *  dim for DIMENSIONLESS. nonconstants and unassigned real constants
615   *  will return WildDimension().   *  will return WildDimension().
# Line 766  extern CONST dim_type *GetRealDimensF(CO Line 620  extern CONST dim_type *GetRealDimensF(CO
620  extern CONST dim_type *GetConstantDimensF(CONST struct TypeDescription *d,  extern CONST dim_type *GetConstantDimensF(CONST struct TypeDescription *d,
621                                            CONST char *f, CONST int l);                                            CONST char *f, CONST int l);
622  /**<  /**<
  *  <!--  macro GetConstantDimens(d)                                   -->  
  *  <!--  CONST dim_type *GetConstantDimensF(d,f,l);                   -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  FILE *f;                                                     -->  
  *  <!--  int l;                                                       -->  
  *  <!--  Return the dimensions of the constant.                       -->  
  *  <!--  All constants have dimensionality. nonreal constants have the -->  
  *  <!--  dim for DIMENSIONLESS. nonconstants and unassigned real constants -->  
  *  <!--  will return WildDimension().                                 -->  
623   *  Implementation function for GetConstantDimens() (debug mode).   *  Implementation function for GetConstantDimens() (debug mode).
624   *  Do not call this function directly - use GetConstantDimens() instead.   *  Do not call this function directly - use GetConstantDimens() instead.
625   */   */
# Line 785  extern CONST dim_type *GetConstantDimens Line 630  extern CONST dim_type *GetConstantDimens
630  #define GetName(d) GetNameF(d)  #define GetName(d) GetNameF(d)
631  #endif  #endif
632  /**<  /**<
633   *  Return the name of the type that this structure defines.   *  Returns the name of the type that this structure defines.
634   *  @param d CONST struct TypeDescription*, the type description to query.   *  @param d CONST struct TypeDescription*, the type description to query.
635   *  @return The name as a symchar*.   *  @return The name as a symchar*.
636   *  @see GetNameF()   *  @see GetNameF()
637   */   */
638  extern symchar *GetNameF(CONST struct TypeDescription *d);  extern symchar *GetNameF(CONST struct TypeDescription *d);
639  /**<  /**<
  *  <!--  macro GetName(d)                                             -->  
  *  <!--  const char *GetNameF(d)                                      -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Return the name of the type that this structure defines.     -->  
640   *  Implementation function for GetName() (debug mode).   *  Implementation function for GetName() (debug mode).
641   *  Do not call this function directly - use GetName() instead.   *  Do not call this function directly - use GetName() instead.
642   */   */
643    
644  #define GetParseId(d) ((d)->parseid)  #define GetParseId(d) ((d)->parseid)
645  /**<  /**<
646   *  <!--  macro GetParseId(d)                                          -->   *  Returns the parseid of type d.
647   *  <!--  struct TypeDescription *d;                                   -->   *
648   *  Return the parseid of d.   *  @param d The type to query (TypeDescription *).
649     *  @return The parseid of d as a long int.
650   */   */
651    
652  #define GetRefinement(d) ((d)->refines)  #define GetRefinement(d) ((d)->refines)
653  /**<  /**<
654   *  <!--  macro GetRefinement(d)                                       -->   *  Returns the refinement of type d, or NULL if none.
655   *  <!--  struct TypeDescription *d;                                   -->   *
656   *  Return the refinement TypeDescription or NULL.   *  @param d The type to query (TypeDescription *).
657     *  @return The refinement of d as a TypeDescription *.
658   */   */
659    
660  #define GetRefiners(d) ((d)->refiners)  #define GetRefiners(d) ((d)->refiners)
661  /**<  /**<
662   *  <!--  macro GetRefiners(d)                                         -->   *  Returns a list of refiners of type d, or NULL if none.
663   *  <!--  struct TypeDescription *d;                                   -->   *
664   *  Return the refiners gl_list of struct TypeDescription * or NULL.   *  @param d The type to query (TypeDescription *).
665     *  @return The refiners of d as a gl_list of TypeDescription *.
666   */   */
667    
668  extern struct gl_list_t *GetAncestorNames(CONST struct TypeDescription *d);  extern struct gl_list_t *GetAncestorNames(CONST struct TypeDescription *d);
669  /**<  /**<
  *  <!--  names = GetAncestorsNames(d);                                -->  
  *  <!--  struct gl_list_t *names;                                     -->  
670   *  Return the names of ancestors of type d given.   *  Return the names of ancestors of type d given.
671   *  If none, list may be empty. The list is of   *  If none, list may be empty. The list is of symchar *.
672   *  symchar *. The caller should destroy the list but not   *  The caller should destroy the list but not its contents.
673   *  its content.   *
674     *  @param d The type to query.
675     *  @return Pointer to a gl_list_t containing the names of the ancestors of d.
676   */   */
677    
678  #define GetModelParameterList(d) ((d)->u.modarg.declarations)  #define GetModelParameterList(d) ((d)->u.modarg.declarations)
679  /**<  /**<
  *  <!--  macro GetModelParameterList(d)                               -->  
  *  <!--  struct TypeDescription *d;                                   -->  
680   *  Return the statements (forward declarations that constitute the   *  Return the statements (forward declarations that constitute the
681   *  parameter list for d. The statement list returned will contain   *  parameter list for d. The statement list returned will contain
682   *  willbes (possibly with value), and isas.   *  willbes (possibly with value), and isas.
683   *  Any attempt to use the type d in a RHS must fill in all the   *  Any attempt to use the type d in a RHS must fill in all the
684   *  statements on this list with appropriate instances.   *  statements on this list with appropriate instances.
685     *
686     *  @param d The type to query (TypeDescription *).
687     *  @return The parameter list of d as a struct StatementList *.
688   */   */
689    
690  #define GetModelParameterCount(d) ((d)->u.modarg.argcnt)  #define GetModelParameterCount(d) ((d)->u.modarg.argcnt)
691  /**<  /**<
692   *  <!--  macro GetModelParameterCount(d)                              -->   *  Returns the number of arguments required when IS_A'ing a MODEL type.
  *  <!--  n =  GetModelParameterCount(d);                              -->  
  *  <!--  struct TypeDescription *d;                                   -->  
  *  <!--  unsigned int n;                                              -->  
  *  Return the number of arguments required when IS_A'ing a MODEL type.  
693   *  Any attempt to use the type d in a RHS must fill in this many slots.   *  Any attempt to use the type d in a RHS must fill in this many slots.
694     *
695     *  @param d The type to query (TypeDescription *).
696     *  @return The count as an unsigned int.
697   */   */
698    
699  #define GetModelAbsorbedParameters(d) ((d)->u.modarg.absorbed)  #define GetModelAbsorbedParameters(d) ((d)->u.modarg.absorbed)
700  /**<  /**<
  *  <!--  macro GetModelAbsorbedParameters(d)                          -->  
  *  <!--  struct TypeDescription *d;                                   -->  
701   *  Return the list of ISAs and CASGNs that absorbed them.   *  Return the list of ISAs and CASGNs that absorbed them.
702   *  May return NULL;   *  May return NULL.
703     *
704     *  @param d The type to query (TypeDescription *).
705     *  @return The list as a struct StatementList *.
706   */   */
707    
708  #define GetModelParameterReductions(d) ((d)->u.modarg.reductions)  #define GetModelParameterReductions(d) ((d)->u.modarg.reductions)
709  /**<  /**<
  *  <!--  macro GetModelParameterReductions(d)                         -->  
  *  <!--  struct TypeDescription *d;                                   -->  
710   *  Return the list of statements that absorb parameter isas in the   *  Return the list of statements that absorb parameter isas in the
711   *  statement of this MODEL. Used for display purposes primarily.   *  statement of this MODEL. Used for display purposes primarily.
712     *
713     *  @param d The type to query (TypeDescription *).
714     *  @return The list as a struct StatementList *.
715   */   */
716    
717  #define GetModelParameterWheres(d) ((d)->u.modarg.wheres)  #define GetModelParameterWheres(d) ((d)->u.modarg.wheres)
718  /**<  /**<
  *  <!--  macro GetModelParameterWheres(d)                             -->  
  *  <!--  struct TypeDescription *d;                                   -->  
719   *  Return the list of statements that restrict the structure of   *  Return the list of statements that restrict the structure of
720   *  WILL_BE passed arguments in this MODEL.   *  WILL_BE passed arguments in this MODEL.
721   *  Used for instantiation-time checks.   *  Used for instantiation-time checks.
722     *
723     *  @param d The type to query (TypeDescription *).
724     *  @return The list as a struct StatementList *.
725   */   */
726    
727  #define GetModelParameterValues(d) ((d)->u.modarg.argdata)  #define GetModelParameterValues(d) ((d)->u.modarg.argdata)
728  /**<  /**<
729   *  <!--  macro GetModelParameterValues(d)                             -->   *  NOT IMPLEMENTED.
730   *  <!--  struct gl_list_t *ad;                                        -->   *  Returns the list of values that match the ParameterLists.
  *  Return the list of values that match the ParameterLists.  
731   *  Possibly this is a redundancy.   *  Possibly this is a redundancy.
732   *  NOT IMPLEMENTED   *
733     *  @param d The type to query (TypeDescription *).
734     *  @return The list as a gl_list_t *.
735   */   */
736    
737  #define GetArrayBaseType(d) ((d)->u.array.desc)  #define GetArrayBaseType(d) ((d)->u.array.desc)
738  /**<  /**<
739   *  <!--  macro GetArrayBaseType(d)                                    -->   *  Returns the base type of the array type description.
740   *  <!--  struct TypeDescription *d;                                   -->   *
741   *  Return the base type of the array type description.   *  @param d The type to query (TypeDescription *).
742     *  @return The base type as a TypeDescription *.
743   */   */
744    
745  #define GetArrayBaseIsRelation(d) ((d)->u.array.isrelation)  #define GetArrayBaseIsRelation(d) ((d)->u.array.isrelation)
746  /**<  /**<
747   *  <!--  macro GetArrayBaseIsRelation(d)                              -->   *  Returns TRUE if the array is an array of relations.
748   *  <!--  struct TypeDescription *d;                                   -->   *
749   *  Return TRUE if the array is an array of relations.   *  @param d The type to query (TypeDescription *).
750     *  @return An int indicating whether d is an array of relations.
751   */   */
752    
753  #define GetArrayBaseIsLogRel(d) ((d)->u.array.islogrel)  #define GetArrayBaseIsLogRel(d) ((d)->u.array.islogrel)
754  /**<  /**<
755   *  <!--  macro GetArrayBaseIsLogRel(d)                                -->   *  Returns TRUE if the array is an array of logical relations.
756   *  <!--  struct TypeDescription *d;                                   -->   *
757   *  Return TRUE if the array is an array of logical relations.   *  @param d The type to query (TypeDescription *).
758     *  @return An int indicating whether d is an array of logical relations.
759   */   */
760    
761  #define GetArrayBaseIsWhen(d) ((d)->u.array.iswhen)  #define GetArrayBaseIsWhen(d) ((d)->u.array.iswhen)
762  /**<  /**<
763   *  <!--  macro GetArrayBaseIsWhen(d)                                  -->   *  Returns TRUE if the array is an array of WHEN's.
764   *  <!--  struct TypeDescription *d;                                   -->   *
765   *  Return TRUE if the array is an array of WHEN's.   *  @param d The type to query (TypeDescription *).
766     *  @return An int indicating whether d is an array of WHENs.
767   */   */
768    
769  #define GetArrayBaseIsInt(d) ((d)->u.array.isintset)  #define GetArrayBaseIsInt(d) ((d)->u.array.isintset)
770  /**<  /**<
771   *  <!--  macro GetArrayBaseIsInt(d)                                   -->   *  Returns TRUE if the array is a set.
772   *  <!--  struct TypeDescription *d;                                   -->   *  This is only meaningful when the base type is a refinement of
773   *  This is only meaningful when the base type is a refinement of set,   *  set, but it is always available.  Its value is inconsequential
774   *  but it is always available.  Its value is inconsequential when the   *  when the base type is not a set.
775   *  base type is not a set.   *
776     *  @param d The type to query (TypeDescription *).
777     *  @return An int indicating whether d is a set.
778   */   */
779    
780  #define GetArrayIndexList(d) ((d)->u.array.indices)  #define GetArrayIndexList(d) ((d)->u.array.indices)
781    /**<
782     *  Returns a list of the indices of an array.
783     *
784     *  @param d The type to query (TypeDescription *).
785     *  @return A l_list_t * containing the indices of d.
786     */
787    
788  #define GetModule(d) ((d)->mod)  #define GetModule(d) ((d)->mod)
789    /**<
790     *  Returns the module in which type d is defined.
791     *
792     *  @param d The type to query (TypeDescription *).
793     *  @return The module associated with d as a module_t *.
794     */
795    
796  #define GetPatchOriginal(d)  ((d)->refines)  #define GetPatchOriginal(d)  ((d)->refines)
797  /**<  /**<
798   *  <!--  macro GetPatchOriginal(d)                                    -->   *  Returns the original type of the TypeDescription being patched.
799   *  <!--  struct TypeDescription *d;                                   -->   *  NULL must be treated as an error, as a patch is meaningless without
800   *  Return the original type of the TypeDescription being patched. NULL   *  the original type. Internally it uses the same slot as refines.
801   *  must be treated as an error, as a patch is meaningless without the   *
802   *  original type. Internally it uses the same slot as refines.   *  @param d The type to query (TypeDescription *).
803     *  @return The original type of d as a TypeDescription *.
804   */   */
805    
806  extern struct IndexType *CreateIndexType(struct Set *set, int int_index);  extern struct IndexType *CreateIndexType(struct Set *set, int int_index);
807  /**<  /**<
808   *  <!--  struct IndexType *CreateIndexType(set,int_index)             -->   *  Creates an IndexType. The set becomes the property of the index.
809   *  <!--  struct Set *set;                                             -->   *
810   *  <!--  int int_index;                                               -->   *  @param set The set to use for the new IndexType.
811   *  Create a IndexType. The set is the property of the index.   *  @param int_index Flag for whether set is enumerated (0) or int (non-zero).
812     *  @return The new IndexType.
813   */   */
814    
815  extern struct IndexType *CreateDummyIndexType(int int_index);  extern struct IndexType *CreateDummyIndexType(int int_index);
816  /**<  /**<
817   *  <!--  struct IndexType *CreateDummyIndexType(int_index)            -->   *  Returns the dummy IndexType for int (int_index != 0) or for enum
818   *  Returns the dummy IndexType for int if int_index!=0   *  (int_index == 0).  There is exactly one of each and you should not
819   *  or for enum if int_index==0.   *  do anything with it except destroy it.
820   *  There is exactly one of each and you should not do anything with it   *
821   *  except destroy it.   *  @param int_index Flag for whether to return dummy for enum (0)
822     *                   or int (non-zero).
823     *  @return The dummy IndexType of the specified kind.
824   */   */
825    
826  extern struct IndexType *CreateIndexTypeFromStr(char *str, int int_index);  extern struct IndexType *CreateIndexTypeFromStr(char *str, int int_index);
827  /**<  /**<
828   *  <!--  struct IndexType *CreateIndexType(str,int_index)             -->   *  Creates an IndexType from a string. We do NOT keep the
  *  <!--  symchar *str;                                                -->  
  *  <!--  int int_index;                                               -->  
  *  Create a IndexType from a string. We do NOT keep the  
829   *  string given; we keep the symbol table's version of the string.   *  string given; we keep the symbol table's version of the string.
830   *  This operator is exceedingly redundant and should not be used.   *  This operator is exceedingly redundant and should not be used.
831     *
832     *  @param str The string to use to create the new IndexType.
833     *  @param int_index Flag for whether the set is enumerated (0) or int (non-zero).
834     *  @return The new IndexType.
835   */   */
836    
837  extern void DestroyIndexType(struct IndexType *ind);  extern void DestroyIndexType(struct IndexType *ind);
838  /**<  /**<
839   *  <!--  void DestroyIndexType(ind)                                   -->   *  Deallocates this structure and its internals.  The string is
840   *  <!--  struct IndexType *ind;                                       -->   *  assumed NOT to belong to the main symbol table, and thus freed.
841   *  Deallocate this structure and its internals. The string is assumed   *
842   *  NOT to belong to the main symbol table, and thus freed.   *  @param ind The IndexType to destroy.
843   */   */
844    
845  #define GetIndexType(p) ((p)->int_index)  #define GetIndexType(p) ((p)->int_index)
846    /**<
847     *  Returns the kind flag for IndexType *p.
848     *
849     *  @param p The type to query (IndexType *).
850     *  @return The kind flag for p as an unsigned (0 => enum, 1 => int).
851     */
852    
853  #define GetIndexSet(p) ((p)->set)  #define GetIndexSet(p) ((p)->set)
854  /**< Note this may return NULL in odd circumstances. */  /**<
855     *  Returns the set associated with IndexType *p.
856     *  Note this may return NULL in odd circumstances.
857     *
858     *  @param p The type to query (IndexType *).
859     *  @return The set associated with p as a Set *.
860     */
861    
862  #define GetIndexSetStr(p) ((p)->sptr)  #define GetIndexSetStr(p) ((p)->sptr)
863  /**< Note this may return NULL in odd circumstances. */  /**<
864     *  Returns the string associated with IndexType *p.
865     *  Note this may return NULL in odd circumstances.
866     *
867     *  @param p The type to query (IndexType *).
868     *  @return The set string associated with p as a symchar *.
869     */
870    
871  extern struct TypeDescription  extern struct TypeDescription
872  *CreateModelTypeDesc(symchar *name,  *CreateModelTypeDesc(symchar *name,
# Line 992  extern struct TypeDescription Line 881  extern struct TypeDescription
881                       struct StatementList *tsl,                       struct StatementList *tsl,
882                       struct StatementList *vsl);                       struct StatementList *vsl);
883  /**<  /**<
884   *  <!--  struct TypeDescription *CreateModelTypeDesc(name,rdesc,mod,cl,pl,sl,univ, -->   *  Creates a Model TypeDescription structure with the parameters given.  
885   *  <!--                                              psl,rsl,tsl,wsl)              -->   *  sl, psl, rsl, wsl should NEVER be NULL, though they may be empty lists.  
886   *   *  tsl may be NULL.
  *  <!--  symchar *name;            name of the type                            -->  
  *  <!--  struct TypeDescription *rdesc;    type that it refines or NULL  -->  
  *  <!--  struct module_t *mod;     module it is defined in               -->  
  *  <!--  ChildListPtr cl;      list of the type's child names             -->  
  *  <!--  struct gl_list_t *pl;     list of initialization procedures     -->  
  *  <!--  struct StatementList *sl; list of declarative statements     -->  
  *  <!--  int univ;         TRUE universal FALSE non-universal               -->  
  *  <!--  struct StatementList *psl;    list of parameter statements      -->  
  *  <!--  struct StatementList *rsl;    list of parameter reducing statements    -->  
  *  <!--  struct StatementList *tsl;    list of reduced statements        -->  
  *  <!--  struct StatementList *wsl;    list of parameter constraint statements. -->  
  *  Create a Model TypeDescription structure with the parameters given.  
  *  sl, psl, rsl, wsl should NEVER be NULL, though they may be the  
  *  empty list. tsl may be NULL.  
887   *   *
888   *  @param name   Name of the type.   *  @param name   Name of the type.
889   *  @param rdesc  Type that it refines or NULL.   *  @param rdesc  Type that it refines or NULL.
# Line 1021  extern struct TypeDescription Line 896  extern struct TypeDescription
896   *  @param rsl    List of parameter reducing statements.   *  @param rsl    List of parameter reducing statements.
897   *  @param tsl    List of reduced statements.   *  @param tsl    List of reduced statements.
898   *  @param vsl    List of parameter constraint statements.   *  @param vsl    List of parameter constraint statements.
899     *  @return A pointer to the new TypeDescription structure.
900   */   */
901    
902  extern struct TypeDescription *CreateDummyTypeDesc(symchar *name);  extern struct TypeDescription *CreateDummyTypeDesc(symchar *name);
903  /**<  /**<
904   *  <!--  struct TypeDescription *CreateDummyTypeDesc(name)            -->   *  Creates the universal dummy type for unselected instances.
905   *  <!--  symchar *name;            name of the type                            -->   *
906   *  Create the universal dummy type for unselected instances.   *  @param name The name for the dummy type.
907     *  @return A pointer to the new dummy TypeDescription structure.
908   */   */
909    
910  extern struct TypeDescription  extern struct TypeDescription
# Line 1043  extern struct TypeDescription Line 920  extern struct TypeDescription
920                          symchar *sval,                          symchar *sval,
921                          int univ);                          int univ);
922  /**<  /**<
  *  <!--  struct TypeDescription *CreateConstantTypeDesc              -->  
  *  <!--           (name,t,rdesc,mod,bytesize,defaulted,rval,dim,ival,sval,univ) -->  
  *  <!--  symchar *name;            name of type                                -->  
  *  <!--  enum type_kind t;     base type of Const(real_constant_type,etc)-->  
  *  <!--  struct TypeDescription *rdesc;    type description what it refines -->  
  *  <!--  struct module_t *mod;     module where the type is defined      -->  
  *  <!--  unsigned long bytesize;       size of an instance in bytes.       -->  
  *  <!--  int defaulted;            TRUE indicates default value was assigned.  -->  
  *  <!--  double rval;          default value for real atoms                  -->  
  *  <!--  const dim_type *dim;      dimensions of default value            -->  
  *  <!--  long ival;            default value for int/bool constants            -->  
  *  <!--  symchar *sval;            default value for symbol constants          -->  
  *  <!--  int univ;         TRUE universal FALSE non-universal               -->  
923   *  Create a Constant TypeDescription structure with the parameters given.   *  Create a Constant TypeDescription structure with the parameters given.
924     *
925   *  @param name         Name of type.   *  @param name         Name of type.
926   *  @param t            Base type of Const(real_constant_type,etc).   *  @param t            Base type of Const(real_constant_type,etc).
927   *  @param rdesc        Type description what it refines.   *  @param rdesc        Type description what it refines.
# Line 1068  extern struct TypeDescription Line 933  extern struct TypeDescription
933   *  @param ival         Default value for int/bool constants.   *  @param ival         Default value for int/bool constants.
934   *  @param sval         Default value for symbol constants.   *  @param sval         Default value for symbol constants.
935   *  @param univ         TRUE universal FALSE non-universal.   *  @param univ         TRUE universal FALSE non-universal.
936     *  @return A pointer to the new TypeDescription structure.
937   */   */
938    
939  extern struct TypeDescription  extern struct TypeDescription
# Line 1087  extern struct TypeDescription Line 953  extern struct TypeDescription
953                      long ival,                      long ival,
954                      symchar *sval);                      symchar *sval);
955  /**<  /**<
956   *  <!--  struct TypeDescription *                                     -->   *  Creates an Atom TypeDescription structure with the parameters given.
957   *  <!--  CreateAtomTypeDesc(name,t,rdesc,mod,childl,procl,statl,      -->   *
958   *  <!--                     bytesize,childd,defaulted,                -->   *  @param name       Name of type.
959   *  <!--                     dval,ddim,univ,ival,sval)                 -->   *  @param t          Base type of atom (real_type, boolean_type, etc.)
  *  <!--  symchar *name;                      name of type             -->  
  *  <!--  enum type_kind t;                   base type of atom(real_type,           -->  
  *  <!--                                                        boolean-->_type,etc) -->  
  *  <!--  struct TypeDescription *rdesc;      type description what it refines       -->  
  *  <!--  struct module_t *mod;               module where the type is defined       -->  
  *  <!--  ChildListPtr childl;                list of children names                 -->  
  *  <!--  struct gl_list_t *procl;            list of initialization procedures      -->  
  *  <!--  struct StatementList *statl;        list of declarative statements         -->  
  *  <!--  unsigned long bytesize;             size of an instance in bytes.          -->  
  *  <!--  struct ChildDesc *childd;           description of the atom's children     -->  
  *  <!--  int defaulted;                      valid only for real atoms              -->  
  *  <!--                                      TRUE indicates default value assigned  -->  
  *  <!--  double dval;                        default value for real atoms           -->  
  *  <!--  const dim_type *ddim;               dimensions of default value            -->  
  *  <!--  int univ;                           TRUE universal FALSE non-universal     -->  
  *  <!--  long ival;                          defalut value for integer/boolean atoms -->  
  *  <!--  symchar *sval;                      default value for symbol atoms.        -->  
  *  Create an Atom TypeDescription structure with the parameters given.  
  *  @param name;                      name of type  
  *  @param t;                   base type of atom(real_type,  
  *                                                        boolean_type,etc)  
960   *  @param rdesc      Type description what it refines.   *  @param rdesc      Type description what it refines.
961   *  @param mod        Module where the type is defined.   *  @param mod        Module where the type is defined.
962   *  @param childl     List of children names.   *  @param childl     List of children names.
# Line 1125  extern struct TypeDescription Line 970  extern struct TypeDescription
970   *  @param univ       TRUE universal FALSE non-universal.   *  @param univ       TRUE universal FALSE non-universal.
971   *  @param ival       Defalut value for integer/boolean atoms.   *  @param ival       Defalut value for integer/boolean atoms.
972   *  @param sval       Default value for symbol atoms.   *  @param sval       Default value for symbol atoms.
973     *  @return A pointer to the new TypeDescription structure.
974   */   */
975    
976  extern struct TypeDescription  extern struct TypeDescription
# Line 1135  extern struct TypeDescription Line 981  extern struct TypeDescription
981                          unsigned long bytesize,                          unsigned long bytesize,
982                          struct ChildDesc *childd);                          struct ChildDesc *childd);
983  /**<  /**<
984   *  <!--  struct TypeDescription *                                     -->   *  Creates a Relation TypeDescription structure with the parameters given.
985   *  <!--  CreateRelationTypeDesc(mod,clist,plist,statl,bytesize,childd)-->   *
986   *  <!--  struct module_t *mod;     the module where it is define         -->   *  @param mod        The module where it is definde.
  *  <!--  ChildListPtr clist;               the list of children names      -->  
  *  <!--  struct gl_list_t *plist;          the list of initialization procedures  -->  
  *  <!--  struct StatementList *statl;  the list of declarative statements         -->  
  *  <!--  unsigned long bytesize;       the byte length                                -->  
  *  <!--  struct ChildDesc *childd;         the description of the children        -->  
  *  Create a Relation TypeDescription structure with the parameters given.  
  *  @param mod        The module where it is define.  
987   *  @param clist      The list of children names.   *  @param clist      The list of children names.
988   *  @param plist      The list of initialization procedures.   *  @param plist      The list of initialization procedures.
989   *  @param statl      The list of declarative statements.   *  @param statl      The list of declarative statements.
990   *  @param bytesize   The byte length.   *  @param bytesize   The byte length.
991   *  @param childd     The description of the children.   *  @param childd     The description of the children.
992     *  @return A pointer to the new TypeDescription structure.
993   */   */
994    
995  extern struct TypeDescription  extern struct TypeDescription
# Line 1160  extern struct TypeDescription Line 1000  extern struct TypeDescription
1000                        unsigned long bytesize,                        unsigned long bytesize,
1001                        struct ChildDesc *childd);                        struct ChildDesc *childd);
1002  /**<  /**<
1003   *  <!--  struct TypeDescription *                                     -->   *  Creates a Logical Relation TypeDescription structure with the parameters given.
1004   *  <!--  CreateLogRelTypeDesc(mod,clist,plist,statl,bytesize,childd)  -->   *
1005   *  <!--  struct module_t *mod;     the module where it is defined        -->   *  @param mod        The module where it is defined.
  *  <!--  ChildListPtr clist;               the list of children names      -->  
  *  <!--  struct gl_list_t *plist;          the list of initialization procedures -->  
  *  <!--  struct StatementList *statl;  the list of declarative statements        -->  
  *  <!--  unsigned long bytesize;       the byte length                               -->  
  *  <!--  struct ChildDesc *childd;         the description of the children       -->  
  *  Create a Logical Relation TypeDescription structure with the parameters given.  
  *  @param mod        The module where it is define.  
1006   *  @param clist      The list of children names.   *  @param clist      The list of children names.
1007   *  @param plist      The list of initialization procedures.   *  @param plist      The list of initialization procedures.
1008   *  @param statl      The list of declarative statements.   *  @param statl      The list of declarative statements.
1009   *  @param bytesize   The byte length.   *  @param bytesize   The byte length.
1010   *  @param childd     The description of the children.   *  @param childd     The description of the children.
1011     *  @return A pointer to the new TypeDescription structure.
1012   */   */
1013    
1014  extern struct TypeDescription  extern struct TypeDescription
# Line 1182  extern struct TypeDescription Line 1016  extern struct TypeDescription
1016                      struct gl_list_t *pl,                      struct gl_list_t *pl,
1017                      struct StatementList *sl);                      struct StatementList *sl);
1018  /**<  /**<
1019   *  <!--  struct TypeDescription *CreateWhenTypeDesc(mod,pl,sl)        -->   *  Creates a When TypeDescription structure with the parameters given.
1020   *   *
  *  <!--  struct module_t *mod;     the module where it is defined        -->  
  *  <!--  struct gl_list_t *plist;          the list of initialization procedures -->  
  *  <!--  struct StatementList *statl;  the list of declarative statements        -->  
  *  Create a When TypeDescription structure with the parameters given.  
1021   *  @param mod The module where it is defined.   *  @param mod The module where it is defined.
1022   *  @param pl  The list of initialization procedures.   *  @param pl  The list of initialization procedures.
1023   *  @param sl  The list of declarative statements.   *  @param sl  The list of declarative statements.
1024     *  @return A pointer to the new TypeDescription structure.
1025   */   */
1026    
1027  extern struct TypeDescription  extern struct TypeDescription
# Line 1202  extern struct TypeDescription Line 1033  extern struct TypeDescription
1033                       int iswhen,                       int iswhen,
1034                       struct gl_list_t *indices);                       struct gl_list_t *indices);
1035  /**<  /**<
1036   *  <!--  struct TypeDescription *CreateArrayTypeDesc(mod,desc,isintset,isrel, -->   *  Creates an Array TypeDescription structure with the parameters given.
1037   *                                             <!--  islogrel,iswhen,indices)  -->   *
  *  <!--  struct module_t *mod;                                        -->  
  *  <!--  struct TypeDescription *desc;                                -->  
  *  <!--  int isint;                                                   -->  
  *  <!--  int isrel;                                                   -->  
  *  <!--  int islogrel;                                                -->  
  *  <!--  int iswhen;                                                  -->  
  *  <!--  struct gl_list_t *indices;                                   -->  
  *  <!--  Parameters                                                   -->  
  *  <!--  mod   the module of the statement where the array is instanced -->  
  *  <!--  desc  the type description of the base type                   -->  
  *  <!--  isint used only when "desc" is a refinement of set.          -->  
  *  <!--  isrel TRUE only when it is an array of relations.            -->  
  *  <!--  islogrel  TRUE only when it is an array of logical relations. -->  
  *  <!--  iswhen  TRUE only when it is an array of WHEN's.             -->  
  *  <!--  indices   a list of IndexType's this describes each array index -->  
  *  Create an Array TypeDescription structure with the parameters given.  
1038   *  @param mod      The module of the statement where the array is instanced.   *  @param mod      The module of the statement where the array is instanced.
1039   *  @param desc     The type description of the base type.   *  @param desc     The type description of the base type.
1040   *  @param isintset Used only when "desc" is a refinement of set.   *  @param isintset Used only when "desc" is a refinement of set.
# Line 1227  extern struct TypeDescription Line 1042  extern struct TypeDescription
1042   *  @param islogrel TRUE only when it is an array of logical relations.   *  @param islogrel TRUE only when it is an array of logical relations.
1043   *  @param iswhen   TRUE only when it is an array of WHEN's.   *  @param iswhen   TRUE only when it is an array of WHEN's.
1044   *  @param indices  A list of IndexType's this describes each array index.   *  @param indices  A list of IndexType's this describes each array index.
1045     *  @return A pointer to the new TypeDescription structure.
1046   */   */
1047    
1048  /*  Patches  */  /*  Patches  */
# Line 1238  extern struct TypeDescription Line 1054  extern struct TypeDescription
1054                       struct gl_list_t *pl,                       struct gl_list_t *pl,
1055                       struct StatementList *sl);                       struct StatementList *sl);
1056  /**<  /**<
1057   *  <!--  struct TypeDescripion *CreatePatchTypeDesc(name,rdesc,mod,pl,-->sl);   *  Creates a Patch TypeDescription structure with the parameters given.
  *  <!--  symchar *name;                                               -->  
  *  <!--  struct TypeDescription *rdesc;                               -->  
  *  <!--  struct module_t *mod;                                        -->  
  *  <!--  struct StatementList *sl;                                    -->  
  *  
  *  <!--  Paramters:                                                   -->  
  *        <!--  name    the name of the patch.                            -->  
  *        <!--  rdesc   the type description of the type being patched   -->  
  *        <!--  mod the module that the patch was defined in           -->  
  *        <!--  pl  list of procedural statements                       -->  
  *        <!--  sl  list of declarative statements                      -->  
  *  Create a Patch TypeDescription structure with the parameters given.  
1058   *   *
1059   *  Patches are constructs which are not strictly part of the main   *  Patches are constructs which are not strictly part of the main
1060   *  language. They have been developed to enable automatic generation   *  language. They have been developed to enable automatic generation
# Line 1270  extern struct TypeDescription Line 1074  extern struct TypeDescription
1074   *  @param mod    The module that the patch was defined in.   *  @param mod    The module that the patch was defined in.
1075   *  @param pl     List of procedural statements.   *  @param pl     List of procedural statements.
1076   *  @param sl     List of declarative statements.   *  @param sl     List of declarative statements.
1077     *  @return A pointer to the new TypeDescription structure.
1078   */   */
1079    
1080  extern struct TypeDescription  extern struct TypeDescription *MoreRefined(CONST struct TypeDescription *desc1,
1081  *MoreRefined(CONST struct TypeDescription *desc1, CONST struct TypeDescription *desc2);                                             CONST struct TypeDescription *desc2);
1082  /**<  /**<
1083   *  <!--  struct TypeDescription *MoreRefined(desc1,desc2)             -->   *  Returns the more refined of desc1 or desc2, or
1084   *  <!--  CONST struct TypeDescription *desc1,*desc2;                  -->   *  NULL if they are unconformable.
  *  Return the more refined of desc1 or desc2.  Return NULL if they are  
  *  unconformable.  
1085   */   */
1086    
1087  extern CONST struct TypeDescription  extern CONST struct TypeDescription
1088  *GreatestCommonAncestor(CONST struct TypeDescription *desc1,  *GreatestCommonAncestor(CONST struct TypeDescription *desc1,
1089                          CONST struct TypeDescription *desc2);                          CONST struct TypeDescription *desc2);
1090  /**<  /**<
1091   *  <!--  struct TypeDescription *GreatestCommonAncestor(desc1,desc2)  -->   *  Returns the most refined common ancestor type of desc1,desc2.
  *  <!--  CONST struct TypeDescription *desc1,*desc2;                  -->  
  *  Return the most refined common ancestor type of desc1,desc2.  
1092   *  If either of desc1 or desc2 directly REFINES the other, then   *  If either of desc1 or desc2 directly REFINES the other, then
1093   *  the return value will be the less refined of the two types.   *  the return value will be the less refined of the two types.
1094   *  Returns NULL if unconformable.<br><br>   *  Returns NULL if unconformable.<br><br>
1095   *   *
1096   *  Due to malloc/free calls, this is not the cheapest call to make.   *  Due to malloc/free calls, this is not the cheapest call to make.
1097   *  If you need it for a time critical test, then you need to   *  If you need it for a time critical test, then you need to redo
1098   *  redo the implementation of internal functions Create/DestroyAncestor   *  the implementation of internal functions Create/DestroyAncestor
1099   *  to reuse memory.   *  to reuse memory.
1100   */   */
1101    
1102  extern int TypesAreEquivalent(CONST struct TypeDescription *desc1,  extern int TypesAreEquivalent(CONST struct TypeDescription *desc1,
1103                                CONST struct TypeDescription *desc2);                                CONST struct TypeDescription *desc2);
1104  /**<  /**<
1105   * Returns 1 if types appear to be equivalent semantically.   *  Returns 1 if types appear to be equivalent semantically.
1106   * This means comparing statment lists, methods, and so forth.   *  This means comparing statment lists, methods, and so forth.
1107   * Uses, among others, CompareStatementLists CompareStatement,   *  Uses, among others, CompareStatementLists CompareStatement,
1108   * and CompareProcedureLists, which is broken in a FALSE negative way.   *  and CompareProcedureLists, which is broken in a FALSE negative way.
1109   * Array and patch types are never equivalent.   *  Array and patch types are never equivalent.
1110   */   */
1111    
1112  extern void DifferentVersionCheck(CONST struct TypeDescription *desc1,  extern void DifferentVersionCheck(CONST struct TypeDescription *desc1,
1113                                    CONST struct TypeDescription *desc2);                                    CONST struct TypeDescription *desc2);
1114  /**<  /**<
1115   *  <!--  void DifferentVersionCheck(desc1,desc2)                      -->   *  Checks that desc1 and desc2 are unconformable.
  *  <!--  const struct TypeDescription *desc1, *desc2;                 -->  
1116   *  It is assumed that desc1 and desc2 are unconformable.  This routine   *  It is assumed that desc1 and desc2 are unconformable.  This routine
1117   *  tries to check if they are unconformable because of different versions   *  tries to check if they are unconformable because of different versions
1118   *  of the types in their type hierarchy.  This can happen if one of these   *  of the types in their type hierarchy.  This can happen if one of these
# Line 1323  extern void DifferentVersionCheck(CONST Line 1123  extern void DifferentVersionCheck(CONST
1123    
1124  extern struct TypeDescription *GetStatTypeDesc(CONST struct Statement *s);  extern struct TypeDescription *GetStatTypeDesc(CONST struct Statement *s);
1125  /**<  /**<
1126   *  <!--  struct TypeDescription *GetStatTypeDesc(s)                   -->   *  Returns the type field of an IS_A, WILL_BE, or IS_REFINED_TO statement
1127   *  <!--  const struct Statement *s;                                   -->   *  converted into a TypeDescription.  Note that in some cases the result
1128   *  Return the type field of an IS_A, WILL_BE, or IS_REFINED_TO statement   *  may be NULL -- and the user should check.  sets and arrays do not
  *  converted into a TypeDescription. Note that in some cases the result  
  *  may be NULL -- and the user should check. sets and arrays do not  
1129   *  return a proper type this way -- if you consider proper to be an   *  return a proper type this way -- if you consider proper to be an
1130   *  array type description or a set description of the relevant base type.   *  array type description or a set description of the relevant base type.
1131   *  This should also not be used on statements defining children   *  This should also not be used on statements defining children
# Line 1335  extern struct TypeDescription *GetStatTy Line 1133  extern struct TypeDescription *GetStatTy
1133   *  It must be passed one of these types of statement.   *  It must be passed one of these types of statement.
1134   *  Other statements will return NULL or crash.   *  Other statements will return NULL or crash.
1135   *  Given all the caveats, this is a darn handy operator.   *  Given all the caveats, this is a darn handy operator.
1136     *
1137     *  @param s The statement to evaluate.
1138     *  @return The type field of the statement, which may be NULL.
1139   */   */
1140    
1141  extern void WriteArrayTypeList(FILE *fp);  extern void WriteArrayTypeList(FILE *fp);
1142  /**<  /**<
1143   *  <!--  void WriteArrayTypeList(fp)                                  -->   *  Writes the internal (implicit) array types to file fp.
1144   *  Writes the internal (implicit) array types to file f.   *  This is a debugging function.  The information written isn't likely
1145   *  This is a debugging function. The information written isn't very   *  to be very meaningful.  It relies on internal variables, so we
  *  meaningful to anyone. It relies on internal variables, so we  
1146   *  can't put it in type_descio.c.   *  can't put it in type_descio.c.
1147   */   */
1148    
# Line 1354  extern void WriteArrayTypeList(FILE *fp) Line 1154  extern void WriteArrayTypeList(FILE *fp)
1154  /**<  /**<
1155   *  Tells if the type description should be shown or not.   *  Tells if the type description should be shown or not.
1156   *  Returns 1 is the type is going to be shown. Returns 0 if not.   *  Returns 1 is the type is going to be shown. Returns 0 if not.
1157   *  @param d CONST struct TypeDescription*, the type description to query.   *  @param d The type description to query (CONST struct TypeDescription*).
1158   *  @return An unsigned.   *  @return The result as an unsigned.
1159   *  @see TypeShowF()   *  @see TypeShowF()
1160   */   */
1161  extern unsigned TypeShowF(CONST struct TypeDescription *d);  extern unsigned TypeShowF(CONST struct TypeDescription *d);
1162  /**<  /**<
  *  <!--  macro TypeShow(d)                                            -->  
  *  <!--  unsigned TypeShow(d)                                         -->  
  *  <!--  const struct TypeDescription *d;                             -->  
  *  <!--  Tells if the type descirption should be shown or not.        -->  
  *  <!--  Returns 1 is the type is going to be shown. Returns 0 if not.-->  
1163   *  Implementation function for TypeShow() (debug mode).   *  Implementation function for TypeShow() (debug mode).
1164   *  Do not call this function directly - use TypeShow() instead.   *  Do not call this function directly - use TypeShow() instead.
1165   */   */
1166    
1167  extern void SetTypeShowBit(struct TypeDescription *d, int value);  extern void SetTypeShowBit(struct TypeDescription *d, int value);
1168  /**<  /**<
1169   *  <!--  struct TypeDescription *d;                                   -->   *  Sets the bit TYPESHOW.  This bit is for browsing purposes.
  *  <!--  int value;                                                   -->  
  *  Set the bit TYPESHOW. This bit is for browsing purposes.  
1170   *  It will tell is the user wants to view the instances of a specific type.   *  It will tell is the user wants to view the instances of a specific type.
1171   *  The value of the bit will be selected in the Library window.   *  The value of the bit will be selected in the Library window.
1172     *
1173     *  @param d     The type to modify.
1174     *  @param value Flag for whether to set (non-zero) or clear (0) the show bit.
1175   */   */
1176    
1177  #endif  /* __TYPE_DESC_H_SEEN__ */  #endif  /* type_desc_h_seen__ */
1178    

Legend:
Removed from v.73  
changed lines
  Added in v.74

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