/[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 615 - (show annotations) (download) (as text)
Wed May 17 06:29:40 2006 UTC (16 years, 4 months ago) by johnpye
File MIME type: text/x-chdr
File size: 6641 byte(s)
Forced pygtk to share major env vars with base library.
Modified 'can't use this here' error messages.
Added notification when colour codes are being disabled.
1 /* ASCEND modelling environment
2 Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
3 Copyright (C) 2006 Carnegie Mellon University
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 @file
21 Permanent Statement Output routines.
22
23 #include <stdio.h>
24 #include "utilities/ascConfig.h"
25 #include "fractions.h"
26 #include "compiler.h"
27 #include "dimen.h"
28 #include "types.h"
29 #include "stattypes.h"
30 #include "list.h"
31 *//*
32 by Tom Epperly
33 Version: $Revision: 1.14 $
34 Version control file: $RCSfile: statio.h,v $
35 Date last modified: $Date: 1997/07/28 20:52:13 $
36 Last modified by: $Author: ballan $
37 */
38
39 #ifndef ASC_STATIO_H
40 #define ASC_STATIO_H
41
42 ASC_DLLSPEC(struct gl_list_t *) GetTypeNamesFromStatList(CONST struct StatementList*sl);
43 /**<
44 * Return a gl_list of types referenced by the statement list
45 * given. If no types referenced, list will be empty but not NULL.
46 * List is sorted alphabetically. There may be duplicates. There
47 * may be undefined types if the compiler allows it.<br><br>
48 *
49 * This operator should be reimplemented to use the childlist, since all
50 * types are now caught in that list and it is much faster than
51 * reprocessing the several lists that define a type.
52 */
53
54 ASC_DLLSPEC(void ) WriteStatement(FILE *f, CONST struct Statement *s, int i);
55 /**<
56 * Print a statement with i leading blanks and a trailing newline.
57 */
58
59 extern unsigned long StatementListLength(CONST struct StatementList *sl);
60 /**<
61 * Returns the number of statements in the list, which may be 0.
62 * On NULL input, returns 0 -- and much code relies on this fact.
63 */
64
65 extern void WriteDiffStatementList(FILE *f, CONST struct StatementList *sl1,
66 CONST struct StatementList *sl2, int i);
67 /**<
68 * Print a statement list with i leading blanks for each line which
69 * is the statements on sl2 that are not on sl1.
70 * Avoid printing twice the statements inside a SELECT.
71 */
72
73 extern void WriteStatementList(FILE *f, CONST struct StatementList *sl, int i);
74 /**<
75 * Print a statement list with i leading blanks for each line.
76 * Avoid printing twice the statements inside a SELECT.
77 */
78
79 #define WSS(f,s) WriteStatementSuppressed(f,s)
80 /**< Shorhand for WriteStatementSuppressed(). */
81 extern void WriteStatementSuppressed(FILE *f, CONST struct Statement *stat);
82 /**<
83 * Notify the user that a statement is being suppressed with a message
84 * printed on file f.
85 */
86
87 /** Write a ASC_PROG_NOTE message using WriteStatementErrorMessage(). */
88 #define WSNM(FILEP,STMT,MSG) WriteStatementErrorMessage(FILEP,STMT,MSG,1,-1)
89
90 #define STATEMENT_NOTE(STMT,MSG) WriteStatementErrorMessage(ASCERR,STMT,MSG,1,-1)
91
92 /** Write a verbose error message using WriteStatementErrorMessage(). */
93 #define WSEM(FILEP,STMT,MSG) WriteStatementErrorMessage(FILEP,STMT,MSG,1,0)
94
95 #define STATEMENT_ERROR(STMT,MSG) WriteStatementErrorMessage(ASCERR,STMT,MSG,1,0)
96
97 /** Write a brief error message using WriteStatementErrorMessage(). */
98 #define WSSM(FILEP,STMT,MSG,l) WriteStatementErrorMessage(FILEP,STMT,MSG,0,l)
99 extern void WriteStatementErrorMessage(FILE *f,
100 CONST struct Statement *stat,
101 CONST char *message,
102 int noisy,
103 int level);
104 /**<
105 * This procedure is an attempt to standardize statement error printing,
106 * so that all statement error messages are printed with the same formatting.
107 * Typically this procedure will print the "message" followed by the filename
108 * and line number where the error occurs.<br><br>
109 *
110 * If noisy != 0, will include expressions when writing relations.
111 * FOR table information will also be displayed when appropriate.
112 *
113 * If level !=0, will write in different format:
114 * - 1 => Asc-Style: Line %lu <filename>: \n\tmessage\n<statement>
115 * - 2 => Asc-Warning: Line %lu <filename>: \n\tmessage\n<statement>
116 * - 3 => Asc-Error: Line %lu <filename>: \n\tmessage\n<statement>
117 * - 4 => Asc-Fatal: Line %lu <filename>: \n\tmessage\n<statement>
118 */
119
120 extern CONST char *StatioLabel(int level);
121 /**<
122 * Returns an Asc-#######: label padded to a uniform length.
123 * You don't own the string returned.
124 * If you give us invalid level, label 0 is returned.
125 * StatioLabels are defined in WriteStatementErrorMessage above.
126 */
127
128 extern int *GetStatioSuppressions(void);
129 /**<
130 * Returns a table initialized so that all statement types are
131 * NOT suppressed. To suppress a statement type,
132 * set table[statement_enum_of_type_you_hate] = 1.
133 */
134
135 extern void DestroySuppressions(int *table);
136 /**<
137 * Destroys a table of suppressions from GetStatioSuppressions.
138 */
139
140 #define WSEMSPARSE(f,s,m,t) WriteStatementErrorSparse(f,s,m,t)
141 /**< Shorthand for WriteStatementErrorSparse(). */
142
143 extern void WriteStatementErrorSparse(FILE *f,
144 CONST struct Statement *stat,
145 CONST char *message,
146 int *table);
147 /**<
148 * This procedure is an attempt to standardize statement error printing,
149 * so that all statement error messages are printed with the same formatting.
150 * Typically this procedure will print the "message" followed by the filename
151 * and line number where the error occurs.
152 * FOR information will also be displayed when appropriate.
153 */
154
155 extern symchar *StatementTypeString(CONST struct Statement *stat);
156 /**<
157 * Returns a string from the symbol table corresponding to the
158 * statement type given.
159 */
160
161 extern void Asc_StatErrMsg_NotAllowedMethod(FILE *f
162 , CONST struct Statement *stat
163 , CONST char *suggestion
164 );
165 /**<
166 * Writes a message to the file given indicating the statement is not
167 * allowed in a method.
168 */
169
170 extern void Asc_StatErrMsg_NotAllowedDeclarative(FILE *f
171 , CONST struct Statement *stat
172 , CONST char *suggestion
173 );
174 /**<
175 * Writes a message to the file given indicating the statement is not
176 * allowed in a declarative MODEL body.
177 */
178
179 #endif /* ASC_STATIO_H */
180

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