comparison tests/agcl/examples/good/ffcalcx.c @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /* FOUR FUNCTION CALCULATOR: FFCALCX.SYN */
2 /*
3 * AnaGram, A System for Syntax Directed Programming
4 * File generated by: ...
5 *
6 * AnaGram Parsing Engine
7 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
8 *
9 * This software is provided 'as-is', without any express or implied
10 * warranty. In no event will the authors be held liable for any damages
11 * arising from the use of this software.
12 *
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
16 *
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software
19 * in a product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
24 */
25
26 #ifndef FFCALCX_H
27 #include "ffcalcx.h"
28 #endif
29
30 #ifndef FFCALCX_H
31 #error Mismatched header file
32 #endif
33
34 #include <ctype.h>
35 #include <stdio.h>
36
37 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
38 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
39 #define CONTEXT ((PCB).cs[(PCB).ssx])
40
41
42
43 ffcalcx_pcb_type ffcalcx_pcb;
44 #define PCB ffcalcx_pcb
45
46 /* Line -, ffcalcx.syn */
47 /* -- EMBEDDED C ---------------------------------- */
48 double value[64]; /* registers */
49 int main(void) {
50 ffcalcx();
51 return 0;
52 }
53
54 #ifndef CONVERT_CASE
55 #define CONVERT_CASE(c) (c)
56 #endif
57 #ifndef TAB_SPACING
58 #define TAB_SPACING 8
59 #endif
60
61 #define ag_rp_1(x) (printf("%g\n",x))
62
63 static void ag_rp_2(int n, double x) {
64 /* Line -, ffcalcx.syn */
65 printf("%c = %g\n",n+'A',value[n]=x);
66 }
67
68 #define ag_rp_3(n) (value[n])
69
70 #define ag_rp_4(x) (x)
71
72 #define ag_rp_5(x, t) (x+t)
73
74 #define ag_rp_6(x, t) (x-t)
75
76 #define ag_rp_7(t, f) (t*f)
77
78 #define ag_rp_8(t, f) (t/f)
79
80 #define ag_rp_9(f) (-f)
81
82 #define ag_rp_10(c) (c-'A')
83
84 #define ag_rp_11(i, f) (i+f)
85
86 #define ag_rp_12(f) (f)
87
88 #define ag_rp_13(d) (d-'0')
89
90 #define ag_rp_14(x, d) (10*x + d-'0')
91
92 #define ag_rp_15(d) ((d-'0')/10.)
93
94 #define ag_rp_16(d, f) ((d-'0' + f)/10.)
95
96
97 #define READ_COUNTS
98 #define WRITE_COUNTS
99 #undef V
100 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
101 #undef VS
102 #define VS(i) (PCB).vs[(PCB).ssx + i]
103
104 #ifndef GET_CONTEXT
105 #define GET_CONTEXT CONTEXT = (PCB).input_context
106 #endif
107
108 typedef enum {
109 ag_action_1,
110 ag_action_2,
111 ag_action_3,
112 ag_action_4,
113 ag_action_5,
114 ag_action_6,
115 ag_action_7,
116 ag_action_8,
117 ag_action_9,
118 ag_action_10,
119 ag_action_11,
120 ag_action_12
121 } ag_parser_action;
122
123
124 #ifndef NULL_VALUE_INITIALIZER
125 #define NULL_VALUE_INITIALIZER = { 0 }
126 #endif
127
128 static ffcalcx_vs_type const ag_null_value NULL_VALUE_INITIALIZER;
129
130 static const unsigned char ag_rpx[] = {
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, 0, 4, 5, 6, 7,
132 8, 9, 0, 0, 0, 0, 0, 0, 10, 11, 0, 0, 0, 12, 13, 14, 15, 16
133 };
134
135 static const unsigned char ag_key_itt[] = {
136 0
137 };
138
139 static const unsigned short ag_key_pt[] = {
140 0
141 };
142
143 static const unsigned char ag_key_ch[] = {
144 0, 47,255, 42,255
145 };
146
147 static const unsigned char ag_key_act[] = {
148 0,3,4,3,4
149 };
150
151 static const unsigned char ag_key_parm[] = {
152 0, 23, 0, 27, 0
153 };
154
155 static const unsigned char ag_key_jmp[] = {
156 0, 0, 0, 2, 0
157 };
158
159 static const unsigned char ag_key_index[] = {
160 1, 3, 1, 0, 3, 3, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
161 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0,
162 0, 0, 0
163 };
164
165 static const unsigned char ag_key_ends[] = {
166 42,0, 47,0,
167 };
168 #define AG_TCV(x) (((int)(x) >= -1 && (int)(x) <= 255) ? ag_tcv[(x) + 1] : 0)
169
170 static const unsigned char ag_tcv[] = {
171 15, 34, 34, 34, 34, 34, 34, 34, 34, 34, 22, 37, 22, 22, 22, 34, 34, 34,
172 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 22, 34, 34,
173 34, 34, 34, 34, 34, 41, 40, 44, 42, 34, 43, 30, 45, 33, 33, 33, 33, 33,
174 33, 33, 33, 33, 33, 34, 34, 34, 38, 34, 34, 34, 46, 46, 46, 46, 46, 46,
175 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
176 46, 46, 34, 34, 34, 34, 34, 34, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
177 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 34, 34,
178 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
179 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
180 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
181 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
182 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
183 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
184 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
185 34, 34, 34, 34, 34
186 };
187
188 #ifndef SYNTAX_ERROR
189 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \
190 (PCB).error_message, (PCB).line, (PCB).column)
191 #endif
192
193 #ifndef FIRST_LINE
194 #define FIRST_LINE 1
195 #endif
196
197 #ifndef FIRST_COLUMN
198 #define FIRST_COLUMN 1
199 #endif
200
201 #ifndef PARSER_STACK_OVERFLOW
202 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \
203 "\nParser stack overflow, line %d, column %d\n",\
204 (PCB).line, (PCB).column);}
205 #endif
206
207 #ifndef REDUCTION_TOKEN_ERROR
208 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
209 "\nReduction token error, line %d, column %d\n", \
210 (PCB).line, (PCB).column);}
211 #endif
212
213
214 typedef enum
215 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key,
216 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words;
217
218 #ifndef GET_INPUT
219 #define GET_INPUT ((PCB).input_code = getchar())
220 #endif
221
222
223 static int ag_look_ahead(void) {
224 if ((PCB).rx < (PCB).fx) {
225 return CONVERT_CASE((PCB).lab[(PCB).rx++]);
226 }
227 GET_INPUT;
228 (PCB).fx++;
229 return CONVERT_CASE((PCB).lab[(PCB).rx++] = (PCB).input_code);
230 }
231
232 static void ag_get_key_word(int ag_k) {
233 int save_index = (PCB).rx;
234 const unsigned char *sp;
235 int ag_ch;
236 while (1) {
237 switch (ag_key_act[ag_k]) {
238 case ag_cf_end_key:
239 sp = ag_key_ends + ag_key_jmp[ag_k];
240 do {
241 if ((ag_ch = *sp++) == 0) {
242 int ag_k1 = ag_key_parm[ag_k];
243 int ag_k2 = ag_key_pt[ag_k1];
244 if (ag_key_itt[ag_k2 + ag_look_ahead()]) goto ag_fail;
245 (PCB).rx--;
246 (PCB).token_number = (ffcalcx_token_type) ag_key_pt[ag_k1 + 1];
247 return;
248 }
249 } while (ag_look_ahead() == ag_ch);
250 goto ag_fail;
251 case ag_end_key:
252 sp = ag_key_ends + ag_key_jmp[ag_k];
253 do {
254 if ((ag_ch = *sp++) == 0) {
255 (PCB).token_number = (ffcalcx_token_type) ag_key_parm[ag_k];
256 return;
257 }
258 } while (ag_look_ahead() == ag_ch);
259 case ag_no_match_key:
260 ag_fail:
261 (PCB).rx = save_index;
262 return;
263 case ag_cf_set_key: {
264 int ag_k1 = ag_key_parm[ag_k];
265 int ag_k2 = ag_key_pt[ag_k1];
266 ag_k = ag_key_jmp[ag_k];
267 if (ag_key_itt[ag_k2 + (ag_ch = ag_look_ahead())]) break;
268 save_index = --(PCB).rx;
269 (PCB).token_number = (ffcalcx_token_type) ag_key_pt[ag_k1+1];
270 break;
271 }
272 case ag_set_key:
273 save_index = (PCB).rx;
274 (PCB).token_number = (ffcalcx_token_type) ag_key_parm[ag_k];
275 case ag_jmp_key:
276 ag_k = ag_key_jmp[ag_k];
277 ag_ch = ag_look_ahead();
278 break;
279 case ag_accept_key:
280 (PCB).token_number = (ffcalcx_token_type) ag_key_parm[ag_k];
281 return;
282 case ag_cf_accept_key: {
283 int ag_k1 = ag_key_parm[ag_k];
284 int ag_k2 = ag_key_pt[ag_k1];
285 if (ag_key_itt[ag_k2 + ag_look_ahead()]) (PCB).rx = save_index;
286 else {
287 (PCB).rx--;
288 (PCB).token_number = (ffcalcx_token_type) ag_key_pt[ag_k1+1];
289 }
290 return;
291 }
292 default:
293 /* not reachable; here to suppress compiler warnings */
294 goto ag_fail;
295 }
296 if (ag_ch <= 255) while (ag_key_ch[ag_k] < ag_ch) ag_k++;
297 if (ag_ch > 255 || ag_key_ch[ag_k] != ag_ch) {
298 (PCB).rx = save_index;
299 return;
300 }
301 }
302 }
303
304
305 #ifndef AG_NEWLINE
306 #define AG_NEWLINE 10
307 #endif
308
309 #ifndef AG_RETURN
310 #define AG_RETURN 13
311 #endif
312
313 #ifndef AG_FORMFEED
314 #define AG_FORMFEED 12
315 #endif
316
317 #ifndef AG_TABCHAR
318 #define AG_TABCHAR 9
319 #endif
320
321 static void ag_track(void) {
322 int ag_k = 0;
323 while (ag_k < (PCB).rx) {
324 int ag_ch = (PCB).lab[ag_k++];
325 switch (ag_ch) {
326 case AG_NEWLINE:
327 (PCB).column = 1, (PCB).line++;
328 case AG_RETURN:
329 case AG_FORMFEED:
330 break;
331 case AG_TABCHAR:
332 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
333 break;
334 default:
335 (PCB).column++;
336 }
337 }
338 ag_k = 0;
339 while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++];
340 (PCB).fx = ag_k;
341 (PCB).rx = 0;
342 }
343
344
345 static void ag_prot(void) {
346 int ag_k;
347 ag_k = 128 - ++(PCB).btsx;
348 if (ag_k <= (PCB).ssx) {
349 (PCB).exit_flag = AG_STACK_ERROR_CODE;
350 PARSER_STACK_OVERFLOW;
351 return;
352 }
353 (PCB).bts[(PCB).btsx] = (PCB).sn;
354 (PCB).bts[ag_k] = (PCB).ssx;
355 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
356 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
357 }
358
359 static void ag_undo(void) {
360 if ((PCB).drt == -1) return;
361 while ((PCB).btsx) {
362 int ag_k = 128 - (PCB).btsx;
363 (PCB).sn = (PCB).bts[(PCB).btsx--];
364 (PCB).ssx = (PCB).bts[ag_k];
365 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
366 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
367 }
368 (PCB).token_number = (ffcalcx_token_type) (PCB).drt;
369 (PCB).ssx = (PCB).dssx;
370 (PCB).sn = (PCB).dsn;
371 (PCB).drt = -1;
372 }
373
374
375 static const unsigned char ag_tstt[] = {
376 46,43,41,37,33,30,23,22,15,0,1,35,36,
377 46,45,44,43,42,41,40,38,37,34,33,30,27,22,0,25,26,
378 23,22,0,1,
379 46,43,41,37,33,30,19,15,0,2,4,7,8,9,10,12,13,14,16,17,20,28,29,39,
380 46,45,44,43,42,41,40,38,37,34,33,30,22,0,
381 27,0,
382 46,43,41,33,30,23,22,0,1,35,36,
383 33,0,31,
384 45,44,43,42,40,37,33,30,23,22,0,32,
385 45,44,43,42,40,38,37,23,22,0,1,35,36,
386 46,43,41,33,30,23,22,0,1,35,36,
387 45,44,43,42,40,37,23,22,0,1,35,36,
388 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
389 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
390 45,44,43,42,38,37,0,18,
391 45,44,43,42,37,0,3,4,5,6,
392 37,0,11,
393 46,43,41,37,33,30,19,15,0,2,4,7,9,10,12,16,17,20,28,29,39,
394 15,0,
395 45,44,43,42,40,37,33,23,22,0,31,
396 33,0,31,
397 45,44,43,42,40,37,0,3,4,5,6,
398 45,44,43,42,40,0,3,4,5,6,21,
399 46,43,41,33,30,23,22,0,1,35,36,
400 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
401 46,43,41,33,30,23,22,0,1,35,36,
402 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
403 46,43,41,33,30,23,22,0,1,35,36,
404 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
405 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
406 46,43,41,33,30,23,22,0,1,35,36,
407 46,43,41,33,30,0,2,4,7,16,17,20,28,29,39,
408 46,43,41,37,33,30,23,22,15,0,1,35,36,
409 45,44,43,42,40,37,23,22,0,1,35,36,
410 45,44,43,42,37,0,3,4,5,6,
411 45,44,43,42,40,37,0,3,4,5,6,
412 45,44,43,42,40,37,0,3,4,5,6,
413 45,44,43,42,40,37,0,3,4,5,6,
414 45,44,43,42,40,37,0,3,4,5,6,
415
416 };
417
418
419 static unsigned const char ag_astt[444] = {
420 8,8,8,8,8,8,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,8,1,7,1,1,1,9,5,3,1,1,1,
421 8,2,1,1,8,7,1,1,1,0,1,1,1,1,1,1,1,1,2,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,
422 5,5,5,5,5,1,1,7,1,1,3,1,7,2,5,5,5,5,5,5,10,1,5,5,7,3,5,5,5,5,5,5,5,1,1,7,1,
423 1,3,5,5,5,5,5,1,1,7,1,1,3,5,5,5,5,5,5,1,1,7,1,1,3,1,1,1,2,1,7,1,1,1,1,2,1,
424 2,1,1,1,1,1,2,1,7,1,1,1,1,2,1,2,1,1,4,4,4,4,1,4,7,1,1,1,1,1,4,7,1,1,1,1,1,
425 7,3,1,1,1,8,2,1,1,5,7,1,1,1,1,1,3,1,1,1,2,1,1,3,7,4,4,4,4,4,4,1,4,4,7,2,1,
426 5,2,4,4,4,4,4,4,7,1,1,1,1,1,1,1,1,1,7,1,1,1,1,2,5,5,5,5,5,1,1,7,1,1,3,1,1,
427 1,2,1,7,1,1,1,1,2,1,2,1,1,5,5,5,5,5,1,1,7,1,1,3,1,1,1,2,1,7,1,1,1,1,2,1,2,
428 1,1,5,5,5,5,5,1,1,7,1,1,3,1,1,1,2,1,7,1,1,1,1,2,1,2,1,1,1,1,1,2,1,7,1,1,1,
429 1,2,1,2,1,1,5,5,5,5,5,1,1,7,1,1,3,1,1,1,2,1,7,1,1,1,1,2,1,2,1,1,5,5,5,5,5,
430 5,1,1,5,7,1,1,3,5,5,5,5,5,5,1,1,7,1,1,3,1,1,1,1,4,7,1,1,1,1,4,4,4,4,4,4,7,
431 1,1,1,1,4,4,4,4,4,4,7,1,1,1,1,1,1,4,4,4,4,7,1,1,1,1,1,1,4,4,4,4,7,1,1,1,1
432 };
433
434
435 static const unsigned char ag_pstt[] = {
436 3,3,3,3,3,3,1,2,3,0,2,2,3,
437 4,4,4,4,4,4,4,4,4,4,4,4,5,4,1,4,5,
438 1,51,53,51,
439 9,6,10,16,32,7,16,18,3,15,12,12,0,16,16,17,17,18,15,14,13,26,8,11,
440 22,22,22,22,22,22,22,22,22,22,22,22,22,24,
441 25,5,
442 52,52,52,52,52,1,2,6,2,2,60,
443 19,7,31,
444 28,28,28,28,28,28,33,20,28,28,8,30,
445 52,52,52,52,52,52,52,1,2,9,2,2,63,
446 52,52,52,52,52,1,2,10,2,2,58,
447 52,52,52,52,52,52,1,2,11,2,2,56,
448 9,6,10,32,7,12,21,12,12,21,12,13,26,8,11,
449 9,6,10,32,7,13,22,12,12,22,12,13,26,8,11,
450 12,12,12,12,23,12,14,24,
451 25,27,6,30,9,15,31,29,28,26,
452 32,16,3,
453 9,6,10,16,32,7,16,7,17,15,12,12,16,16,5,15,14,13,26,8,11,
454 8,18,
455 34,34,34,34,34,34,19,34,34,19,35,
456 19,29,27,
457 19,19,19,19,19,19,21,31,29,28,26,
458 25,27,6,30,33,22,31,29,28,26,14,
459 52,52,52,52,52,1,2,23,2,2,55,
460 9,6,10,32,7,24,34,12,12,34,12,13,26,8,11,
461 52,52,52,52,52,1,2,25,2,2,62,
462 9,6,10,32,7,26,35,12,12,35,12,13,26,8,11,
463 52,52,52,52,52,1,2,27,2,2,61,
464 9,6,10,32,7,28,36,12,12,36,12,13,26,8,11,
465 9,6,10,32,7,29,37,12,12,37,12,13,26,8,11,
466 52,52,52,52,52,1,2,30,2,2,59,
467 9,6,10,32,7,31,38,12,12,38,12,13,26,8,11,
468 52,52,52,52,52,52,1,2,52,32,2,2,54,
469 52,52,52,52,52,52,1,2,33,2,2,57,
470 25,27,6,30,10,34,31,29,28,26,
471 18,18,18,18,18,18,35,31,29,28,26,
472 17,17,17,17,17,17,36,31,29,28,26,
473 25,27,16,16,16,16,37,31,29,28,26,
474 25,27,15,15,15,15,38,31,29,28,26,
475
476 };
477
478
479 static const unsigned short ag_sbt[] = {
480 0, 13, 30, 34, 58, 72, 74, 85, 88, 100, 113, 124, 136, 151,
481 166, 174, 184, 187, 208, 210, 221, 224, 235, 246, 257, 272, 283, 298,
482 309, 324, 339, 350, 365, 378, 390, 400, 411, 422, 433, 444
483 };
484
485
486 static const unsigned short ag_sbe[] = {
487 9, 27, 32, 42, 71, 73, 81, 86, 98, 109, 120, 132, 141, 156,
488 172, 179, 185, 195, 209, 219, 222, 230, 240, 253, 262, 279, 288, 305,
489 314, 329, 346, 355, 374, 386, 395, 406, 417, 428, 439, 444
490 };
491
492
493 static const unsigned char ag_fl[] = {
494 2,0,1,2,1,2,0,1,2,1,3,1,1,1,3,3,3,3,3,2,1,1,2,0,1,3,1,3,0,1,2,2,1,2,1,
495 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,1,2,2,2,2,2,2,2,2,2,2
496 };
497
498 static const unsigned char ag_ptt[] = {
499 0, 10, 10, 12, 13, 13, 14, 14, 8, 9, 9, 9, 16, 16, 16, 16, 16, 16,
500 16, 16, 1, 25, 25, 26, 26, 1, 17, 39, 32, 32, 39, 39, 29, 29, 31, 31,
501 7, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 35, 35, 36, 36,
502 11, 18, 2, 21, 20, 3, 4, 5, 6, 28
503 };
504
505
506 static void ag_ra(void)
507 {
508 switch(ag_rpx[(PCB).ag_ap]) {
509 case 1: ag_rp_1(V(0,(double *))); break;
510 case 2: ag_rp_2(V(0,(int *)), V(2,(double *))); break;
511 case 3: V(0,(double *)) = ag_rp_3(V(0,(int *))); break;
512 case 4: V(0,(double *)) = ag_rp_4(V(1,(double *))); break;
513 case 5: V(0,(double *)) = ag_rp_5(V(0,(double *)), V(2,(double *))); break;
514 case 6: V(0,(double *)) = ag_rp_6(V(0,(double *)), V(2,(double *))); break;
515 case 7: V(0,(double *)) = ag_rp_7(V(0,(double *)), V(2,(double *))); break;
516 case 8: V(0,(double *)) = ag_rp_8(V(0,(double *)), V(2,(double *))); break;
517 case 9: V(0,(double *)) = ag_rp_9(V(1,(double *))); break;
518 case 10: V(0,(int *)) = ag_rp_10(V(0,(int *))); break;
519 case 11: V(0,(double *)) = ag_rp_11(V(0,(double *)), V(2,(double *))); break;
520 case 12: V(0,(double *)) = ag_rp_12(V(1,(double *))); break;
521 case 13: V(0,(double *)) = ag_rp_13(V(0,(int *))); break;
522 case 14: V(0,(double *)) = ag_rp_14(V(0,(double *)), V(1,(int *))); break;
523 case 15: V(0,(double *)) = ag_rp_15(V(0,(int *))); break;
524 case 16: V(0,(double *)) = ag_rp_16(V(0,(int *)), V(1,(double *))); break;
525 }
526 }
527
528 #define TOKEN_NAMES ffcalcx_token_names
529 const char *const ffcalcx_token_names[47] = {
530 "calculator",
531 "white space",
532 "real",
533 "'+'",
534 "'-'",
535 "'*'",
536 "'/'",
537 "unary minus",
538 "calculator",
539 "calculation",
540 "",
541 "'\\n'",
542 "",
543 "",
544 "",
545 "eof",
546 "expression",
547 "name",
548 "'='",
549 "error",
550 "'('",
551 "')'",
552 "",
553 "\"/*\"",
554 "",
555 "",
556 "",
557 "\"*/\"",
558 "",
559 "integer part",
560 "'.'",
561 "fraction part",
562 "",
563 "digit",
564 "",
565 "",
566 "",
567 "'\\n'",
568 "'='",
569 "real",
570 "')'",
571 "'('",
572 "'+'",
573 "'-'",
574 "'*'",
575 "'/'",
576 "",
577
578 };
579
580 #ifndef MISSING_FORMAT
581 #define MISSING_FORMAT "Missing %s"
582 #endif
583 #ifndef UNEXPECTED_FORMAT
584 #define UNEXPECTED_FORMAT "Unexpected %s"
585 #endif
586 #ifndef UNNAMED_TOKEN
587 #define UNNAMED_TOKEN "input"
588 #endif
589
590
591 static void ag_diagnose(void) {
592 int ag_snd = (PCB).sn;
593 int ag_k = ag_sbt[ag_snd];
594
595 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
596 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
597 }
598 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
599 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
600 && *TOKEN_NAMES[ag_tstt[ag_k]]) {
601 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
602 }
603 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
604 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
605 }
606 else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') {
607 char buf[20];
608 sprintf(buf, "\'%c\'", (char) (*(PCB).lab));
609 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
610 }
611 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
612 (PCB).error_message = (PCB).ag_msg;
613
614
615 }
616 static int ag_action_1_r_proc(void);
617 static int ag_action_2_r_proc(void);
618 static int ag_action_3_r_proc(void);
619 static int ag_action_4_r_proc(void);
620 static int ag_action_1_s_proc(void);
621 static int ag_action_3_s_proc(void);
622 static int ag_action_1_proc(void);
623 static int ag_action_2_proc(void);
624 static int ag_action_3_proc(void);
625 static int ag_action_4_proc(void);
626 static int ag_action_5_proc(void);
627 static int ag_action_6_proc(void);
628 static int ag_action_7_proc(void);
629 static int ag_action_8_proc(void);
630 static int ag_action_9_proc(void);
631 static int ag_action_10_proc(void);
632 static int ag_action_11_proc(void);
633 static int ag_action_8_proc(void);
634
635
636 static int (*const ag_r_procs_scan[])(void) = {
637 ag_action_1_r_proc,
638 ag_action_2_r_proc,
639 ag_action_3_r_proc,
640 ag_action_4_r_proc
641 };
642
643 static int (*const ag_s_procs_scan[])(void) = {
644 ag_action_1_s_proc,
645 ag_action_2_r_proc,
646 ag_action_3_s_proc,
647 ag_action_4_r_proc
648 };
649
650 static int (*const ag_gt_procs_scan[])(void) = {
651 ag_action_1_proc,
652 ag_action_2_proc,
653 ag_action_3_proc,
654 ag_action_4_proc,
655 ag_action_5_proc,
656 ag_action_6_proc,
657 ag_action_7_proc,
658 ag_action_8_proc,
659 ag_action_9_proc,
660 ag_action_10_proc,
661 ag_action_11_proc,
662 ag_action_8_proc
663 };
664
665
666 static int ag_action_1_er_proc(void);
667 static int ag_action_2_er_proc(void);
668 static int ag_action_3_er_proc(void);
669 static int ag_action_4_er_proc(void);
670
671 static int (*const ag_er_procs_scan[])(void) = {
672 ag_action_1_er_proc,
673 ag_action_2_er_proc,
674 ag_action_3_er_proc,
675 ag_action_4_er_proc
676 };
677
678
679 static void ag_error_resynch(void) {
680 int ag_k;
681 int ag_ssx = (PCB).ssx;
682
683 ag_diagnose();
684 SYNTAX_ERROR;
685 if ((PCB).exit_flag != AG_RUNNING_CODE) return;
686 while (1) {
687 ag_k = ag_sbt[(PCB).sn];
688 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
689 if (ag_tstt[ag_k] || (PCB).ssx == 0) break;
690 (PCB).sn = (PCB).ss[--(PCB).ssx];
691 }
692 if (ag_tstt[ag_k] == 0) {
693 (PCB).sn = PCB.ss[(PCB).ssx = ag_ssx];
694 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
695 return;
696 }
697 ag_k = ag_sbt[(PCB).sn];
698 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
699 (PCB).ag_ap = ag_pstt[ag_k];
700 (ag_er_procs_scan[ag_astt[ag_k]])();
701 while (1) {
702 ag_k = ag_sbt[(PCB).sn];
703 while (ag_tstt[ag_k] != (unsigned char) (PCB).token_number && ag_tstt[ag_k])
704 ag_k++;
705 if (ag_tstt[ag_k] && ag_astt[ag_k] != ag_action_10) break;
706 if ((PCB).token_number == 15)
707 {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;}
708 {(PCB).rx = 1; ag_track();}
709 if ((PCB).rx < (PCB).fx) {
710 (PCB).input_code = (PCB).lab[(PCB).rx++];
711 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);}
712 else {
713 GET_INPUT;
714 (PCB).lab[(PCB).fx++] = (PCB).input_code;
715 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);
716 (PCB).rx++;
717 }
718 if (ag_key_index[(PCB).sn]) {
719 unsigned ag_k = ag_key_index[(PCB).sn];
720 int ag_ch = CONVERT_CASE((PCB).input_code);
721 if (ag_ch < 255) {
722 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
723 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
724 }
725 }
726 }
727 (PCB).rx = 0;
728 }
729
730
731 static int ag_action_10_proc(void) {
732 int ag_t = (PCB).token_number;
733 (PCB).btsx = 0, (PCB).drt = -1;
734 do {
735 ag_track();
736 if ((PCB).rx < (PCB).fx) {
737 (PCB).input_code = (PCB).lab[(PCB).rx++];
738 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);}
739 else {
740 GET_INPUT;
741 (PCB).lab[(PCB).fx++] = (PCB).input_code;
742 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);
743 (PCB).rx++;
744 }
745 if (ag_key_index[(PCB).sn]) {
746 unsigned ag_k = ag_key_index[(PCB).sn];
747 int ag_ch = CONVERT_CASE((PCB).input_code);
748 if (ag_ch < 255) {
749 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
750 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
751 }
752 }
753 } while ((PCB).token_number == (ffcalcx_token_type) ag_t);
754 (PCB).rx = 0;
755 return 1;
756 }
757
758 static int ag_action_11_proc(void) {
759 int ag_t = (PCB).token_number;
760
761 (PCB).btsx = 0, (PCB).drt = -1;
762 do {
763 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
764 (PCB).ssx--;
765 ag_track();
766 ag_ra();
767 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
768 (PCB).ssx++;
769 if ((PCB).rx < (PCB).fx) {
770 (PCB).input_code = (PCB).lab[(PCB).rx++];
771 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);}
772 else {
773 GET_INPUT;
774 (PCB).lab[(PCB).fx++] = (PCB).input_code;
775 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);
776 (PCB).rx++;
777 }
778 if (ag_key_index[(PCB).sn]) {
779 unsigned ag_k = ag_key_index[(PCB).sn];
780 int ag_ch = CONVERT_CASE((PCB).input_code);
781 if (ag_ch < 255) {
782 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
783 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
784 }
785 }
786 }
787 while ((PCB).token_number == (ffcalcx_token_type) ag_t);
788 (PCB).rx = 0;
789 return 1;
790 }
791
792 static int ag_action_3_r_proc(void) {
793 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
794 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
795 (PCB).btsx = 0, (PCB).drt = -1;
796 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
797 ag_ra();
798 return (PCB).exit_flag == AG_RUNNING_CODE;
799 }
800
801 static int ag_action_3_s_proc(void) {
802 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
803 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
804 (PCB).btsx = 0, (PCB).drt = -1;
805 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
806 ag_ra();
807 return (PCB).exit_flag == AG_RUNNING_CODE;
808 }
809
810 static int ag_action_4_r_proc(void) {
811 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
812 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
813 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
814 return 1;
815 }
816
817 static int ag_action_2_proc(void) {
818 (PCB).btsx = 0, (PCB).drt = -1;
819 if ((PCB).ssx >= 128) {
820 (PCB).exit_flag = AG_STACK_ERROR_CODE;
821 PARSER_STACK_OVERFLOW;
822 }
823 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
824 (PCB).ss[(PCB).ssx] = (PCB).sn;
825 (PCB).ssx++;
826 (PCB).sn = (PCB).ag_ap;
827 ag_track();
828 return 0;
829 }
830
831 static int ag_action_9_proc(void) {
832 if ((PCB).drt == -1) {
833 (PCB).drt=(PCB).token_number;
834 (PCB).dssx=(PCB).ssx;
835 (PCB).dsn=(PCB).sn;
836 }
837 ag_prot();
838 (PCB).vs[(PCB).ssx] = ag_null_value;
839 (PCB).ss[(PCB).ssx] = (PCB).sn;
840 (PCB).ssx++;
841 (PCB).sn = (PCB).ag_ap;
842 (PCB).rx = 0;
843 return (PCB).exit_flag == AG_RUNNING_CODE;
844 }
845
846 static int ag_action_2_r_proc(void) {
847 (PCB).ssx++;
848 (PCB).sn = (PCB).ag_ap;
849 return 0;
850 }
851
852 static int ag_action_7_proc(void) {
853 --(PCB).ssx;
854 (PCB).rx = 0;
855 (PCB).exit_flag = AG_SUCCESS_CODE;
856 return 0;
857 }
858
859 static int ag_action_1_proc(void) {
860 ag_track();
861 (PCB).exit_flag = AG_SUCCESS_CODE;
862 return 0;
863 }
864
865 static int ag_action_1_r_proc(void) {
866 (PCB).exit_flag = AG_SUCCESS_CODE;
867 return 0;
868 }
869
870 static int ag_action_1_s_proc(void) {
871 (PCB).exit_flag = AG_SUCCESS_CODE;
872 return 0;
873 }
874
875 static int ag_action_4_proc(void) {
876 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
877 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
878 (PCB).btsx = 0, (PCB).drt = -1;
879 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
880 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
881 else (PCB).ss[(PCB).ssx] = (PCB).sn;
882 ag_track();
883 while ((PCB).exit_flag == AG_RUNNING_CODE) {
884 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
885 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
886 do {
887 unsigned ag_tx = (ag_t1 + ag_t2)/2;
888 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
889 else ag_t2 = ag_tx;
890 } while (ag_t1 < ag_t2);
891 (PCB).ag_ap = ag_pstt[ag_t1];
892 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
893 }
894 return 0;
895 }
896
897 static int ag_action_3_proc(void) {
898 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
899 (PCB).btsx = 0, (PCB).drt = -1;
900 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
901 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
902 else (PCB).ss[(PCB).ssx] = (PCB).sn;
903 ag_track();
904 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
905 ag_ra();
906 while ((PCB).exit_flag == AG_RUNNING_CODE) {
907 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
908 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
909 do {
910 unsigned ag_tx = (ag_t1 + ag_t2)/2;
911 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
912 else ag_t2 = ag_tx;
913 } while (ag_t1 < ag_t2);
914 (PCB).ag_ap = ag_pstt[ag_t1];
915 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
916 }
917 return 0;
918 }
919
920 static int ag_action_8_proc(void) {
921 int ag_k = ag_sbt[(PCB).sn];
922 while (ag_tstt[ag_k] != 19 && ag_tstt[ag_k]) ag_k++;
923 if (ag_tstt[ag_k] == 0) ag_undo();
924 (PCB).rx = 0;
925 ag_error_resynch();
926 return (PCB).exit_flag == AG_RUNNING_CODE;
927 }
928
929 static int ag_action_5_proc(void) {
930 int ag_sd = ag_fl[(PCB).ag_ap];
931 (PCB).btsx = 0, (PCB).drt = -1;
932 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
933 else {
934 (PCB).ss[(PCB).ssx] = (PCB).sn;
935 }
936 (PCB).rx = 0;
937 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
938 ag_ra();
939 while ((PCB).exit_flag == AG_RUNNING_CODE) {
940 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
941 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
942 do {
943 unsigned ag_tx = (ag_t1 + ag_t2)/2;
944 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
945 else ag_t2 = ag_tx;
946 } while (ag_t1 < ag_t2);
947 (PCB).ag_ap = ag_pstt[ag_t1];
948 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
949 }
950 return (PCB).exit_flag == AG_RUNNING_CODE;
951 }
952
953 static int ag_action_6_proc(void) {
954 int ag_sd = ag_fl[(PCB).ag_ap];
955 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
956 if ((PCB).drt == -1) {
957 (PCB).drt=(PCB).token_number;
958 (PCB).dssx=(PCB).ssx;
959 (PCB).dsn=(PCB).sn;
960 }
961 if (ag_sd) {
962 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
963 }
964 else {
965 ag_prot();
966 (PCB).vs[(PCB).ssx] = ag_null_value;
967 (PCB).ss[(PCB).ssx] = (PCB).sn;
968 }
969 (PCB).rx = 0;
970 while ((PCB).exit_flag == AG_RUNNING_CODE) {
971 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
972 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
973 do {
974 unsigned ag_tx = (ag_t1 + ag_t2)/2;
975 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
976 else ag_t2 = ag_tx;
977 } while (ag_t1 < ag_t2);
978 (PCB).ag_ap = ag_pstt[ag_t1];
979 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
980 }
981 return (PCB).exit_flag == AG_RUNNING_CODE;
982 }
983
984
985 static int ag_action_2_er_proc(void) {
986 (PCB).btsx = 0, (PCB).drt = -1;
987 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab;
988 (PCB).ssx++;
989 (PCB).sn = (PCB).ag_ap;
990 return 0;
991 }
992
993 static int ag_action_1_er_proc(void) {
994 (PCB).btsx = 0, (PCB).drt = -1;
995 (PCB).exit_flag = AG_SUCCESS_CODE;
996 return 0;
997 }
998
999 static int ag_action_4_er_proc(void) {
1000 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1001 (PCB).btsx = 0, (PCB).drt = -1;
1002 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
1003 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1004 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1005 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1006 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1007 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1008 do {
1009 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1010 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1011 else ag_t2 = ag_tx;
1012 } while (ag_t1 < ag_t2);
1013 (PCB).ag_ap = ag_pstt[ag_t1];
1014 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
1015 }
1016 return 0;
1017 }
1018
1019 static int ag_action_3_er_proc(void) {
1020 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1021 (PCB).btsx = 0, (PCB).drt = -1;
1022 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1023 else (PCB).ss[(PCB).ssx] = (PCB).sn;
1024 (PCB).reduction_token = (ffcalcx_token_type) ag_ptt[(PCB).ag_ap];
1025 ag_ra();
1026 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1027 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1028 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
1029 do {
1030 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1031 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
1032 else ag_t2 = ag_tx;
1033 } while (ag_t1 < ag_t2);
1034 (PCB).ag_ap = ag_pstt[ag_t1];
1035 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
1036 }
1037 return 0;
1038 }
1039
1040
1041 void init_ffcalcx(void) {
1042 (PCB).rx = (PCB).fx = 0;
1043 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
1044 (PCB).exit_flag = AG_RUNNING_CODE;
1045 (PCB).line = FIRST_LINE;
1046 (PCB).column = FIRST_COLUMN;
1047 (PCB).btsx = 0, (PCB).drt = -1;
1048 }
1049
1050 void ffcalcx(void) {
1051 init_ffcalcx();
1052 (PCB).exit_flag = AG_RUNNING_CODE;
1053 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1054 unsigned ag_t1 = ag_sbt[(PCB).sn];
1055 if (ag_tstt[ag_t1]) {
1056 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
1057 if ((PCB).rx < (PCB).fx) {
1058 (PCB).input_code = (PCB).lab[(PCB).rx++];
1059 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);}
1060 else {
1061 GET_INPUT;
1062 (PCB).lab[(PCB).fx++] = (PCB).input_code;
1063 (PCB).token_number = (ffcalcx_token_type) AG_TCV((PCB).input_code);
1064 (PCB).rx++;
1065 }
1066 if (ag_key_index[(PCB).sn]) {
1067 unsigned ag_k = ag_key_index[(PCB).sn];
1068 int ag_ch = CONVERT_CASE((PCB).input_code);
1069 if (ag_ch < 255) {
1070 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1071 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
1072 }
1073 }
1074 do {
1075 unsigned ag_tx = (ag_t1 + ag_t2)/2;
1076 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
1077 ag_t1 = ag_tx + 1;
1078 else ag_t2 = ag_tx;
1079 } while (ag_t1 < ag_t2);
1080 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
1081 ag_t1 = ag_sbe[(PCB).sn];
1082 }
1083 (PCB).ag_ap = ag_pstt[ag_t1];
1084 (ag_gt_procs_scan[ag_astt[ag_t1]])();
1085 }
1086 }
1087
1088