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

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

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

revision 54 by jds, Tue Aug 2 11:20:09 2005 UTC revision 952 by johnpye, Tue Nov 28 23:01:50 2006 UTC
# Line 1  Line 1 
1  /*  /*  ASCEND modelling environment
2   *  Ascend Instance Array Functions      Copyright (C) 2006 Carnegie Mellon University
3   *  by Tom Epperly & Ben Allan      Copyright (C) 1996, 1997 Ben Allan
4   *  8/16/89      Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
5   *  Version: $Revision: 1.15 $  
6   *  Version control file: $RCSfile: arrayinst.h,v $      This program is free software; you can redistribute it and/or modify
7   *  Date last modified: $Date: 1998/04/07 19:52:46 $      it under the terms of the GNU General Public License as published by
8   *  Last modified by: $Author: ballan $      the Free Software Foundation; either version 2, or (at your option)
9   *      any later version.
10   *  This file is part of the Ascend Language Interpreter.  
11   *      This program is distributed in the hope that it will be useful,
12   *  Copyright (C) 1996, 1997 Benjamin Andrew Allan      but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  based on instance.c      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *  Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly      GNU General Public License for more details.
15   *  
16   *  The Ascend Language Interpreter is free software; you can redistribute      You should have received a copy of the GNU General Public License
17   *  it and/or modify it under the terms of the GNU General Public License as      along with this program; if not, write to the Free Software
18   *  published by the Free Software Foundation; either version 2 of the      Foundation, Inc., 59 Temple Place - Suite 330,
19   *  License, or (at your option) any later version.      Boston, MA 02111-1307, USA.
20   *  *//*
21   *  The Ascend Language Interpreter is distributed in hope that it will be      by Tom Epperly 8/16/89, Ben Allan
22   *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of      Last in CVS $Revision: 1.15 $ $Date: 1998/04/07 19:52:46 $ $Author: ballan $
23   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  */
  *  General Public License for more details.  
  *  
  *  You should have received a copy of the GNU General Public License  
  *  along with the program; if not, write to the Free Software Foundation,  
  *  Inc., 675 Mass Ave, Cambridge, MA 02139 USA.  Check the file named  
  *  COPYING.  
  */  
