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