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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1066 - (show annotations) (download) (as text)
Sun Jan 7 10:02:41 2007 UTC (17 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 6077 byte(s)
Adding doxygen 'addtogroup' for Solver, Compiler, Integrator.
1 /* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3 Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
4
5 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
10 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
15 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 by Tom Epperly
21 Last in CVS: $Revision: 1.26 $ $Date: 2000/01/25 02:26:02 $ $Author: ballan $
22 *//** @file
23 Basic Definitions for Ascend
24
25 @NOTE
26 This header and tcl/tk headers are known to conflict. This header
27 should be included AFTER tcl.h or tk.h, not before.
28
29 This module defines the fundamental constants used by the rest of
30 Ascend and pulls in system headers. There is not a corresponding
31 compiler.c. The variables declared in this header are defined
32 in ascParse.y.
33 */
34
35 #ifndef ASC_COMPILER_H
36 #define ASC_COMPILER_H
37
38 /** addtogroup compiler Compiler
39 @{
40 */
41
42 #include <utilities/ascConfig.h>
43
44 /* some influential defines and where to set them:
45 ATDEBUG anontype.c -- controls anon type/relation sharing spew
46 ASC_NO_POOL -- compiler -D flag. Turn off many memory recycles of small objects.
47 ASC_NO_TRAPS -- compiler -D flag. Turn off traps/setjmp/longjump.
48 */
49
50 #ifndef TIMECOMPILER
51 #define TIMECOMPILER 1
52 /**< Set to 1 for timing spew or 0 for not. */
53 #endif
54
55 #ifndef CHECK_SYMBOL_USE
56 #ifdef NDEBUG
57 #define CHECK_SYMBOL_USE 0
58 #else
59 #define CHECK_SYMBOL_USE 1
60 #endif
61 #endif
62 /**<
63 * Define to check internal and client compliance with symbol
64 * table requirements. 0 for production code.
65 */
66
67 #if CHECK_SYMBOL_USE
68
69 #ifndef __GNUC__
70 /** strcmp() is dumb in string.h. We want it to whine a lot. */
71 extern int strcmp(CONST char *s1, CONST char *s2);
72 #endif /* __GNU__ */
73 typedef CONST double symchar;
74 #else /* !CHECK_SYMBOL_USE */
75 /* This is the real definition for production builds. */
76 typedef CONST char symchar;
77 #endif /* CHECK_SYMBOL_USE */
78 /**<
79 * Symchar exists so we can be very clear about strings coming from
80 * symbol tables. If it's a pair of symchar *, it is a sufficient
81 * comparison to compare the pointers if only equality is sought.
82 * Sorting functions should use CmpSymchar. <br><br>
83 *
84 * WARNING: this typedef may change in the future when we get a
85 * real symbol table. Avoid treating symchar directly as char *,
86 * or your code will most likely not compile and not run.<br><br>
87 *
88 * Compile with CHECK_SYMBOL_USE defined to check for proper symchar
89 * usage. This non-integral typedef forces all the whines on
90 * virtually all compilers. The only way to shut it up is to use
91 * AddSymbol() , symchars, and SCP() correctly. The visible typedef
92 * does not change the actual symchar semantics, which is just a
93 * string. Dereferencing a symchar when typedef'd as double will
94 * usually cause a bus error unless the string happens to
95 * occur at an 8-byte round address. It's very easy to spot
96 * code which abuses our symbol table conventions now.
97 */
98
99 #define SCP(s) ((CONST char *)(s))
100 /**<
101 * Returns the string ptr from a symchar ptr, whatever a symchar is.
102 * If you need a just plain (char *) for I/O (tcl perhaps) just write
103 * (char *)SCP(foo)
104 */
105
106 #define SCLEN(s) (*(int *)(((char *)s)-sizeof(int)))
107 /**<
108 * Returns, at considerably less expense, strlen(SCP(s)).
109 * This macro looks up the length of the string in an int stored
110 * just before the character string itself.
111 */
112
113 /** bracedtext atomic type. see braced.h */
114 struct bracechar;
115
116 /* globals from ascParse.y that yacc won't put in ascParse.h generated. */
117
118 ASC_DLLSPEC int g_compiler_warnings;
119 /**<
120 * Flag to turn on ASCEND instantiation whinings in various ways.
121 * higher values mean more spew. 0 = no warnings.
122 * Variable is declared in ascParse.y.
123 */
124
125 ASC_DLLSPEC int g_parser_warnings;
126 /**<
127 * Flag to turn on lint-like ASCEND whinings in various ways.
128 * higher values mean less spew. 0 = no warnings.
129 * Variable is declared in typelint.c.
130 */
131
132 extern int g_parse_relns;
133 /**<
134 * Flag to abandon relation productions.
135 * A very bad idea, but useful for benchmarking sometimes.
136 */
137
138 ASC_DLLSPEC int g_simplify_relations;
139 /**<
140 * Turn on or off relation simplification as noted in
141 * relation.h. This variable is defined in relation.c and
142 * headered here for UI exports.
143 */
144
145 ASC_DLLSPEC int g_use_copyanon;
146 /**<
147 * Turn on/off relation sharing.
148 *
149 * If TRUE, anonymous type detection is used to enable relation
150 * sharing. This variable is defined in instantiate.c and
151 * headered for export in compiler.h.
152 */
153
154 /* Simple types eligible to be ATOM children. */
155 #define BASE_REAL_NAME "real"
156 #define BASE_INTEGER_NAME "integer"
157 #define BASE_SYMBOL_NAME "symbol"
158 #define BASE_BOOLEAN_NAME "boolean"
159 #define BASE_SET_NAME "set"
160 /* Simple types NOT eligible to be ATOM children. */
161 #define BASE_CON_REAL_NAME "real_constant"
162 #define BASE_CON_INTEGER_NAME "integer_constant"
163 #define BASE_CON_BOOLEAN_NAME "boolean_constant"
164 #define BASE_CON_SYMBOL_NAME "symbol_constant"
165 /* relation, etc names */
166 #define BASE_REL_NAME "relation"
167 #define BASE_LOGREL_NAME "logic_relation"
168 #define BASE_WHEN_NAME "when"
169 #define BASE_EXT_NAME "EXTERNAL_MODEL"
170 #define BASE_UNSELECTED "unSELECTed_part"
171 /*
172 * Don't randomly change these, as ASCEND MODEL code assumes they
173 * are what they are. Changing these constitutes requiring a global
174 * revision of ASCEND models.
175 *
176 * Don't strcmp with these to a SCP(symchar) string: use
177 * CmpSymchar(GetBaseTypeName(enum type_kind),symchar) instead from
178 * type_descio.h instead.
179 */
180
181 /* @} */
182
183 #endif /* ASC_COMPILER_H */
184

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