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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 669 - (hide annotations) (download) (as text)
Wed Jun 21 07:00:45 2006 UTC (13 years, 2 months ago) by johnpye
File MIME type: text/x-chdr
File size: 6863 byte(s)
Merged changes from DAE branch (revisions 702 to 819) back into trunk.
This adds the Integration API to the ASCEND solver (in base/generic).
Also provides pre-alpha support for 'IDA' from the SUNDIALS suite, a DAE solver.
Many other minor code clean-ups, including adoption of new 'ASC_NEW' and friends (to replace 'ascmalloc')
Added some very sketchy stuff providing 'DIFF(...)' syntax, although it is anticipated that this will be removed.
1 johnpye 669 /* ASCEND modelling environment
2     Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
3     Copyright (C) 2006 Carnegie Mellon University
4 aw0a 1
5 johnpye 669 This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2, or (at your option)
8     any later version.
9 aw0a 1
10 johnpye 669 This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     GNU General Public License for more details.
14 aw0a 1
15 johnpye 669 You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place - Suite 330,
18     Boston, MA 02111-1307, USA.
19     *//**
20     @file
21     Expression Evaluation Routine
22    
23     Requires:
24     #include "utilities/ascConfig.h"
25     #include "list.h"
26     #include "fractions.h"
27     #include "compiler.h"
28     #include "dimen.h"
29     #include "expr_types.h"
30     *//*
31     by Tom Epperly
32     Created: 1/16/90
33     Last in CVS: $Revision: 1.10 $ $Date: 1997/07/18 12:29:08 $ $Author: mthomas $
34     */
35    
36     #ifndef ASC_EVALUATE_H
37     #define ASC_EVALUATE_H
38    
39 jds 54 extern struct value_t EvaluateSet(CONST struct Set *sptr,
40     struct value_t (*EvaluateName)());
41     /**<
42 aw0a 1 * Return the value of a Set structure, which just might be a set.
43     */
44    
45 jds 54 extern struct value_t EvaluateExpr(CONST struct Expr *expr,
46     CONST struct Expr *stop,
47     struct value_t (*EvaluateName)());
48     /**<
49     * Return the value of a name structure.
50 aw0a 1 * In most cases stop = NULL. stop can be used to evaluate just part of
51     * an expression. If (stop!=NULL) the calling program, must know the
52     * the stack is correctly balanced.
53     */
54    
55 jds 54 extern struct gl_list_t *EvaluateNamesNeeded(CONST struct Expr *expr,
56 aw0a 1 CONST struct Expr *stop,
57 jds 54 struct gl_list_t *list);
58     /**<
59 johnpye 669 * (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).
60 jds 54 *
61     * Appends all the externally defined names found in expr to list.
62 aw0a 1 * (Loop variables defined in the expression are ignored.)
63 jds 54 * If expr is not well formed wrt loops, you may get odd results back.
64 aw0a 1 * If the list passed in is NULL, creates a list first.
65     * The list returned may be empty, but should not be NULL.
66     * When e_var are encountered in the expression, DOES dissect the
67 jds 54 * subscripts separately.<br><br>
68 aw0a 1 *
69 jds 54 * Doesn't actually evaluate anything, so EvaluateName function
70 aw0a 1 * is not required. The list will be the set of names you must have
71     * values for in order for the expression to have a chance of
72     * evaluating to a result, including for loop variables, but not
73     * dummy indices defined in the expression.
74     * No duplicate names will be added to the list, but if you send in
75     * a list with duplication already in it, we will not clean it up for you.
76     */
77    
78 jds 54 extern struct gl_list_t *EvaluateNamesNeededShallow(CONST struct Expr *expr,
79 aw0a 1 CONST struct Expr *stop,
80 jds 54 struct gl_list_t *list);
81     /**<
82 johnpye 669 * (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).
83 jds 54 *
84     * Appends all the externally defined names found in expr to list.
85 aw0a 1 * (Loop variables defined in the expression are ignored.)
86     * If e is not well formed wrt loops, you may get odd results back.
87     * If the list passed in is NULL, creates a list first.
88     * The list returned may be empty, but should not be NULL.
89     * When e_var are encountered in the expression, DOES NOT dissect the
90 jds 54 * subscripts separately.<br><br>
91 aw0a 1 *
92     * Doesn't actually evaluate anything, so no EvaluateName function
93     * 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
95     * evaluating to a result, including for loop variables, but not
96     * dummy indices defined in the expression.
97     * No duplicate names will be added to the list, but if you send in
98     * a list with duplication already in it, we will not clean it up for you.
99     */
100    
101 jds 54 extern struct gl_list_t
102     *EvaluateSetNamesNeeded(CONST struct Set *sptr, struct gl_list_t *list);
103     /**<
104 johnpye 669 * (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).
105 aw0a 1 *
106     * Appends all the externally defined names found in sptr to list.
107     * (Loop variables defined in the expression are ignored.)
108     * If sptr is not well formed wrt loops, you may get odd results back.
109     * If the list passed in is NULL, creates a list first.
110     * The list returned may be empty, but should not be NULL.
111 jds 54 * DOES investigate subscripts deeply for needed names.<br><br>
112 aw0a 1 *
113     * Doesn't actually evaluate anything, so no EvaluateName function
114     * is not required. The list will be the set of names you must have
115     * values for in order for the set to have a chance of
116     * evaluating to a result, including for loop variables, but not
117     * dummy indices defined in the expression.
118     * No duplicate names will be added to the list, but if you send in
119     * a list with duplication already in it, we will not clean it up for you.
120     */
121    
122 jds 54 extern struct gl_list_t
123     *EvaluateSetNamesNeededShallow(CONST struct Set *sptr, struct gl_list_t *list);
124     /**<
125 johnpye 669 * (Analogous to EvaluateExpr, but the global EvaluatingSets is irrelevant).
126 aw0a 1 *
127     * Appends all the externally defined names found in sptr to list.
128     * (Loop variables defined in the expression are ignored.)
129     * If sptr is not well formed wrt loops, you may get odd results back.
130     * If the list passed in is NULL, creates a list first.
131     * The list returned may be empty, but should not be NULL.
132 jds 54 * DOES NOT investigate subscripts deeply for needed names.<br><br>
133 aw0a 1 *
134     * Doesn't actually evaluate anything, so no EvaluateName function
135     * is not required. The list will be the set of names you must have
136     * values for in order for the set to have a chance of
137     * evaluating to a result, including for loop variables, but not
138     * dummy indices defined in the expression.
139     * No duplicate names will be added to the list, but if you send in
140     * a list with duplication already in it, we will not clean it up for you.
141     */
142    
143     extern void ClearRecycleStack(void);
144 jds 54 /**<
145 aw0a 1 * Call this function after shutting down the compiler.
146     *
147     * The stack seldom gets beyond 2 deep, but we recycle the memory for
148     * it anyway because malloc and free are expensive and we use the
149     * stack millions of times.
150     * The recycler is initialized to empty by the ANSI C assumption,
151     * so there is no init function. This function can be used as a ReInit
152     * if so desired, but there is no need for it.
153     * There is an option inside evaluate.c that causes this function to
154     * report how many recycled stack elements it deallocates.
155     */
156 jds 54
157 johnpye 669 #endif /* ASC_EVALUATE_H */
158 jds 54

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