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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1066 - (hide 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 johnpye 770 /* ASCEND modelling environment
2     Copyright (C) 2006 Carnegie Mellon University
3     Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
4 jds 54
5 johnpye 770 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 aw0a 1
10 johnpye 770 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 johnpye 67 #ifndef ASC_COMPILER_H
36     #define ASC_COMPILER_H
37 aw0a 1
38 johnpye 1066 /** addtogroup compiler Compiler
39     @{
40     */
41    
42 johnpye 770 #include <utilities/ascConfig.h>
43    
44 jds 54 /* some influential defines and where to set them:
45 ben.allan 14 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 aw0a 1
50 johnpye 371 #ifndef TIMECOMPILER
51 johnpye 908 #define TIMECOMPILER 1
52 jds 54 /**< Set to 1 for timing spew or 0 for not. */
53 johnpye 371 #endif
54 aw0a 1
55 johnpye 908 #ifndef CHECK_SYMBOL_USE
56 aw0a 1 #ifdef NDEBUG
57     #define CHECK_SYMBOL_USE 0
58     #else
59     #define CHECK_SYMBOL_USE 1
60     #endif
61 johnpye 908 #endif
62 jds 54 /**<
63     * Define to check internal and client compliance with symbol
64 johnpye 485 * table requirements. 0 for production code.
65 jds 54 */
66 aw0a 1
67     #if CHECK_SYMBOL_USE
68 jds 54
69 aw0a 1 #ifndef __GNUC__
70 jds 54 /** 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 aw0a 1 typedef CONST char symchar;
77 jds 54 #endif /* CHECK_SYMBOL_USE */
78     /**<
79 aw0a 1 * 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 jds 54 * Sorting functions should use CmpSymchar. <br><br>
83 aw0a 1 *
84     * WARNING: this typedef may change in the future when we get a
85     * real symbol table. Avoid treating symchar directly as char *,
86 jds 54 * 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 johnpye 485 * 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 jds 54 * 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 aw0a 1 */
98 jds 54
99 aw0a 1 #define SCP(s) ((CONST char *)(s))
100 jds 54 /**<
101     * Returns the string ptr from a symchar ptr, whatever a symchar is.
102 aw0a 1 * 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 jds 54 /**<
108     * Returns, at considerably less expense, strlen(SCP(s)).
109     * This macro looks up the length of the string in an int stored
110 aw0a 1 * just before the character string itself.
111     */
112    
113 jds 54 /** bracedtext atomic type. see braced.h */
114 aw0a 1 struct bracechar;
115    
116 jds 54 /* globals from ascParse.y that yacc won't put in ascParse.h generated. */
117 aw0a 1
118 johnpye 1063 ASC_DLLSPEC int g_compiler_warnings;
119 jds 54 /**<
120 aw0a 1 * 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 johnpye 1063 ASC_DLLSPEC int g_parser_warnings;
126 johnpye 485 /**<
127 jds 54 * Flag to turn on lint-like ASCEND whinings in various ways.
128 aw0a 1 * higher values mean less spew. 0 = no warnings.
129     * Variable is declared in typelint.c.
130     */
131    
132     extern int g_parse_relns;
133 jds 54 /**<
134     * Flag to abandon relation productions.
135     * A very bad idea, but useful for benchmarking sometimes.
136 aw0a 1 */
137    
138 johnpye 1063 ASC_DLLSPEC int g_simplify_relations;
139 jds 54 /**<
140     * Turn on or off relation simplification as noted in
141 aw0a 1 * relation.h. This variable is defined in relation.c and
142     * headered here for UI exports.
143     */
144    
145 johnpye 1063 ASC_DLLSPEC int g_use_copyanon;
146 jds 54 /**<
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 aw0a 1 */
153    
154 jds 54 /* Simple types eligible to be ATOM children. */
155 aw0a 1 #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 jds 54 /* Simple types NOT eligible to be ATOM children. */
161 aw0a 1 #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 jds 54 /* 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 aw0a 1 * 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 johnpye 485 * CmpSymchar(GetBaseTypeName(enum type_kind),symchar) instead from
178 aw0a 1 * type_descio.h instead.
179     */
180    
181 johnpye 1066 /* @} */
182    
183 johnpye 67 #endif /* ASC_COMPILER_H */
184 jds 54

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