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

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

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

revision 53 by ben.allan, Sun Dec 26 20:06:01 2004 UTC revision 54 by jds, Tue Aug 2 11:20:09 2005 UTC
# Line 1  Line 1 
1  /**<  /*
2   *  Expression Evaluation Routine   *  Expression Evaluation Routine
3   *  by Tom Epperly   *  by Tom Epperly
4   *  Created: 1/16/90   *  Created: 1/16/90
# Line 27  Line 27 
27   *  COPYING.   *  COPYING.
28   */   */
29    
30  #ifndef __EVALUATE_H_SEEN__  /** @file
31  #define __EVALUATE_H_SEEN__   *  Expression Evaluation Routine
32     *  <pre>
   
 /**<  
33   *  When #including evaluate.h, make sure these files are #included first:   *  When #including evaluate.h, make sure these files are #included first:
34     *         #include "utilities/ascConfig.h"
35   *         #include "list.h"   *         #include "list.h"
36   *         #include "fractions.h"   *         #include "fractions.h"
37   *         #include "compiler.h"   *         #include "compiler.h"
38   *         #include "dimen.h"   *         #include "dimen.h"
39   *         #include "types.h"   *         #include "types.h"
40     *  </pre>
41   */   */
42    
43    #ifndef __EVALUATE_H_SEEN__
44    #define __EVALUATE_H_SEEN__
45    
46  extern struct value_t EvaluateSet(CONST struct Set *,struct value_t (*)());  extern struct value_t EvaluateSet(CONST struct Set *sptr,
47  /**<                                    struct value_t (*EvaluateName)());
48   *  struct value_t EvaluateSet(sptr,EvaluateName)  /**<
49   *  const struct Set *sptr;   *  <!--  struct value_t EvaluateSet(sptr,EvaluateName)                -->
50   *  struct value_t (*EvaluateName)();   *  <!--  const struct Set *sptr;                                      -->
51   *   *  <!--  struct value_t (*EvaluateName)();                            -->
52   *  POINTERS TO FUNCTIONS   *
53   *  struct value_t EvaluateName(nptr)   *  <!--  POINTERS TO FUNCTIONS                                        -->
54   *  struct Name *nptr;   *  <!--  struct value_t EvaluateName(nptr)                            -->
55     *  <!--  struct Name *nptr;                                           -->
56   *  Return the value of a Set structure, which just might be a set.   *  Return the value of a Set structure, which just might be a set.
57   */   */
58    
59  extern struct value_t EvaluateExpr(CONST struct Expr *,CONST struct Expr *,  extern struct value_t EvaluateExpr(CONST struct Expr *expr,
60         struct value_t (*)());                                     CONST struct Expr *stop,
61  /**<                                     struct value_t (*EvaluateName)());
62   *  struct value_t EvaluateExpr(expr,stop,EvaluateName)  /**<
63   *  const struct Expr *expr,*stop;   *  <!--  struct value_t EvaluateExpr(expr,stop,EvaluateName)          -->
64   *  struct value_t (*EvaluateName)();   *  <!--  const struct Expr *expr,*stop;                               -->
65     *  <!--  struct value_t (*EvaluateName)();                            -->
66     *
67     *  <!--  POINTERS TO FUNCTIONS                                        -->
68     *  <!--  struct value_t EvaluateName(nptr)                            -->
69     *  <!--  struct Name *nptr;                                           -->
70     *  Return the value of a name structure.
71   *  In most cases stop = NULL.  stop can be used to evaluate just part of   *  In most cases stop = NULL.  stop can be used to evaluate just part of
72   *  an expression.  If (stop!=NULL) the calling program, must know the   *  an expression.  If (stop!=NULL) the calling program, must know the
73   *  the stack is correctly balanced.   *  the stack is correctly balanced.
  *  
  *  POINTERS TO FUNCTIONS  
  *  struct value_t EvaluateName(nptr)  
  *  struct Name *nptr;  
  *  Return the value of a name structure.  
74   */   */
75    
76  extern struct gl_list_t *EvaluateNamesNeeded(CONST struct Expr *,  extern struct gl_list_t *EvaluateNamesNeeded(CONST struct Expr *expr,
77                                               CONST struct Expr *stop,                                               CONST struct Expr *stop,
78                                               struct gl_list_t *);                                               struct gl_list_t *list);
79  /**<  /**<
80   *  list = EvaluateNamesNeeded(e,stop,list);   *  <!--  list = EvaluateNamesNeeded(expr,stop,list);                     -->
81   *  const struct Expr *expr,*stop;   *  <!--  const struct Expr *expr,*stop;                               -->
82   *  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).   *  <!--  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant). -->
83   *  Appends all the externally defined names found in e to list.   *
84     *  Appends all the externally defined names found in expr to list.
85   *  (Loop variables defined in the expression are ignored.)   *  (Loop variables defined in the expression are ignored.)
86   *  If e is not well formed wrt loops, you may get odd results back.   *  If expr is not well formed wrt loops, you may get odd results back.
87   *  If the list passed in is NULL, creates a list first.   *  If the list passed in is NULL, creates a list first.
88   *  The list returned may be empty, but should not be NULL.   *  The list returned may be empty, but should not be NULL.
89   *  When e_var are encountered in the expression, DOES dissect the   *  When e_var are encountered in the expression, DOES dissect the
90   *  subscripts separately.   *  subscripts separately.<br><br>
91   *   *
92   *  Doesn't actually evaluate anything, so no EvaluateName function   *  Doesn't actually evaluate anything, so EvaluateName function
93   *  is not required. The list will be the set of names you must have   *  is not required. The list will be the set of names you must have
94   *  values for in order for the expression to have a chance of   *  values for in order for the expression to have a chance of
95   *  evaluating to a result, including for loop variables, but not   *  evaluating to a result, including for loop variables, but not
# Line 93  extern struct gl_list_t *EvaluateNamesNe Line 98  extern struct gl_list_t *EvaluateNamesNe
98   *  a list with duplication already in it, we will not clean it up for you.   *  a list with duplication already in it, we will not clean it up for you.
99   */   */
100    
101  extern struct gl_list_t *EvaluateNamesNeededShallow(CONST struct Expr *,  extern struct gl_list_t *EvaluateNamesNeededShallow(CONST struct Expr *expr,
102                                                      CONST struct Expr *stop,                                                      CONST struct Expr *stop,
103                                                      struct gl_list_t *);                                                      struct gl_list_t *list);
104  /**<  /**<
105   *  list = EvaluateNamesNeededShallow(e,stop,list);   *  <!--  list = EvaluateNamesNeededShallow(expr,stop,list);           -->
106   *  const struct Expr *expr,*stop;   *  <!--  const struct Expr *expr,*stop;                               -->
107   *  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).   *  <!--  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant). -->
108   *  Appends all the externally defined names found in e to list.   *
109     *  Appends all the externally defined names found in expr to list.
110   *  (Loop variables defined in the expression are ignored.)   *  (Loop variables defined in the expression are ignored.)
111   *  If e is not well formed wrt loops, you may get odd results back.   *  If e is not well formed wrt loops, you may get odd results back.
112   *  If the list passed in is NULL, creates a list first.   *  If the list passed in is NULL, creates a list first.
113   *  The list returned may be empty, but should not be NULL.   *  The list returned may be empty, but should not be NULL.
114   *  When e_var are encountered in the expression, DOES NOT dissect the   *  When e_var are encountered in the expression, DOES NOT dissect the
115   *  subscripts separately.   *  subscripts separately.<br><br>
116   *   *
117   *  Doesn't actually evaluate anything, so no EvaluateName function   *  Doesn't actually evaluate anything, so no EvaluateName function
118   *  is not required. The list will be the set of names you must have   *  is not required. The list will be the set of names you must have
# Line 117  extern struct gl_list_t *EvaluateNamesNe Line 123  extern struct gl_list_t *EvaluateNamesNe
123   *  a list with duplication already in it, we will not clean it up for you.   *  a list with duplication already in it, we will not clean it up for you.
124   */   */
125    
126  extern struct gl_list_t *  extern struct gl_list_t
127  EvaluateSetNamesNeeded(CONST struct Set *,struct gl_list_t *);  *EvaluateSetNamesNeeded(CONST struct Set *sptr, struct gl_list_t *list);
128  /**<  /**<
129   *  list = EvaluateSetNamesNeeded(sptr,list)   *  <!--  list = EvaluateSetNamesNeeded(sptr,list)                     -->
130   *  const struct Set *sptr;   *  <!--  const struct Set *sptr;                                      -->
131   *  extern struct gl_list_t *list;   *  <!--  extern struct gl_list_t *list;                               -->
132   *  (Analogous to EvaluateSet, but the global EvaluatingSets is irrelevant).   *  <!--  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant). -->
133   *   *
134   *  Appends all the externally defined names found in sptr to list.   *  Appends all the externally defined names found in sptr to list.
135   *  (Loop variables defined in the expression are ignored.)   *  (Loop variables defined in the expression are ignored.)
136   *  If sptr  is not well formed wrt loops, you may get odd results back.   *  If sptr  is not well formed wrt loops, you may get odd results back.
137   *  If the list passed in is NULL, creates a list first.   *  If the list passed in is NULL, creates a list first.
138   *  The list returned may be empty, but should not be NULL.   *  The list returned may be empty, but should not be NULL.
139   *  DOES investigate subscripts deeply for needed names.   *  DOES investigate subscripts deeply for needed names.<br><br>
140   *   *
141   *  Doesn't actually evaluate anything, so no EvaluateName function   *  Doesn't actually evaluate anything, so no EvaluateName function
142   *  is not required. The list will be the set of names you must have   *  is not required. The list will be the set of names you must have
# Line 141  EvaluateSetNamesNeeded(CONST struct Set Line 147  EvaluateSetNamesNeeded(CONST struct Set
147   *  a list with duplication already in it, we will not clean it up for you.   *  a list with duplication already in it, we will not clean it up for you.
148   */   */
149    
150  extern struct gl_list_t *  extern struct gl_list_t
151  EvaluateSetNamesNeededShallow(CONST struct Set *,struct gl_list_t *);  *EvaluateSetNamesNeededShallow(CONST struct Set *sptr, struct gl_list_t *list);
152  /**<  /**<
153   *  list = EvaluateSetNamesNeededShallow(sptr,list)   *  <!--  list = EvaluateSetNamesNeededShallow(sptr,list)              -->
154   *  const struct Set *sptr;   *  <!--  const struct Set *sptr;                                      -->
155   *  extern struct gl_list_t *list;   *  <!--  extern struct gl_list_t *list;                               -->
156   *  (Analogous to EvaluateSet, but the global EvaluatingSets is irrelevant).   *  <!--  (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant). -->
157   *   *
158   *  Appends all the externally defined names found in sptr to list.   *  Appends all the externally defined names found in sptr to list.
159   *  (Loop variables defined in the expression are ignored.)   *  (Loop variables defined in the expression are ignored.)
160   *  If sptr  is not well formed wrt loops, you may get odd results back.   *  If sptr  is not well formed wrt loops, you may get odd results back.
161   *  If the list passed in is NULL, creates a list first.   *  If the list passed in is NULL, creates a list first.
162   *  The list returned may be empty, but should not be NULL.   *  The list returned may be empty, but should not be NULL.
163   *  DOES NOT investigate subscripts deeply for needed names.   *  DOES NOT investigate subscripts deeply for needed names.<br><br>
164   *   *
165   *  Doesn't actually evaluate anything, so no EvaluateName function   *  Doesn't actually evaluate anything, so no EvaluateName function
166   *  is not required. The list will be the set of names you must have   *  is not required. The list will be the set of names you must have
# Line 166  EvaluateSetNamesNeededShallow(CONST stru Line 172  EvaluateSetNamesNeededShallow(CONST stru
172   */   */
173    
174  extern void ClearRecycleStack(void);  extern void ClearRecycleStack(void);
175  /**<  /**<
176   *  Call this function after shutting down the compiler.   *  Call this function after shutting down the compiler.
177   *   *
178   *  The stack seldom gets beyond 2 deep, but we recycle the memory for   *  The stack seldom gets beyond 2 deep, but we recycle the memory for
# Line 178  extern void ClearRecycleStack(void); Line 184  extern void ClearRecycleStack(void);
184   *  There is an option inside evaluate.c that causes this function to   *  There is an option inside evaluate.c that causes this function to
185   *  report how many recycled stack elements it deallocates.   *  report how many recycled stack elements it deallocates.
186   */   */
187  #endif /**< __EVALUATE_H_SEEN__ */  
188    #endif /* __EVALUATE_H_SEEN__ */
189    

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

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