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

Diff of /trunk/base/generic/compiler/typedef.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 29  Line 29 
29    
30  /** @file  /** @file
31   *  Ascend Type Definition Module.   *  Ascend Type Definition Module.
32     *  This module provides functions for creating new types.
33   *  <pre>   *  <pre>
34   *  When #including typedef.h, make sure these files are #included first:   *  When #including typedef.h, make sure these files are #included first:
35   *         #include "utilities/ascConfig.h"   *         #include "utilities/ascConfig.h"
36   *         #include "fractions.h"   *         #include "compiler/fractions.h"
37   *         #include "instance_enum.h"   *         #include "compiler/instance_enum.h"
38   *         #include "compiler.h"   *         #include "compiler/compiler.h"
39   *         #include "module.h"   *         #include "compiler/module.h"
40   *         #include "list.h"   *         #include "compiler/list.h"
41   *         #include "slist.h"   *         #include "compiler/slist.h"
42   *         #include "dimen.h"   *         #include "compiler/dimen.h"
43   *         #include "child.h"   *         #include "compiler/child.h"
44   *         #include "type_desc.h"   *         #include "compiler/type_desc.h"
45   *  </pre>   *  </pre>
46   */   */
47    
48  #ifndef __TYPEDEF_H_SEEN__  #ifndef typedef_h_seen__
49  #define __TYPEDEF_H_SEEN__  #define typedef_h_seen__
50    
51  extern void DestroyTypedefRecycle(void);  extern void DestroyTypedefRecycle(void);
52  /**<  /**<
53   *  <!--  DestroyTypedefRecycle()                                      -->   *  Clears recycled memory.
54   *  Clear recycled memory.   *  To work efficiently the typedef module recycles certain pieces
55   *  To work efficiently the typedef module recycles internally   *  of memory internally.  This function may be called any time (from
56   *  certain pieces of memory.   *  outside this file) to clear out this recycled memory.  The only
57   *  This function may be called any time (from outside this file)   *  time it makes _sense_ to do so is after deleting all types in the
58   *  to clear out this recycled memory.   *  library or when shutting down the system, but it is safe regardless.
  *  The only time it makes _sense_ to do so is after deleting all types  
  *  in the library or when shutting down the system, but it is safe  
  *  regardless.  
59   */   */
60    
61  extern struct TypeDescription  extern struct TypeDescription
# Line 72  extern struct TypeDescription Line 70  extern struct TypeDescription
70                      struct StatementList *wsl, /* parameter wheres */                      struct StatementList *wsl, /* parameter wheres */
71                      unsigned int err);                      unsigned int err);
72  /**<  /**<
  *  <!-- struct TypeDescription *CreateModelTypeDef(name,refines,mod,univ,sl,pl, -->  
  *  <!--                                            psl,rsl,wsl,err)             -->  
  *  <!--  const char *name,     name of the type to define                -->  
  *  <!--             *refines,  name of the type it refines or NULL     -->  
  *  <!--  struct module_t *mod; module where the type is defined       -->  
  *  <!--  int univ;         FALSE non-universal, TRUE universal type         -->  
  *  <!--  struct StatementList *sl; declarative statements             -->  
  *  <!--  struct gl_list_t *pl; list of procedures or NULL             -->  
  *  <!--  struct StatementList *psl;    declarative parameter statements  -->  
  *  <!--  struct StatementList *rsl;    parameter reductions              -->  
  *  <!--  struct StatementList *wsl;    conditions on WILL_BE parameter structure -->  
  *  <!--  unsigned int err;     if !=0, abandon input.                    -->  
73   *  Creates a model type definition.   *  Creates a model type definition.
74   *   *
75   *  Note sl, psl and rsl have restrictions on the statements allowed:   *  Note sl, psl and rsl have restrictions on the statements allowed:
76   *  - sl cannot contain WILL_BEs;   *  - sl cannot contain WILL_BEs
77   *  - psl cannot contain other than WILL_BEs/IS_As;   *  - psl cannot contain other than WILL_BEs/IS_As
78   *  - rsl cannot contain other than constant assignments.   *  - rsl cannot contain other than constant assignments
79   *  - wsl cannot contain other than WILL_BE_THE_SAMEs   *  - wsl cannot contain other than WILL_BE_THE_SAMEs
80   *   *
81   *  Note that, per ascParse.y, this function destroys several of its   *  Note that, per ascParse.y, this function destroys several of its
# Line 107  extern struct TypeDescription Line 93  extern struct TypeDescription
93   *  @param rsl      Parameter reductions.   *  @param rsl      Parameter reductions.
94   *  @param wsl      Conditions on WILL_BE parameter structure.   *  @param wsl      Conditions on WILL_BE parameter structure.
95   *  @param err      If !=0, abandon input.   *  @param err      If !=0, abandon input.
96     *  @return A pointer to the new TypeDescription structure.
97   */   */
98    
99  extern struct TypeDescription  extern struct TypeDescription
# Line 121  extern struct TypeDescription Line 108  extern struct TypeDescription
108                         CONST dim_type *dim,  /* default dimensions */                         CONST dim_type *dim,  /* default dimensions */
109                         unsigned int err);                         unsigned int err);
110  /**<  /**<
  *  <!--  struct TypeDescription *CreateConstantTypeDef(               -->  
  *  <!--      name,refines,mod,univ,defaulted,rval,ival,sval,dim,err)  -->  
  *  <!--  const char *name;     name of the type                          -->  
  *  <!--  const char *refines;  name of the type it refines             -->  
  *  <!--  struct module_t *mod; module where the type is defined       -->  
  *  <!--  int univ;         FALSE non-universal, TRUE universal type         -->  
  *  <!--  int defaulted;        FALSE no default assigned, TRUE default      -->  
  *  <!--  double rval;      default value for reals only                   -->  
  *  <!--  long ival;            default value for integers/booleans             -->  
  *  <!--  symchar * sval;       default for symbols                         -->  
  *  <!--  CONST dim_type *dim;  dimensions of default real value        -->  
  *  <!--  unsigned int err;     if !=0, abandon input.                    -->  
  *  
111   *  Creates a refinement of refines. refines cannot be NULL.   *  Creates a refinement of refines. refines cannot be NULL.
112   *  If refines is already defaulted, defaulted must be be FALSE.   *  If refines is already defaulted, defaulted must be FALSE.
113   *  Only the value (among rval,ival,sval) that matches refines is used.   *  Only the value (among rval,ival,sval) that matches refines is used.
114   *  An appropriate dim should be supplied for all types.   *  An appropriate dim should be supplied for all types.
115   *   *
# Line 149  extern struct TypeDescription Line 123  extern struct TypeDescription
123   *  @param sval       Default for symbols.   *  @param sval       Default for symbols.
124   *  @param dim        Dimensions of default real value.   *  @param dim        Dimensions of default real value.
125   *  @param err        If !=0, abandon input.   *  @param err        If !=0, abandon input.
126     *  @return A pointer to the new TypeDescription structure.
127   */   */
128    
129  extern struct TypeDescription  extern struct TypeDescription
# Line 165  extern struct TypeDescription Line 140  extern struct TypeDescription
140                     long ival,                /* default int/bool */                     long ival,                /* default int/bool */
141                     symchar *sval,            /* default sym*/                     symchar *sval,            /* default sym*/
142                     unsigned int err);                     unsigned int err);
143  /**<  /**<
  *  <!--  struct TypeDescription *CreateAtomTypeDef(name,refines,t,mod,univ,sl,pl, -->  
  *  <!--          defaulted,val,dim,ival,sval,err)                     -->  
  *  <!--  const char *name,     name of the type                          -->  
  *  <!--  const char *refines,  name of the type it refines OR NULL     -->  
  *  <!--  enum type_kind t;     ignored when refines!=NULL                -->  
  *  <!--  struct module_t *mod; module where the type is defined       -->  
  *  <!--  int univ;         FALSE non-universal, TRUE universal type         -->  
  *  <!--  struct StatementList *sl; list of declarative statements     -->  
  *  <!--  struct gl_list_t *pl; list of initialization procedures OR NU-->LL  
  *  <!--  int defaulted;        FALSE no default assigned, TRUE default      -->  
  *  <!--  double val;           default value for reals only                   -->  
  *  <!--  CONST dim_type *dim;  dimensions of default value             -->  
  *  <!--  ival;         default integer or boolean                           -->  
  *  <!--  symchar *sval;        default symbol                               -->  
  *  <!--  unsigned int err;     !=0 --> abandon input                     -->  
144   *  Creates an atom type definition.   *  Creates an atom type definition.
145   *  Note: val,ival,sval are digested according to the type_kind.   *  Note: val,ival,sval are digested according to the type_kind.
146   *  Those which are irrelevant are ignored.<br><br>   *  Those which are irrelevant are ignored.<br><br>
# Line 205  extern struct TypeDescription Line 165  extern struct TypeDescription
165   *  @param ival       Default integer or boolean.   *  @param ival       Default integer or boolean.
166   *  @param sval       Default symbol.   *  @param sval       Default symbol.
167   *  @param err        If !=0 --> abandon input.   *  @param err        If !=0 --> abandon input.
168     *  @return A pointer to the new TypeDescription structure.
169   */   */
170    
171  extern struct TypeDescription  extern struct TypeDescription
# Line 213  extern struct TypeDescription Line 174  extern struct TypeDescription
174                         struct StatementList *sl,                         struct StatementList *sl,
175                         struct gl_list_t *pl);                         struct gl_list_t *pl);
176  /**<  /**<
  *  <!--  struct TypeDescription *CreateRelationTypeDef(mod,name,sl,pl)-->  
  *  <!--  struct module_t *mod; the module it is defined in            -->  
  *  <!--  const char *name;           the name to assign to the relation type -->  
  *  <!--  struct StatementList *sl; the list of declarative statements -->  
  *  <!--  struct gl_list_t *pl; the list of initialization procedures OR NULL -->  
177   *  Creates a relation type definition.   *  Creates a relation type definition.
178   *  @param mod    The module it is defined in.   *
179     *  @param mod    The module the type is defined in.
180   *  @param name   The name to assign to the relation type.   *  @param name   The name to assign to the relation type.
181   *  @param sl     The list of declarative statements.   *  @param sl     The list of declarative statements.
182   *  @param pl     The list of initialization procedures OR NULL.   *  @param pl     The list of initialization procedures OR NULL.
183     *  @return A pointer to the new TypeDescription structure.
184   */   */
185    
186  extern struct TypeDescription  extern struct TypeDescription
# Line 231  extern struct TypeDescription Line 189  extern struct TypeDescription
189                       struct StatementList *sl,                       struct StatementList *sl,
190                       struct gl_list_t *pl);                       struct gl_list_t *pl);
191  /**<  /**<
  *  struct TypeDescription *CreateLogRelTypeDef(mod,name,sl,pl)  
  *  struct module_t *mod;   the module it is defined in  
  *  symchar *name;              the name to assign to the logrel type  
  *  struct StatementList *sl;   the list of declarative statements  
  *  struct gl_list_t *pl;   the list of initialization procedures OR NULL  
192   *  Creates a logical relation type definition.   *  Creates a logical relation type definition.
193   *  @param mod    The module it is defined in.   *
194     *  @param mod    The module the type is defined in.
195   *  @param name   The name to assign to the logical relation type.   *  @param name   The name to assign to the logical relation type.
196   *  @param sl     The list of declarative statements.   *  @param sl     The list of declarative statements.
197   *  @param pl     The list of initialization procedures OR NULL.   *  @param pl     The list of initialization procedures OR NULL.
198     *  @return A pointer to the new TypeDescription structure.
199   */   */
200    
   
