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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 502 - (show annotations) (download) (as text)
Tue Apr 18 12:57:30 2006 UTC (14 years, 5 months ago) by johnpye
File MIME type: text/x-chdr
File size: 8369 byte(s)
Added check to see that YACC runs OK.
Fixing build with MSVC++ 2005.
All builds now except for some problems in the SWIG-generated code.
1 /*
2 * Ascend Instance Tree Search Routines
3 * by Tom Epperly
4 * Created: 1/24/90
5 * Version: $Revision: 1.12 $
6 * Version control file: $RCSfile: find.h,v $
7 * Date last modified: $Date: 1998/03/26 20:39:45 $
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 Tree Search Routines.
32 * <pre>
33 * When #including find.h, make sure these files are #included first:
34 * #include "utilities/ascConfig.h"
35 * #include "fractions.h"
36 * #include "compiler.h"
37 * #include "instance_enum.h"
38 * #include "dimen.h"
39 * #include "types.h"
40 * </pre>
41 */
42
43 #ifndef ASC_FIND_H
44 #define ASC_FIND_H
45
46 #include <compiler/value_type.h>
47
48 /**
49 * Search error codes.
50 * At present, there is a GREAT DEAL of insanity between find_errors and
51 * evaluation_error (value_type.h). In particular there is a lot of idiocy
52 * mapping undefined_instance <--> undefined_value which is just plain wrong
53 * in most cases.
54 */
55 enum find_errors {
56 unmade_instance, /**< Found an unmade instance (NULL child). */
57 undefined_instance, /**< Unstance in an expression is unknown child. */
58 impossible_instance, /**< Name cannot possibily exist(real error),often sets. */
59 correct_instance /**< Return value when everything went okay. */
60 };
61
62 extern int ListMode;
63 /**<
64 * Tells whether to evaluate a set strictly as a set i.e no order,
65 * or as a list, i.e., with order important.
66 */
67
68 extern int EvaluatingSets;
69 /**<
70 * Tells whether the evaluation of a set is in place. Used for marking
71 * atoms as mutable or not.
72 */
73
74 extern int g_DeclarativeContext;
75 /**<
76 * Tells whether declarative processing, the default = 0 , is in effect,
77 * or procedural processing as when doing initializations.
78 * Access this varible only by GetDeclarativeContext() and
79 * SetDeclarativeContext() below.
80 */
81
82 #define FINDEBUG 0
83 #if (FINDEBUG==0)
84 /** retrieve the declarative context */
85 #define GetDeclarativeContext() g_DeclarativeContext
86 #define SetDeclarativeContext(n) g_DeclarativeContext = (n)
87 /**< set the declarative context */
88 #else
89 /** retrieve the declarative context */
90 #define GetDeclarativeContext() GetDeclarativeContextF()
91 #define SetDeclarativeContext(n) SetDeclarativeContextF((n),__FILE__,__LINE__)
92 /**< set the declarative context */
93 #endif
94 extern int GetDeclarativeContextF(void);
95 /**< retrieve the declarative context (for debugging) */
96 extern void SetDeclarativeContextF(int value, char *file, int line);
97 /**< set the declarative context (for debugging) */
98
99 extern CONST struct Instance *g_EvaluationContext;
100 /**<
101 * Global variable used throughout semantic analysis to
102 * indicate context of evaluation. Do Not reference this
103 * directly, but use GetEvaluationContext() and
104 * SetEvaluationContext() instead.
105 */
106 extern struct for_table_t *g_EvaluationForTable;
107 /**<
108 * Global variable used throughout semantic analysis to
109 * indicate context of evaluation. Do Not reference this
110 * directly, but use GetEvaluationForTable() and
111 * SetEvaluationForTable() instead.
112 */
113
114 #ifndef NDEBUG
115 #define EVALDEBUG 0 /**< 1 = contextnoisy, 2 = fornoisy, 3 = both */
116 #define GetEvaluationContext() GetEvaluationContextF()
117 #define GetEvaluationForTable() GetEvaluationForTableF()
118 #if EVALDEBUG
119 #if (EVALDEBUG == 1 || EVALDEBUG == 3)
120 #define SetEvaluationContext(i) SetEvaluationContextF((i),__FILE__,__LINE__)
121 #else /* evaldebug 12 */
122 #define SetEvaluationContext(i) SetEvaluationContextF(i)
123 #endif /* evaldebug 12 */
124 #if (EVALDEBUG == 2 || EVALDEBUG == 3)
125 #define SetEvaluationForTable(ft) SetEvaluationForTableF((ft),__FILE__,__LINE__)
126 #else /* evaldebug 23 */
127 #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
128 #endif /* evaldebug 23 */
129 #else /* evaldebug */
130 #define SetEvaluationContext(i) SetEvaluationContextF(i)
131 #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
132 #endif /* evaldebug */
133 #else /* ndebug */
134 #define GetEvaluationContext() g_EvaluationContext
135 #define SetEvaluationContext(i) g_EvaluationContext = (i)
136 #define GetEvaluationForTable() g_EvaluationForTable
137 #define SetEvaluationForTable(ft) g_EvaluationForTable = (ft)
138 #endif /* ndebug */
139
140 /*
141 * Wrappers mainly for break point purposes of g_EvaluationContext
142 * and g_EvaluationForTable.
143 */
144 extern struct Instance *GetEvaluationContextF(void);
145 /**< retrieve the evaluation context (mainly for debugging) */
146
147 extern struct for_table_t *GetEvaluationForTableF(void);
148 /**< retrieve the evaluation for table (mainly for debugging) */
149
150 #if EVALDEBUG /* version printing file/line when setting globals */
151 extern void SetEvaluationContextF(CONST struct Instance *i
152 #if (EVALDEBUG == 1 || EVALDEBUG == 3)
153 ,char *file, int line
154 #endif /* evaldebug 13 */
155 );
156 /**< set the evaluation context (mainly for debugging) */
157
158 extern void SetEvaluationForTableF(struct for_table_t *ft
159 #if (EVALDEBUG == 2 || EVALDEBUG == 3)
160 ,char *file, int line
161 #endif /* evaldebug 23 */
162 );
163 /**< set the evaluation for table (mainly for debugging) */
164
165 #else /* evaldebug */
166 extern void SetEvaluationContextF(CONST struct Instance *i);
167 /**< set the evaluation context (mainly for debugging) */
168 extern void SetEvaluationForTableF(struct for_table_t *ft);
169 /**< set the evaluation for table (mainly for debugging) */
170 #endif /* evaldebug*/
171
172 extern struct value_t InstanceEvaluateName(CONST struct Name *nptr);
173 /**<
174 * <!-- struct value_t InstanceEvaluateName(nptr) -->
175 * <!-- struct Name *nptr; -->
176 * This evaluates the name in the context given by EvaluationContext.
177 * This must be set before the InstanceEvaluateName call. Note since
178 * this is a global variable you cannot evaluate names in more than
179 * one context simultaneously.<br><br>
180 *
181 * If EvaluationForTable is non-NULL, the for table will be checked before
182 * the instance tree.
183 */
184
185 extern struct value_t InstanceEvaluateSatisfiedName(CONST struct Name *nptr,
186 double tol);
187 /**<
188 * <!-- struct value_t InstanceEvaluateName(nptr,tol) -->
189 * <!-- struct Name *nptr; -->
190 * <!-- double tol; -->
191 *
192 * This functionis specially to evaluate name of relations or logical
193 * relations included in SATISFIED expressions.
194 * This evaluates the name in the context given by EvaluationContext.
195 * This must be set before the InstanceEvaluateName call. Note since
196 * this is a global variable you cannot evaluate names in more than
197 * one context simultaneously.
198 * If EvaluationForTable is non-NULL, the for table will be checked before
199 * the instance tree.
200 */
201
202 extern struct gl_list_t *FindInstances(CONST struct Instance *i,
203 CONST struct Name *n,
204 enum find_errors *err);
205 /**<
206 * <!-- struct gl_list_t *FindInstances(i,n,err) -->
207 * <!-- struct Instance *i; -->
208 * <!-- CONST struct Name *n; -->
209 * <!-- enum find_errors *err; -->
210 * Return the list of instances specified by n. If this returns NULL,
211 * it indicates that it couldn't find the name. Check err to discover why.
212 */
213
214 #endif /* ASC_FIND_H */
215

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