1Uil(library call) Uil(library call)
2
3
4
6 Uil — Invokes the UIL compiler from within an application
7
9 #include <uil/UilDef.h>
10
11 Uil_status_type Uil(
12 Uil_command_type *command_desc,
13 Uil_compile_desc_type **compile_desc,
14 Uil_continue_type (*message_cb) (),
15 char *message_data,
16 Uil_continue_type (*status_cb) (),
17 char *status_data);
18
20 The Uil function provides a callable entry point for the UIL compiler.
21 The Uil callable interface can be used to process a UIL source file and
22 to generate UID files, as well as return a detailed description of the
23 UIL source module in the form of a symbol table (parse tree).
24
25 command_desc
26 Specifies the uil command line.
27
28 compile_desc
29 Returns the results of the compilation.
30
31 message_cb
32 Specifies a callback function that is called when the com‐
33 piler encounters errors in the UIL source.
34
35 message_data
36 Specifies user data that is passed to the message callback
37 function (message_cb). Note that this argument is not inter‐
38 preted by UIL, and is used exclusively by the calling appli‐
39 cation.
40
41 status_cb Specifies a callback function that is called to allow X
42 applications to service X events such as updating the screen.
43 This function is called at various check points, which have
44 been hard coded into the UIL compiler. The sta‐
45 tus_update_delay argument in command_desc specifies the num‐
46 ber of check points to be passed before the status_cb func‐
47 tion is invoked.
48
49 status_data
50 Specifies user data that is passed to the status callback
51 function (status_cb). Note that this argument is not inter‐
52 preted by the UIL compiler and is used exclusively by the
53 calling application.
54
55 Following are the data structures Uil_command_type and Uil_com‐
56 pile_desc_type:
57
58 typedef struct Uil_command_type {
59 char *source_file;
60 /* single source to compile */
61 char *resource_file; /* name of output file */
62 char *listing_file; /* name of listing file */
63 unsigned int *include_dir_count;
64 /* number of dirs. in include_dir */
65 char *((*include_dir) []);
66 /* dir. to search for include files */
67 unsigned listing_file_flag: 1;
68 /* produce a listing */
69 unsigned resource_file_flag: 1;
70 /* generate UID output */
71 unsigned machine_code_flag: 1;
72 /* generate machine code */
73 unsigned report_info_msg_flag: 1;
74 /* report info messages */
75 unsigned report_warn_msg_flag: 1;
76 /* report warnings */
77 unsigned parse_tree_flag: 1;
78 /* generate parse tree */
79 unsigned int status_update_delay;
80 /* number of times a status point is */
81 /* passed before calling status_cb */
82 /* function 0 means called every time */
83 char *database;
84 /* name of database file */
85 unsigned database_flag: 1;
86 /* read a new database file */
87 unsigned use_setlocale_flag: 1;
88 /* enable calls to setlocale */
89 };
90 typedef struct Uil_compile_desc_type {
91 unsigned int compiler_version;
92 /* version number of compiler */
93 unsigned int data_version;
94 /* version number of structures */
95 char *parse_tree_root; /* parse tree output */
96 unsigned int message_count [Uil_k_max_status+1];
97 /* array of severity counts */
98 };
99
100 Following is a description of the message callback function specified
101 by message_cb:
102
103 Uil_continue_type (*message_cb) (message_data, message_number, severity, msg_buffer,
104 src_buffer, ptr_buffer, loc_buffer, message_count)
105 char *message_data;
106 int message_number;
107 int severity;
108 char *msg_buffer, *src_buffer;
109 char *ptr_buffer, *loc_buffer;
110 int message_count[];
111
112 This function specifies a callback function that UIL invokes instead of
113 printing an error message when the compiler encounters an error in the
114 UIL source. The callback should return one of the following values:
115
116 Uil_k_terminate
117 Terminate processing of the source file
118
119 Uil_k_continue
120 Continue processing the source file
121
122 The arguments are
123
124 message_data
125 Data supplied by the application as the message_data argument
126 to the Uil function. UIL does not interpret this data in any
127 way; it just passes it to the callback.
128
129 message_number
130 An index into a table of error messages and severities for
131 internal use by UIL.
132
133 severity An integer that indicates the severity of the error. The
134 possible values are the status constants returned by the Uil
135 function. See Return Value for more information.
136
137 msg_buffer
138 A string that describes the error.
139
140 src_buffer
141 A string consisting of the source line where the error
142 occurred. This string is not always available. In this case,
143 the argument is NULL.
144
145 ptr_buffer
146 A string consisting of whitespace and a printing character in
147 the character position corresponding to the column of the
148 source line where the error occurred. This string may be
149 printed beneath the source line to provide a visual indica‐
150 tion of the column where the error occurred. This string is
151 not always available. In this case, the argument is NULL.
152
153 loc_buffer
154 A string identifying the line number and file of the source
155 line where the error occurred. This is not always available;
156 the argument is then NULL.
157
158 message_count
159 An array of integers containing the number of diagnostic mes‐
160 sages issued thus far for each severity level. To find the
161 number of messages issued for the current severity level, use
162 the severity argument as the index into this array.
163
164 Following is a description of the status callback function specified by
165 status_cb:
166
167 Uil_continue_type (*status_cb) (status_data, percent_complete,
168 lines_processed, current_file, message_count)
169 char *status_data;
170 int percent_complete;
171 int lines_processed;
172 char *current_file;
173 int message_count[];
174
175 This function specifies a callback function that is invoked to allow X
176 applications to service X events such as updating the screen. The
177 callback should return one of the following values:
178
179 Uil_k_terminate
180 Terminate processing of the source file
181
182 Uil_k_continue
183 Continue processing the source file
184
185 The arguments are
186
187 status_data
188 Data supplied by the application as the status_data argument
189 to the Uil function. UIL does not interpret this data in any
190 way; it just passes it to the callback.
191
192 percent_complete
193 An integer indicating what percentage of the current source
194 file has been processed so far.
195
196 lines_processed
197 An integer indicating how many lines of the current source
198 file have been read so far.
199
200 current_file
201 A string containing the pathname of the current source file.
202
203 message_count
204 An array of integers containing the number of diagnostic mes‐
205 sages issued thus far for each severity level. To find the
206 number of messages issued for a given severity level, use the
207 severity level as the index into this array. The possible
208 severity levels are the status constants returned by the Uil
209 function. See Return Value for more information.
210
212 This function returns one of the following status return constants:
213
214 Uil_k_success_status
215 The operation succeeded.
216
217 Uil_k_info_status
218 The operation succeeded. An informational message is
219 returned.
220
221 Uil_k_warning_status
222 The operation succeeded. A warning message is returned.
223
224 Uil_k_error_status
225 The operation failed due to an error.
226
227 Uil_k_severe_status
228 The operation failed due to an error.
229
231 UilDumpSymbolTable(3) and uil(1).
232
233
234
235 Uil(library call)