201  extern struct TypeDescription  extern struct TypeDescription
202  *CreatePatchTypeDef(symchar *patch,  *CreatePatchTypeDef(symchar *patch,
203                      symchar *original,                      symchar *original,
# Line 253  extern struct TypeDescription Line 207  extern struct TypeDescription
207                      struct gl_list_t *pl,                      struct gl_list_t *pl,
208                      unsigned int err);                      unsigned int err);
209  /**<  /**<
  *  <!--  struct TypeDescription *                                     -->  
  *  <!--  CreatePatchTypeDef(patch,original,orig_mod,mod,sl,pl,err);   -->  
  *  <!--  const char *name;     name of the patch                         -->  
  *  <!--  const char *original; name of the original type being patched -->  
  *  <!--  const char *orig_mode;    name of module for the orig type or NULL  -->  
  *  <!--  struct module_t *mod; the module it is defined in            -->  
  *  <!--  struct StatementList *sl; the list of declarative statements OR NULL -->  
  *  <!--  struct gl_list_t *pl; the list of initialization procedures OR NULL -->  
  *  <!--  unsigned int err;     if !=0 abandon input                      -->  
210   *  Creates a patch type definition.   *  Creates a patch type definition.
211   *  Note that, per ascParse.y, this function destroys several of its   *  Note that, per ascParse.y, this function destroys several of its
212   *  args if it is going to return NULL. (OTHERWISE the args become   *  args if it is going to return NULL. (OTHERWISE the args become
213   *  parts of the returned object). These destroyed args are:   *  parts of the returned object). These destroyed args are: sl, pl.
214   *  sl, pl.   *
215   *  @param patch      Name of the patch.   *  @param patch      Name of the patch.
216   *  @param original   Name of the original type being patched.   *  @param original   Name of the original type being patched.
217   *  @param orig_mod   Name of module for the orig type or NULL.   *  @param orig_mod   Name of module for the orig type or NULL.
# Line 274  extern struct TypeDescription Line 219  extern struct TypeDescription
219   *  @param sl         The list of declarative statements OR NULL.   *  @param sl         The list of declarative statements OR NULL.
220   *  @param pl         The list of initialization procedures OR NULL.   *  @param pl         The list of initialization procedures OR NULL.
221   *  @param err        If !=0 abandon input.   *  @param err        If !=0 abandon input.
222     *  @return A pointer to the new TypeDescription structure.
223   */   */
224    
225  extern void DefineFundamentalTypes(void);  extern void DefineFundamentalTypes(void);
# Line 281  extern void DefineFundamentalTypes(void) Line 227  extern void DefineFundamentalTypes(void)
227   *  Define the fundamental and constant basetypes used in ascend.   *  Define the fundamental and constant basetypes used in ascend.
228   *  They will be named following the defines in type_desc.h.   *  They will be named following the defines in type_desc.h.
229   *   *
230   *  @bug Doesn't specify the name "relation". Doing so is problematic   *  @bug compiler/typedef:DefineFundamentalTypes() doesn't specify the
231   *       wrt instantiate.c.   *       name "relation". Doing so is problematic wrt instantiate.c.
232   */   */
233    
234  #endif /* __TYPEDEF_H_SEEN__ */  #endif /* typedef_h_seen__ */
235    

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

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