/[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 11 - (hide annotations) (download) (as text)
Sat Nov 13 16:45:56 2004 UTC (15 years, 8 months ago) by aw0a
File MIME type: text/x-chdr
File size: 6749 byte(s)
moving things to base/generic
1 aw0a 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     #ifndef __FIND_H_SEEN__
31     #define __FIND_H_SEEN__
32     /*
33     * When #including find.h, make sure these files are #included first:
34     * #include "fractions.h"
35     * #include "compiler.h"
36     * #include "dimen.h"
37     * #include "types.h"
38     */
39    
40    
41     enum find_errors {
42     unmade_instance, /* in searching found an unmade instance (NULL child)*/
43     undefined_instance, /* instance in an expression is unknown child */
44     impossible_instance, /* name cannot possibily exist(real error),often sets*/
45     correct_instance /* return value when everything went okay */
46     };
47     /*
48     * At present, there is a GREAT DEAL of insanity between find_errors and
49     * evaluation_error (value_type.h). In particular there is a lot of idiocy
50     * mapping undefined_instance <--> undefined_value which is just plain wrong
51     * in most cases.
52     */
53    
54     extern int ListMode;
55     /*
56     * Tells whether to evaluate a set strictly as a set i.e no order,
57     * or as a list, i.e., with order important.
58     */
59    
60     extern int EvaluatingSets;
61     /*
62     * Tells whether the evaluation of a set is in place. Used for marking
63     * atoms as mutable or not.
64     */
65    
66     extern int g_DeclarativeContext;
67     /*
68     * Tells whether declarative processing, the default = 0 , is in effect,
69     * or procedural processing as when doing initializations.
70     * Access this varible only by get and set operators below.
71     */
72     #define FINDEBUG 0
73     #if (FINDEBUG==0)
74     #define GetDeclarativeContext() g_DeclarativeContext
75     #define SetDeclarativeContext(n) g_DeclarativeContext = (n)
76     #else
77     #define GetDeclarativeContext() GetDeclarativeContextF()
78     #define SetDeclarativeContext(n) SetDeclarativeContextF((n),__FILE__,__LINE__)
79     #endif
80     /* wrapper functions for debugging */
81     extern int GetDeclarativeContextF(void);
82     extern void SetDeclarativeContextF(int,char *,int);
83    
84     /*
85     * Global variables used throughout semantic analysis to
86     * indicate context of evaluation. Do Not reference these
87     * directly, but use the macros for them instead.
88     */
89     extern CONST struct Instance *g_EvaluationContext;
90     extern struct for_table_t *g_EvaluationForTable;
91     #ifndef NDEBUG
92     #define EVALDEBUG 0 /* 1 = contextnoisy, 2 = fornoisy, 3 = both */
93     #define GetEvaluationContext() GetEvaluationContextF()
94     #define GetEvaluationForTable() GetEvaluationForTableF()
95     #if EVALDEBUG
96     #if (EVALDEBUG == 1 || EVALDEBUG == 3)
97     #define SetEvaluationContext(i) SetEvaluationContextF((i),__FILE__,__LINE__)
98     #else /* evaldebug12*/
99     #define SetEvaluationContext(i) SetEvaluationContextF(i)
100     #endif /* evaldebug 12*/
101     #if (EVALDEBUG == 2 || EVALDEBUG == 3)
102     #define SetEvaluationForTable(ft) SetEvaluationForTableF((ft),__FILE__,__LINE__)
103     #else /* evaldebug 23 */
104     #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
105     #endif /* evaldebug 23*/
106     #else /*evaldebug*/
107     #define SetEvaluationContext(i) SetEvaluationContextF(i)
108     #define SetEvaluationForTable(ft) SetEvaluationForTableF(ft)
109     #endif /*evaldebug*/
110     #else /* ndebug */
111     #define GetEvaluationContext() g_EvaluationContext
112     #define SetEvaluationContext(i) g_EvaluationContext = (i)
113     #define GetEvaluationForTable() g_EvaluationForTable
114     #define SetEvaluationForTable(ft) g_EvaluationForTable = (ft)
115     #endif /*ndebug*/
116     /*
117     * Wrappers mainly for break point purposes of g_EvaluationContext
118     * and g_EvaluationForTable.
119     */
120     extern struct Instance *GetEvaluationContextF(void);
121     extern struct for_table_t *GetEvaluationForTableF(void);
122     #if EVALDEBUG /* version printing file/line when setting globals */
123     extern void SetEvaluationContextF(CONST struct Instance *
124     #if (EVALDEBUG == 1 || EVALDEBUG == 3)
125     ,char *,int
126     #endif /* evaldebug 13*/
127     );
128     extern void SetEvaluationForTableF(struct for_table_t *
129     #if (EVALDEBUG == 2 || EVALDEBUG == 3)
130     ,char *,int
131     #endif /* evaldebug 23*/
132     );
133     #else /* evaldebug */
134     extern void SetEvaluationContextF(CONST struct Instance *);
135     extern void SetEvaluationForTableF(struct for_table_t *);
136     #endif /* evaldebug*/
137    
138     extern struct value_t InstanceEvaluateName(CONST struct Name *);
139     /*
140     * struct value_t InstanceEvaluateName(nptr)
141     * struct Name *nptr;
142     * This evaluates the name in the context given by EvaluationContext.
143     * This must be set before the InstanceEvaluateName call. Note since
144     * this is a global variable you cannot evaluate names in more than
145     * one context simultaneously.
146     *
147     * If EvaluationForTable is non-NULL, the for table will be checked before
148     * the instance tree.
149     */
150    
151     extern struct value_t InstanceEvaluateSatisfiedName(CONST struct Name *,
152     double tol);
153     /*
154     * struct value_t InstanceEvaluateName(nptr,tol)
155     * struct Name *nptr;
156     * double tol;
157     *
158     * This functionis specially to evaluate name of relations or logical
159     * relations included in SATISFIED expressions.
160     * This evaluates the name in the context given by EvaluationContext.
161     * This must be set before the InstanceEvaluateName call. Note since
162     * this is a global variable you cannot evaluate names in more than
163     * one context simultaneously.
164     * If EvaluationForTable is non-NULL, the for table will be checked before
165     * the instance tree.
166     */
167    
168     extern struct gl_list_t *FindInstances(CONST struct Instance *,
169     CONST struct Name *,
170     enum find_errors *);
171     /*
172     * struct gl_list_t *FindInstances(i,n,err)
173     * struct Instance *i;
174     * CONST struct Name *n;
175     * enum find_errors *err;
176     * Return the list of instances specified by n. If this returns NULL,
177     * it indicates that it couldn't find the name. Check err to discover why.
178     */
179     #endif /* __FIND_H_SEEN__ */

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