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

Contents of /trunk/base/generic/compiler/mathinst.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 301 - (show annotations) (download) (as text)
Mon Feb 20 07:39:14 2006 UTC (18 years, 4 months ago) by johnpye
File MIME type: text/x-chdr
File size: 8463 byte(s)
Documentation and indentation changes
1 /*
2 * Ascend Instance Math Object Functions
3 * by Tom Epperly
4 * 8/16/89
5 * Version: $Revision: 1.8 $
6 * Version control file: $RCSfile: mathinst.h,v $
7 * Date last modified: $Date: 1998/05/06 17:33:37 $
8 * Last modified by: $Author: ballan $
9 *
10 * This file is part of the Ascend Language Interpreter.
11 *
12 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
13 *
14 * The Ascend Language Interpreter is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * The Ascend Language Interpreter is distributed in hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with the program; if not, write to the Free Software Foundation,
26 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27 * COPYING.
28 */
29
30 /** @file
31 * Ascend Instance Math Object Functions.
32 *
33 * Relation, logical relation, and When querying and assignment routines
34 * <pre>
35 * When #including mathinst.h, make sure these files are #included first:
36 * #include "utilities/ascConfig.h"
37 * #include "fractions.h"
38 * #include "instance_enum.h"
39 * #include "compiler.h"
40 * #include "dimen.h"
41 * #include "types.h"
42 * </pre>
43 */
44
45 #ifndef ASC_MATHINST_H
46 #define ASC_MATHINST_H
47
48 extern enum Expr_enum GetInstanceRelationType(CONST struct Instance *i);
49 /**<
50 * This returns the type of the relation associated with this relations
51 * instance (REL_INST).
52 * This should be one of e_token, e_opcode, e_glassbox or e_blackbox.
53 */
54
55 extern CONST struct relation *GetInstanceRelationOnly(CONST struct Instance *i);
56 /**<
57 * This returns the guts of a relation instance (REL_INST).
58 * These should be treated as read only usually because you don't
59 * know who is sharing those guts.
60 */
61
62 extern CONST struct relation *GetInstanceRelation(CONST struct Instance *i,
63 enum Expr_enum *type);
64 /**<
65 * This returns the value of a relation inst(REL_INST). It will fill in
66 * the type of the relation associated with this relation instance.
67 * This will be one of e_token, e_opcode, e_glassbox or e_blackbox,
68 * or possibly e_undefined.
69 */
70
71 extern struct relation *GetInstanceRelToModify(struct Instance *i,
72 enum Expr_enum *type);
73 /**<
74 * This returns the value of a relation inst(REL_INST). In this function
75 * we do not get a CONST structure and therefore we can modify it. This
76 * is useful while marking conditional relations.
77 */
78
79 extern void SetInstanceRelation(struct Instance *i,
80 struct relation *rel,
81 enum Expr_enum type);
82 /**<
83 * Set the relation to rel. rel will be incorporated into the instance,
84 * so rel should not be modified or destroyed. The type of the relation
85 * *has* to be provided.
86 * rel and type may be the NULL/e_undefined combination.
87 */
88
89 extern CONST struct logrelation *GetInstanceLogRelOnly(CONST struct Instance*i);
90 /**<
91 * This returns the guts of a logical relation instance (LREL_INST).
92 * These should be treated as read only usually because you don't
93 * know who is sharing those guts.
94 */
95
96 extern CONST struct logrelation *GetInstanceLogRel(CONST struct Instance *i);
97 /**<
98 * This returns the value of a logrelation inst(LREL_INST).
99 */
100
101 extern struct logrelation *GetInstanceLogRelToModify(struct Instance *i);
102 /**<
103 * This returns the value of a logrelation inst(LREL_INST). In this function
104 * we do not get a CONST structure and therefore we can modify it. This
105 * is useful while marking conditional logrelations.
106 */
107
108 extern void SetInstanceLogRel(struct Instance *i, struct logrelation *lrel);
109 /**<
110 * Set the logical relation to lrel. rel will be incorporated into the
111 * instance, so rel should not be modified or destroyed.
112 */
113
114 extern struct gl_list_t *GetInstanceOperands(CONST struct Instance *i);
115 /**<
116 * Returns list of vars/models/equations in a mathematical relationship.
117 * Accepts all instance kinds. returns list only if the query makes
118 * sense, but list may be empty. List is yours to destroy, but its
119 * contents are not.
120 */
121
122 extern struct gl_list_t *GetInstanceWhenVars(CONST struct Instance *i);
123 /**<
124 * This returns the list of variables associated with this when
125 * instance (WHEN_INST)
126 */
127
128 extern struct gl_list_t *GetInstanceWhenCases(CONST struct Instance *i);
129 /**<
130 * This returns the list of cases associated with this when
131 * instance (WHEN_INST)
132 */
133
134 extern struct gl_list_t *GetInstanceWhens(CONST struct Instance *i);
135 /**<
136 * This returns the list of whens associated with this instance.
137 * Instance can be a model, relation,when,boolean, integer or symbol.
138 */
139
140 extern void SetWhenVarList(struct Instance *i, struct gl_list_t *whenvars);
141 /**<
142 * Set the list of variables of a when instance to whenvars
143 */
144
145 extern void SetWhenCases(struct Instance *i, struct gl_list_t *whencases);
146 /**<
147 * Set the list of cases of a when instance to whencases
148 */
149
150 /*
151 * Special Real Atom Functions
152 *
153 * Each real instance knows what mathematical relations that it appears in.
154 * That information can be acessed by the following routines.
155 * Same for discrete variables.
156 */
157
158 extern unsigned long RelationsCount(CONST struct Instance *i);
159 /**<
160 * This will return the number of relations that instance "i" appears in.
161 * "i" must be a REAL_ATOM_INST. Otherwise, this routine will
162 * bomb.
163 */
164
165 extern struct Instance *RelationsForAtom(CONST struct Instance *i,
166 unsigned long c);
167 /**<
168 * This routine will return the c'th relation in instance i's relation list.
169 * "i" must be a REAL_ATOM_INST and 0 < c <= RelationsCount(i).
170 */
171
172 extern void AddRelation(struct Instance *i, struct Instance *reln);
173 /**<
174 * Add the relation instance reln to instance i's relation list. "i" must
175 * be of type REAL_ATOM_INST and reln must be of type REL_INST.
176 */
177
178 extern void RemoveRelation(struct Instance *i, struct Instance *reln);
179 /**<
180 * Remove reln from i's relation list. If 'reln' isn't found in i's relation
181 * list, execution continues with a warning message.
182 */
183
184 extern unsigned long LogRelationsCount(CONST struct Instance *i);
185 /**<
186 * This will return the number of logical relations that instance "i"
187 * appears in. "i" must be a BOOLEAN_ATOM_INST, REL_INST or LREL_INST
188 */
189
190 extern struct Instance *LogRelationsForInstance(CONST struct Instance *i,
191 unsigned long c);
192 /**<
193 * This routine will return the c'th logical relation in instance i's
194 * logical relation list. "i" must be BOOLEAN_ATOM_INST, REL_INST or
195 * LREL_INST and 0 < c <= LogRelationsCount(i).
196 */
197
198 extern void AddLogRel(struct Instance *i, struct Instance *reln);
199 /**<
200 * Add the logical relation instance lreln to instance i's logical relation
201 * list. "i" must be of type BOOLEAN_ATOM_INST, REL_INST or LREL_INST
202 * and lreln must be of type LREL_INST. REL_INST and LREL_INST are
203 * allowed because of the SATISFIED logical term.
204 */
205
206 extern void RemoveLogRel(struct Instance *i, struct Instance *lreln);
207 /**<
208 * Remove lreln from i's logical relation list. If 'lreln' isn't found in
209 * i's logical relation list, execution continues with a warning message.
210 */
211
212 extern unsigned long WhensCount(struct Instance *i);
213 /**<
214 * This will return the number of whens that instance "i" is referenced in.
215 */
216
217 extern struct Instance *WhensForInstance(struct Instance *i,
218 unsigned long c);
219 /**<
220 * This routine will return the c'th when in instance i's when list.
221 * 0 < c <= WhensCount(i).
222 */
223
224 extern void AddWhen(struct Instance *i, struct Instance *when);
225 /**<
226 * Add the when instance when to instance i's when list. when must be of
227 * type WHEN_INST.
228 */
229
230 extern void RemoveWhen(struct Instance *i, struct Instance *when);
231 /**<
232 * Remove when from i's when list. If 'when' isn't found in i's when
233 * list, execution continues with a warning message.
234 */
235
236 #endif /* ASC_MATHINST_H */
237

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