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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 502 - (hide annotations) (download) (as text)
Tue Apr 18 12:57:30 2006 UTC (13 years, 11 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 jds 54 /*
2 aw0a 1 * 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 jds 54 /** @file
31     * Ascend Instance Tree Search Routines.
32     * <pre>
33 aw0a 1 * When #including find.h, make sure these files are #included first:
34 jds 54 * #include "utilities/ascConfig.h"
35 aw0a 1 * #include "fractions.h"
36     * #include "compiler.h"
37 jds 54 * #include "instance_enum.h"
38 aw0a 1 * #include "dimen.h"
39     * #include "types.h"
40 jds 54 * </pre>
41 aw0a 1 */
42    
43 johnpye 67 #ifndef ASC_FIND_H
44     #define ASC_FIND_H
45 aw0a 1
46 johnpye 502 #include <compiler/value_type.h>
47    
48     /**
49     * Search error codes.
50 aw0a 1 * 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 jds 54 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 aw0a 1
62     extern int ListMode;
63 jds 54 /**<
64 aw0a 1 * 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 johnpye 502 /**<
70 aw0a 1 * 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 johnpye 502 /**<
76 aw0a 1 * Tells whether declarative processing, the default = 0 , is in effect,
77     * or procedural processing as when doing initializations.
78 johnpye 502 * Access this varible only by GetDeclarativeContext() and
79 jds 54 * SetDeclarativeContext() below.
80 aw0a 1 */
81 jds 54
82 aw0a 1 #define FINDEBUG 0
83     #if (FINDEBUG==0)
84 jds 54 /** retrieve the declarative context */
85 aw0a 1 #define GetDeclarativeContext() g_DeclarativeContext
86     #define SetDeclarativeContext(n) g_DeclarativeContext = (n)
87 jds 54 /**< set the declarative context */
88 aw0a 1 #else
89 jds 54 /** retrieve the declarative context */
90 aw0a 1 #define GetDeclarativeContext() GetDeclarativeContextF()
91     #define SetDeclarativeContext(n) SetDeclarativeContextF((n),__FILE__,__LINE__)
92 jds 54 /**< set the declarative context */
93 aw0a 1 #endif
94     extern int GetDeclarativeContextF(void);
95 jds 54 /**< retrieve the declarative context (for debugging) */
96     extern void SetDeclarativeContextF(int value, char *file, int line);
97     /**< set the declarative context (for debugging) */
98 aw0a 1
99 jds 54 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 aw0a 1 */
106     extern struct for_table_t *g_EvaluationForTable;
107 jds 54 /**<
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 aw0a 1 #ifndef NDEBUG
115 ben.allan 33 #define EVALDEBUG 0 /**< 1 = contextnoisy, 2 = fornoisy, 3 = both */
116 aw0a 1 #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 jds 54 #else /* evaldebug 12 */
122 aw0a 1 #define SetEvaluationContext(i) SetEvaluationContextF(i)
123 jds 54 #endif /* evaldebug 12 */
124 aw0a 1 #if (EVALDEBUG == 2 || EVALDEBUG == 3)
125     #define SetEvaluationForTable(ft) SetEvaluationForTableF((ft),__FILE__,__LINE__)
126 jds 54 #else /* evaldebug 23 */
127 aw0a 1 #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
128 jds 54 #endif /* evaldebug 23 */
129     #else /* evaldebug */
130 aw0a 1 #define SetEvaluationContext(i) SetEvaluationContextF(i)
131     #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
132 jds 54 #endif /* evaldebug */
133     #else /* ndebug */
134 aw0a 1 #define GetEvaluationContext() g_EvaluationContext
135     #define SetEvaluationContext(i) g_EvaluationContext = (i)
136     #define GetEvaluationForTable() g_EvaluationForTable
137     #define SetEvaluationForTable(ft) g_EvaluationForTable = (ft)
138 jds 54 #endif /* ndebug */
139    
140     /*
141 aw0a 1 * Wrappers mainly for break point purposes of g_EvaluationContext
142     * and g_EvaluationForTable.
143     */
144     extern struct Instance *GetEvaluationContextF(void);
145 jds 54 /**< retrieve the evaluation context (mainly for debugging) */
146    
147 aw0a 1 extern struct for_table_t *GetEvaluationForTableF(void);
148 jds 54 /**< 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 aw0a 1 #if (EVALDEBUG == 1 || EVALDEBUG == 3)
153 jds 54 ,char *file, int line
154     #endif /* evaldebug 13 */
155 aw0a 1 );
156 jds 54 /**< set the evaluation context (mainly for debugging) */
157    
158     extern void SetEvaluationForTableF(struct for_table_t *ft
159 aw0a 1 #if (EVALDEBUG == 2 || EVALDEBUG == 3)
160 jds 54 ,char *file, int line
161     #endif /* evaldebug 23 */
162 aw0a 1 );
163 jds 54 /**< set the evaluation for table (mainly for debugging) */
164 aw0a 1
165 jds 54 #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 aw0a 1 * 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 jds 54 * one context simultaneously.<br><br>
180 aw0a 1 *
181     * If EvaluationForTable is non-NULL, the for table will be checked before
182     * the instance tree.
183     */
184    
185 jds 54 extern struct value_t InstanceEvaluateSatisfiedName(CONST struct Name *nptr,
186 aw0a 1 double tol);
187 jds 54 /**<
188     * <!-- struct value_t InstanceEvaluateName(nptr,tol) -->
189     * <!-- struct Name *nptr; -->
190     * <!-- double tol; -->
191 aw0a 1 *
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 jds 54 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 aw0a 1 * 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 jds 54
214 johnpye 67 #endif /* ASC_FIND_H */
215 jds 54

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