24    
25  /** @file  /** @file
26   *  Ascend Instance Array Functions.   *  Ascend Instance Array Functions.
# Line 89  Line 82 
82   *  application proposed for it has been the result of sloppy and/or   *  application proposed for it has been the result of sloppy and/or
83   *  lazy thinking.  In the end we may find a need for a genuine   *  lazy thinking.  In the end we may find a need for a genuine
84   *  multidimensional ListInstance that has much in common with arrays,   *  multidimensional ListInstance that has much in common with arrays,
85   *  but such a creature should be implemented as it's own creature and   *  but such a creature should be implemented as its own creature and
86   *  not a sloppy graft on top of arrays.   *  not a sloppy graft on top of arrays.
87   *  </pre>   *  </pre>
88   */   */
89    
90  #ifndef __ARRAYINST_H_SEEN__  #ifndef ASC_ARRAYINST_H
91  #define __ARRAYINST_H_SEEN__  #define ASC_ARRAYINST_H
92    
93  /* Array child memory management */  /* Array child memory management */
94  #define CAC(acp) ((struct ArrayChild *)(acp))  #define CAC(acp) ((struct ArrayChild *)(acp))
# Line 143  extern void InitInstanceNanny(void); Line 136  extern void InitInstanceNanny(void);
136    
137  extern void DestroyInstanceNanny(void);  extern void DestroyInstanceNanny(void);
138  /**<  /**<
  *  <!--  DestroyInstanceNanny();                                      -->  
139   *  Destroy array child instantiation gizmos. This must be called to   *  Destroy array child instantiation gizmos. This must be called to
140   *  clean up before shutting down ASCEND.   *  clean up before shutting down ASCEND.
141   *  Do attempt to instantiate anything after you call this unless you   *  Do attempt to instantiate anything after you call this unless you
# Line 152  extern void DestroyInstanceNanny(void); Line 144  extern void DestroyInstanceNanny(void);
144    
145  extern void ReportInstanceNanny(FILE *f);  extern void ReportInstanceNanny(FILE *f);
146  /**<  /**<
  *  <!--  ReportInstanceNanny(f);                                      -->  
  *  <!--  FILE *f;                                                     -->  
147   *  Reports on the array child instantiator to f.   *  Reports on the array child instantiator to f.
148   */   */
149    
# Line 163  extern struct gl_list_t Line 153  extern struct gl_list_t
153  *CollectArrayInstances(CONST struct Instance *i,  *CollectArrayInstances(CONST struct Instance *i,
154                         struct gl_list_t *list);                         struct gl_list_t *list);
155  /**<  /**<
  *  <!--  list = CollectArrayInstances(i,NULL);                        -->  
  *  <!--  const struct Instance *i;                                    -->  
  *  <!--  struct gl_list_t *list;                                      -->  
156   *  Appends pointers of the set/MODEL/ATOM/constant instances found in   *  Appends pointers of the set/MODEL/ATOM/constant instances found in
157   *  the leaves of an array instance, i, sparse or dense.   *  the leaves of an array instance, i, sparse or dense.
158   *  If list given by user is NULL, a list to be returned is made if   *  If list given by user is NULL, a list to be returned is made if
# Line 180  typedef void (*AVProc)(struct Instance * Line 167  typedef void (*AVProc)(struct Instance *
167    
168  extern void ArrayVisitLocalLeaves(struct Instance *mch, AVProc func);  extern void ArrayVisitLocalLeaves(struct Instance *mch, AVProc func);
169  /**<  /**<
  *  <!--  ArrayVisitLocalLeaves(mch,func)                              -->  
  *  <!--  struct Instance *mch;                                        -->  
  *  <!--  AVProc func;                                                 -->  
170   *  This function visits the instances indicated by the name   *  This function visits the instances indicated by the name
171   *  given in the definition statement of mch.   *  given in the definition statement of mch.ASC_DLLSPEC(struct Instance*) ChildByChar(CONST struct Instance *i,
172                                        symchar *str);
173    /**<
174     *  This returns to the pointer to a child, c, of parent,p, named by str.
175     *  str must be a simple name. If child not found, returns NULL.
176     *  str must be from the symbol table. If AscFindSymbol(str)==NULL,
177     *  then this function should not be called because NO instance
178     *  can have a child with a name which is not in the symbol table.
179   *  func is as described in visitinst.h for VisitProc.   *  func is as described in visitinst.h for VisitProc.
180   *  mch is an array instance that is the child of a MODEL.   *  mch is an array instance that is the child of a MODEL.
181   */   */
# Line 193  extern void ArrayVisitLocalLeaves(struct Line 184  extern void ArrayVisitLocalLeaves(struct
184    
185  extern int RectangleArrayExpanded(CONST struct Instance *i);  extern int RectangleArrayExpanded(CONST struct Instance *i);
186  /**<  /**<
  *  <!--  int RectangleArrayExpanded(i)                                -->  
  *  <!--  const struct Instance *i;                                    -->  
187   *  Test if the array is fully expanded   *  Test if the array is fully expanded
188   *  (i.e. all the sets for all the derefencing have been specified).<br><br>   *  (i.e. all the sets for all the derefencing have been specified).<br><br>
189   *   *
# Line 210  extern int RectangleSubscriptsMatch(CONS Line 199  extern int RectangleSubscriptsMatch(CONS
199                                      CONST struct Instance *ary,                                      CONST struct Instance *ary,
200                                      CONST struct Name *subscripts);                                      CONST struct Name *subscripts);
201  /**<  /**<
  *  <!--  int RectangleSubscriptsMatch(context,ary,subscripts)         -->  
  *  <!--  const struct Instance *context, *ary;                        -->  
  *  <!--  const struct Name *subscripts;                               -->  
202   *  Test if the ary children expected from evaluating the   *  Test if the ary children expected from evaluating the
203   *  nodes of subscripts (all set nodes) are all compatible   *  nodes of subscripts (all set nodes) are all compatible
204   *  with the children of the array instance given. The set   *  with the children of the array instance given. The set
# Line 231  extern int RectangleSubscriptsMatch(CONS Line 217  extern int RectangleSubscriptsMatch(CONS
217    
218  extern unsigned long NextToExpand(CONST struct Instance *i);  extern unsigned long NextToExpand(CONST struct Instance *i);
219  /**<  /**<
  *  <!--  unsigned long NextToExpand(i)                                -->  
  *  <!--  const struct Instance *i;                                    -->  
220   *  Return the number of the dereferencing that needs to be expanded.  This   *  Return the number of the dereferencing that needs to be expanded.  This
221   *  returns 0 if none are needed; 1 is the first dereference.   *  returns 0 if none are needed; 1 is the first dereference.
222   */   */
223    
224  extern unsigned long NumberofDereferences(CONST struct Instance *i);  extern unsigned long NumberofDereferences(CONST struct Instance *i);
225  /**<  /**<
  *  <!--  unsigned long NumberofDereferences(i)                        -->  
  *  <!--  const struct Instance *i;                                    -->  
226   *  This returns the number of dereferences that this array instance has   *  This returns the number of dereferences that this array instance has
227   *  before reaching what the array contains.   *  before reaching what the array contains.
228   */   */
229    
230  extern CONST struct Set *IndexSet(CONST struct Instance *i, unsigned long num);  extern CONST struct Set *IndexSet(CONST struct Instance *i, unsigned long num);
231  /**<  /**<
  *  <!--  struct Set *IndexSet(i,num)                                  -->  
  *  <!--  struct Instance *i;                                          -->  
  *  <!--  unsigned long num;                                           -->  
232   *  Return the set that the num'th index is defined over.  Don't make any   *  Return the set that the num'th index is defined over.  Don't make any
233   *  changes to the structure that is returned!   *  changes to the structure that is returned!
234   *  1 <= num <= NumberofDereferences(i)   *  1 <= num <= NumberofDereferences(i)
# Line 264  extern void ExpandArray(struct Instance Line 243  extern void ExpandArray(struct Instance
243                          struct Instance *arginst,                          struct Instance *arginst,
244                          struct gl_list_t *rhslist);                          struct gl_list_t *rhslist);
245  /**<  /**<
  *  <!--  void ExpandArray(i,num,set,rhsinst,arginst,rhslist)          -->  
  *  <!--  struct Instance *i;                                          -->  
  *  <!--  unsigned long num;                                           -->  
  *  <!--  struct set_t *set;                                           -->  
  *  <!--  struct Instance *arginst, *rhsinst;                          -->  
  *  <!--  struct gl_list_t *rhslist;                                   -->  
  *  
246   *  This will expand the num'th index over the set of index values given by   *  This will expand the num'th index over the set of index values given by
247   *  set.  set is returned unchanged.<br><br>   *  set.  set is returned unchanged.<br><br>
248   *   *
# Line 299  extern struct Instance *FindOrAddIntChil Line 271  extern struct Instance *FindOrAddIntChil
271                                            struct Instance *rhsinst,                                            struct Instance *rhsinst,
272                                            struct Instance *arginst);                                            struct Instance *arginst);
273  /**<  /**<
  *  <!--  struct Instance *FindOrAddIntChild(i,v,rhsinst,arginst)      -->  
  *  <!--  struct Instance *i,*rhsinst, *arginst;                       -->  
  *  <!--  long v;                                                      -->  
274   *  Add sparse array child at location defined by current ForTable   *  Add sparse array child at location defined by current ForTable
275   *  after instantiating child if rhsinst is NULL (an ISA).   *  after instantiating child if rhsinst is NULL (an ISA).
276   *  If instantiating, uses arginst if not NULL.   *  If instantiating, uses arginst if not NULL.
# Line 313  extern struct Instance *FindOrAddStrChil Line 282  extern struct Instance *FindOrAddStrChil
282                                            struct Instance *rhsinst,                                            struct Instance *rhsinst,
283                                            struct Instance *arginst);                                            struct Instance *arginst);
284  /**<  /**<
  *  <!--  struct Instance *FindOrAddStrChild(i,sym,rhsinst,arginst)    -->  
  *  <!--  struct Instance *i, *rhsinst, *arginst;                      -->  
  *  <!--  symchar *sym;                                                -->  
285   *  Add sparse array child at location defined by current ForTable   *  Add sparse array child at location defined by current ForTable
286   *  after instantiating child if rhsinst is NULL (an ISA).   *  after instantiating child if rhsinst is NULL (an ISA).
287   *  If instantiating, uses arginst if not NULL.   *  If instantiating, uses arginst if not NULL.
# Line 324  extern struct Instance *FindOrAddStrChil Line 290  extern struct Instance *FindOrAddStrChil
290    
291  extern int CmpArrayInsts(struct Instance *i1, struct Instance *i2);  extern int CmpArrayInsts(struct Instance *i1, struct Instance *i2);
292  /**<  /**<
  *  <!--  int CmpArrayInsts(i1,i2)                                     -->  
  *  <!--  struct Instance *i1, *i2;                                    -->  
293   *  Returns 0 if the arrays i1 and i2 are defined over equivalent subscript   *  Returns 0 if the arrays i1 and i2 are defined over equivalent subscript
294   *  ranges and have leaf parts of shallowly equivalent types.   *  ranges and have leaf parts of shallowly equivalent types.
295   *  (hint: relations and models are not deeply checked.)   *  (hint: relations and models are not deeply checked.)
# Line 334  extern int CmpArrayInsts(struct Instance Line 298  extern int CmpArrayInsts(struct Instance
298   *  NULL input --> 1 + warning, rather than exit.   *  NULL input --> 1 + warning, rather than exit.
299   */   */
300    
301  #endif  /* __ARRAYINST_H_SEEN__ */  #endif /* ASC_ARRAYINST_H */
   

Legend:
Removed from v.54  
changed lines
  Added in v.952

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