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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 521 - (show annotations) (download) (as text)
Fri Apr 21 05:35:59 2006 UTC (14 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 9529 byte(s)
Getting the modular version the Tcl/Tk GUI working. In progress.
1 /*
2 * Permanent Statement Output routines
3 * by Tom Epperly
4 * Version: $Revision: 1.14 $
5 * Version control file: $RCSfile: statio.h,v $
6 * Date last modified: $Date: 1997/07/28 20:52:13 $
7 * Last modified by: $Author: ballan $
8 *
9 * This file is part of the Ascend Language Interpreter.
10 *
11 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
12 *
13 * The Ascend Language Interpreter is free software; you can redistribute
14 * it and/or modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of the
16 * License, or (at your option) any later version.
17 *
18 * The Ascend Language Interpreter is distributed in hope that it will be
19 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with the program; if not, write to the Free Software Foundation, Inc., 675
25 * Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING.
26 */
27
28 /** @file
29 * Permanent Statement Output routines.
30 * <pre>
31 * When #including statio.h, make sure these files are #included first:
32 * #include <stdio.h>
33 * #include "utilities/ascConfig.h"
34 * #include "fractions.h"
35 * #include "compiler.h"
36 * #include "dimen.h"
37 * #include "types.h"
38 * #include "stattypes.h"
39 * #include "list.h"
40 * </pre>
41 */
42
43 #ifndef __STATIO_H_SEEN__
44 #define __STATIO_H_SEEN__
45
46 ASC_DLLSPEC(struct gl_list_t *) GetTypeNamesFromStatList(CONST struct StatementList*sl);
47 /**<
48 * <!-- struct gl_list_t *GetTypesFromStatList(sl) -->
49 * <!-- CONST struct StatementList *sl; -->
50 * Return a gl_list of types referenced by the statement list
51 * given. If no types referenced, list will be empty but not NULL.
52 * List is sorted alphabetically. There may be duplicates. There
53 * may be undefined types if the compiler allows it.<br><br>
54 *
55 * This operator should be reimplemented to use the childlist, since all
56 * types are now caught in that list and it is much faster than
57 * reprocessing the several lists that define a type.
58 */
59
60 extern void WriteStatement(FILE *f, CONST struct Statement *s, int i);
61 /**<
62 * <!-- void WriteStatement(f,s,i) -->
63 * <!-- FILE *f; -->
64 * <!-- const struct Statement *s; -->
65 * <!-- int i; -->
66 * Print a statement with i leading blanks and a trailing newline.
67 */
68
69 extern unsigned long StatementListLength(CONST struct StatementList *sl);
70 /**<
71 * <!-- unsigned long StatementListLength(CONST struct StatementList *); -->
72 * Returns the number of statements in the list, which may be 0.
73 * On NULL input, returns 0 -- and much code relies on this fact.
74 */
75
76 extern void WriteDiffStatementList(FILE *f, CONST struct StatementList *sl1,
77 CONST struct StatementList *sl2, int i);
78 /**<
79 * <!-- void WriteDiffStatementList(f,sl1,sl2,i) -->
80 * <!-- FILE *f; -->
81 * <!-- const struct StatementList *sl1, *sl2; -->
82 * <!-- int i; -->
83 * Print a statement list with i leading blanks for each line which
84 * is the statements on sl2 that are not on sl1.
85 * Avoid printing twice the statements inside a SELECT.
86 */
87
88 extern void WriteStatementList(FILE *f, CONST struct StatementList *sl, int i);
89 /**<
90 * <!-- void WriteStatementList(f,sl,i) -->
91 * <!-- FILE *f; -->
92 * <!-- const struct StatementList *sl; -->
93 * <!-- int i; -->
94 * Print a statement list with i leading blanks for each line.
95 * Avoid printing twice the statements inside a SELECT.
96 */
97
98 #define WSS(f,s) WriteStatementSuppressed(f,s)
99 /**< Shorhand for WriteStatementSuppressed(). */
100 extern void WriteStatementSuppressed(FILE *f, CONST struct Statement *stat);
101 /**<
102 * <!-- macro WSS(f,stat) -->
103 * <!-- void WriteStatementSuppressed(f,stat) -->
104 * <!-- FILE *f; -->
105 * <!-- const struct Statement *stat; -->
106 *
107 * Notify the user that a statement is being suppressed with a message
108 * printed on file f.
109 */
110
111 /** Write a ASC_PROG_NOTE message using WriteStatementErrorMessage(). */
112 #define WSNM(f,s,m) WriteStatementErrorMessage(f,s,m,1,-1)
113
114 /** Write a verbose error message using WriteStatementErrorMessage(). */
115 #define WSEM(f,s,m) WriteStatementErrorMessage(f,s,m,1,0)
116
117 /** Write a brief error message using WriteStatementErrorMessage(). */
118 #define WSSM(f,s,m,l) WriteStatementErrorMessage(f,s,m,0,l)
119 extern void WriteStatementErrorMessage(FILE *f,
120 CONST struct Statement *stat,
121 CONST char *message,
122 int noisy,
123 int level);
124 /**<
125 * <!-- macro WSEM(f,stat,message) Write a message verbosely. -->
126 * <!-- macro WSSM(f,stat,message,level) Write a shorter message. -->
127 * <!-- void WriteStatementErrorMessage(f,stat,message,noisy,level) -->
128 * <!-- FILE *f; -->
129 * <!-- const struct Statement *stat; -->
130 * <!-- const char *message; -->
131 * <!-- int noisy; -->
132 * <!-- int level; -->
133 *
134 * This procedure is an attempt to standardize statement error printing,
135 * so that all statement error messages are printed with the same formatting.
136 * Typically this procedure will print the "message" followed by the filename
137 * and line number where the error occurs.<br><br>
138 *
139 * If noisy != 0, will include expressions when writing relations.
140 * FOR table information will also be displayed when appropriate.
141 *
142 * If level !=0, will write in different format:
143 * - 1 => Asc-Style: Line %lu <filename>: \n\tmessage\n<statement>
144 * - 2 => Asc-Warning: Line %lu <filename>: \n\tmessage\n<statement>
145 * - 3 => Asc-Error: Line %lu <filename>: \n\tmessage\n<statement>
146 * - 4 => Asc-Fatal: Line %lu <filename>: \n\tmessage\n<statement>
147 */
148
149 extern CONST char *StatioLabel(int level);
150 /**<
151 * <!-- StatioLabel(level); -->
152 * Returns an Asc-#######: label padded to a uniform length.
153 * You don't own the string returned.
154 * If you give us invalid level, label 0 is returned.
155 * StatioLabels are defined in WriteStatementErrorMessage above.
156 */
157
158 extern int *GetStatioSuppressions(void);
159 /**<
160 * Returns a table initialized so that all statement types are
161 * NOT suppressed. To suppress a statement type,
162 * set table[statement_enum_of_type_you_hate] = 1.
163 */
164
165 extern void DestroySuppressions(int *table);
166 /**<
167 * Destroys a table of suppressions from GetStatioSuppressions.
168 */
169
170 #define WSEMSPARSE(f,s,m,t) WriteStatementErrorSparse(f,s,m,t)
171 /**< Shorthand for WriteStatementErrorSparse(). */
172 extern void WriteStatementErrorSparse(FILE *f,
173 CONST struct Statement *stat,
174 CONST char *message,
175 int *table);
176 /**<
177 * <!-- macro WSEMSPARSE(f,stat,message,table) -->
178 * <!-- void WriteStatementErrorSparse(f,stat,message,table) -->
179 * <!-- FILE *f; -->
180 * <!-- const struct Statement *stat; -->
181 * <!-- const char *message; -->
182 * <!-- int *table; -->
183 *
184 * This procedure is an attempt to standardize statement error printing,
185 * so that all statement error messages are printed with the same formatting.
186 * Typically this procedure will print the "message" followed by the filename
187 * and line number where the error occurs.
188 * FOR information will also be displayed when appropriate.
189 */
190
191 extern symchar *StatementTypeString(CONST struct Statement *stat);
192 /**<
193 * <!-- s = StatementTypeString(stat); -->
194 * <!-- symchar *s; -->
195 * <!-- CONST struct Statement *stat; -->
196 *
197 * Returns a string from the symbol table corresponding to the
198 * statement type given.
199 */
200
201 extern void Asc_StatErrMsg_NotAllowedMethod(FILE *f, CONST struct Statement *stat);
202 /**<
203 * Writes a message to the file given indicating the statement is not
204 * allowed in a method.
205 */
206
207 extern void Asc_StatErrMsg_NotAllowedDeclarative(FILE *f,
208 CONST struct Statement *stat);
209 /**<
210 * Writes a message to the file given indicating the statement is not
211 * allowed in a declarative MODEL body.
212 */
213
214 #endif /* __STATIO_H_SEEN__ */
215

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