Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/oldagsrc/good/bcip.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/oldagsrc/good/bcip.cpp Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,2020 @@ +/* + bcip.syn Version 1.0 + + A simple byte code compiler + + Copyright (c) 1996-1999 Parsifal Software, All Rights Reserved. + + The expression syntax is borrowed from C but with the addition + of the FORTRAN exponentiation operator (**). + + The cast, increment, and decrement operators are not + implemented, nor are the following operations that are defined + only for integers: + Bitwise logical operators: &, |, ^, ~, &=, |=, ^= + Remainder operators: %, %= + Shift operators: <<, >>, >>=, <<= + + The supported operations are: + Assignment operators: =, +=, -=, *=, /= + Conditional expressions: ? : + Logical operators: !, &&, || + Comparison operators: ==, !=, <, <=, >, >= + Binary arithmetic operators: +, -, *, / + Exponentiation: ** + Unary arithmetic operators: +, - + Parentheses ( ) + Built-in functions log, exp, sqrt + + All arithmetic is double precision floating point. + + Statements may include expression statements, blocks, if/else + statements, while statements, do-while statements, or for + statements, following the rules of C. + + The statement syntax has been written to avoid the conventional + if/else ambiguity. + + There are no declarations. All variables are presumed to be + double. + + Input strings may contain any number of statements. White space + may be used freely, including both C and C++ style comments. + + The parser is invoked by the constructor for the virtual machine + to parse the source code and compile it into byte code. + + With this organization, it is possible to create various + virtual machine objects all of which use the same symbol dictionary, + so that all can operate on the same data array. Furthermore, if + there are multiple data arrays, all consistent with the same + symbol dictionary, then any virtual machine object created using the + given symbol dictionary can operate on any of the data arrays. + + Thus a given virtual machine may operate on different data + arrays at different times. The data array, of course, must be + consistent with the symbol dictionary used to initialize the virtual + machine. + + The symbol dictionary maps character strings to indices into the + data array, so that each unique variable name is assigned a + particular location in the data array. Different virtual + machines may be initialized with the same symbol dictionary. When + this is done, these virtual machines can all operate on the + same data array. + + An override for the SYNTAX_ERROR macro defined by AnaGram and + the definition of the ScriptMethod class are in the bci.h + file. bci.cpp has function definitons for the ScriptMethod + class. bcidemo.cpp demonstrates one way to use the virtual + machine. + + bcip.syn is compiled with the AnaGram parser generator yielding + bcip.h and bcip.cpp. + + To build bcidemo, compile bcip.cpp, bci.cpp, cntnrs.cpp and bcidemo.cpp + and link them with your C++ compiler. + + For information about AnaGram, visit http://www.parsifalsoft.com. +*/ + +#include <math.h> +#include "bci.h" // defines external interface + + +/* + * AnaGram, A System for Syntax Directed Programming + * File generated by: ... + * + * AnaGram Parsing Engine + * Copyright 1993-2002 Parsifal Software. All Rights Reserved. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef BCIP_H +#include "bcip.h" +#endif + +#ifndef BCIP_H +#error Mismatched header file +#endif + +#include <ctype.h> +#include <stdio.h> + +#define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) +#define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) +#define CONTEXT ((PCB).cs[(PCB).ssx]) + + +#ifndef PCB_TYPE +#define PCB_TYPE bciParse_pcb_type +#endif + + +#define PCB (*pcb_pointer) +#define PCB_DECL PCB_TYPE *pcb_pointer +#define PCB_POINTER pcb_pointer + +CodeFragment bciParse_value(PCB_DECL); + +static void ag_delete_wrappers(PCB_DECL); +#ifndef DELETE_WRAPPERS +#define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER) +#endif + +/* Line -, bcip.syn */ + // Begin embedded C + +#define SYNTAX_ERROR + +int bciParse_pcb_struct::stashReal(double x) { + int n = realList.size(); + realList.push(x); + return n; +} + +CodeFragment bciParse_pcb_struct::codeIfElse(CodeFragment &condition, + CodeFragment &trueStatement, + CodeFragment &falseStatement) +{ + return condition.cat(BRF, trueStatement.size() + 2) + .cat(trueStatement) + .cat(BR, falseStatement.size()) + .cat(falseStatement); +} + +CodeFragment bciParse_pcb_struct::codeWhile(CodeFragment &condition, + CodeFragment &statement) +{ + // loop back distance is length of statement + length of condition + 2 branch instructions + int loopBackDistance = condition.size() + statement.size() + 4; + return condition.cat(BRF, statement.size() + 2) // size of statement +size of loopback + .cat(statement) + .cat(BR, -loopBackDistance); +} + +CodeFragment bciParse_pcb_struct::codeDoWhile(CodeFragment &statement, + CodeFragment &condition) +{ + // loop back distance is + // length of statement + length of condition + 1 branch instruction + int loopBackDistance = statement.size() + condition.size() + 2; + return statement.cat(condition) + .cat(BRT, -loopBackDistance); +} + +CodeFragment bciParse_pcb_struct::codeFor(CodeFragment &initializer, + CodeFragment &condition, + CodeFragment &increment, + CodeFragment &statement) +{ + // Calculate the length of the jump back at the bottom of the loop + // It consists of the length of the increment, condition and statement + // CodeFragments + 5 inserted Bytecodes: 1 Pop, and 2 each for each of + // two branches + int loopBackDistance = increment.size() + condition.size() + statement.size() + 5; + + // Put it all together + return initializer.cat(POP) // clear expression value from stack + .cat(BR, increment.size() + 1) // Skip increment on first time through + .cat(increment).cat(POP) // clear expresson value from stack + .cat(condition) + .cat(BRF, statement.size() + 2) // exit when condition is false + .cat(statement) + .cat(BR, -loopBackDistance); +} + +int bciParse_pcb_struct::compile(AgStringDictionary *s, AgString text) { + symbolDictionary = s; + charStack.reset(); + pointer = (unsigned char *) text.ptr(); + bciParse(this); + if(exit_flag != AG_SUCCESS_CODE) return 1; + code = bciParse_value(this); + return 0; +} + + +#ifndef CONVERT_CASE +#define CONVERT_CASE(c) (c) +#endif +#ifndef TAB_SPACING +#define TAB_SPACING 8 +#endif +CodeFragment bciParse_value(PCB_DECL) { + CodeFragment returnValue; + returnValue = (*(AgObjectWrapper< CodeFragment > *) &(PCB).vs[(PCB).ssx]); + return returnValue; +} + +static inline CodeFragment ag_rp_1(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(HLT); +} + +static inline CodeFragment ag_rp_2(PCB_DECL) { +/* Line -, bcip.syn */ + return CodeFragment(); +} + +static inline CodeFragment ag_rp_3(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y); +} + +static inline CodeFragment ag_rp_4(PCB_DECL, CodeFragment &x, CodeFragment &s) { +/* Line -, bcip.syn */ + return x.cat(BRF, s.size()).cat(s); +} + +static inline CodeFragment ag_rp_5(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) { +/* Line -, bcip.syn */ + return PCB.codeIfElse(x,s1,s2); +} + +static inline CodeFragment ag_rp_6(PCB_DECL, CodeFragment &x, CodeFragment &s) { +/* Line -, bcip.syn */ + return PCB.codeWhile(x,s); +} + +static inline CodeFragment ag_rp_7(PCB_DECL, CodeFragment &init, CodeFragment &cond, CodeFragment &inc, CodeFragment &s) { +/* Line -, bcip.syn */ + return PCB.codeFor(init, cond, inc, s); +} + +static inline CodeFragment ag_rp_8(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) { +/* Line -, bcip.syn */ + return PCB.codeIfElse(x,s1,s2); +} + +static inline CodeFragment ag_rp_9(PCB_DECL, CodeFragment &x, CodeFragment &s) { +/* Line -, bcip.syn */ + return PCB.codeWhile(x,s); +} + +static inline CodeFragment ag_rp_10(PCB_DECL, CodeFragment &s, CodeFragment &x) { +/* Line -, bcip.syn */ + return PCB.codeDoWhile(s,x); +} + +static inline CodeFragment ag_rp_11(PCB_DECL, CodeFragment &init, CodeFragment &cond, CodeFragment &inc, CodeFragment &s) { +/* Line -, bcip.syn */ + return PCB.codeFor(init, cond, inc, s); +} + +static inline CodeFragment ag_rp_12(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x; +} + +static inline CodeFragment ag_rp_13(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x; +} + +static inline CodeFragment ag_rp_14(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(POP); +} + +static inline CodeFragment ag_rp_15(PCB_DECL) { +/* Line -, bcip.syn */ + return CodeFragment(); +} + +static inline CodeFragment ag_rp_16(PCB_DECL, CodeFragment &s) { +/* Line -, bcip.syn */ + return s; +} + +static inline CodeFragment ag_rp_17(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(POP).cat(y); +} + +static inline CodeFragment ag_rp_18(PCB_DECL, int k, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(STORE, k); +} + +static inline CodeFragment ag_rp_19(PCB_DECL, int k, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(ADDM, k); +} + +static inline CodeFragment ag_rp_20(PCB_DECL, int k, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(SUBM, k); +} + +static inline CodeFragment ag_rp_21(PCB_DECL, int k, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(MULM,k); +} + +static inline CodeFragment ag_rp_22(PCB_DECL, int k, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(DIVM, k); +} + +static inline CodeFragment ag_rp_23(PCB_DECL, CodeFragment &c, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return PCB.codeIfElse(c, x, y); +} + +static inline CodeFragment ag_rp_24(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(OR, y.size()).cat(y); +} + +static inline CodeFragment ag_rp_25(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(AND, y.size()).cat(y); +} + +static inline CodeFragment ag_rp_26(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(EQ); +} + +static inline CodeFragment ag_rp_27(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(NE); +} + +static inline CodeFragment ag_rp_28(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(LT); +} + +static inline CodeFragment ag_rp_29(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(LE); +} + +static inline CodeFragment ag_rp_30(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(GT); +} + +static inline CodeFragment ag_rp_31(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(GE); +} + +static inline CodeFragment ag_rp_32(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(ADD); +} + +static inline CodeFragment ag_rp_33(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(SUB); +} + +static inline CodeFragment ag_rp_34(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(MUL); +} + +static inline CodeFragment ag_rp_35(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(DIV); +} + +static inline CodeFragment ag_rp_36(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(NEG); +} + +static inline CodeFragment ag_rp_37(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x; +} + +static inline CodeFragment ag_rp_38(PCB_DECL, CodeFragment &x, CodeFragment &y) { +/* Line -, bcip.syn */ + return x.cat(y).cat(POW); +} + +static inline CodeFragment ag_rp_39(PCB_DECL, int x) { +/* Line -, bcip.syn */ + return CodeFragment().cat(PUSHI, x); +} + +static inline CodeFragment ag_rp_40(PCB_DECL, int k) { +/* Line -, bcip.syn */ + return CodeFragment().cat(PUSH, k); +} + +static inline CodeFragment ag_rp_41(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(LOG); +} + +static inline CodeFragment ag_rp_42(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(EXP); +} + +static inline CodeFragment ag_rp_43(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(SQRT); +} + +static inline CodeFragment ag_rp_44(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x; +} + +static inline CodeFragment ag_rp_45(PCB_DECL, CodeFragment &x) { +/* Line -, bcip.syn */ + return x.cat(NOT); +} + +static inline int ag_rp_46(PCB_DECL, double x) { +/* Line -, bcip.syn */ + return PCB.stashReal(x); +} + +static inline int ag_rp_47(PCB_DECL, double x, int e) { +/* Line -, bcip.syn */ + return PCB.stashReal(x*pow(10,e)); +} + +static inline int ag_rp_48(PCB_DECL, double x, int e) { +/* Line -, bcip.syn */ + return PCB.stashReal(x*pow(10,-e)); +} + +static inline double ag_rp_49(PCB_DECL, double i, double f) { +/* Line -, bcip.syn */ + return i+f; +} + +static inline double ag_rp_50(PCB_DECL, double f) { +/* Line -, bcip.syn */ + return f; +} + +static inline double ag_rp_51(PCB_DECL, int d) { +/* Line -, bcip.syn */ + return d-'0'; +} + +static inline double ag_rp_52(PCB_DECL, double x, int d) { +/* Line -, bcip.syn */ + return 10*x + d-'0'; +} + +static inline double ag_rp_53(PCB_DECL, int d) { +/* Line -, bcip.syn */ + return (d-'0')/10.; +} + +static inline double ag_rp_54(PCB_DECL, int d, double f) { +/* Line -, bcip.syn */ + return (d-'0' + f)/10.; +} + +static inline int ag_rp_55(PCB_DECL, int d) { +/* Line -, bcip.syn */ + return d-'0'; +} + +static inline int ag_rp_56(PCB_DECL, int x, int d) { +/* Line -, bcip.syn */ + return 10*x + d-'0'; +} + +static inline int ag_rp_57(PCB_DECL) { +/* Line -, bcip.syn */ + return PCB.symbolDictionary->identify(PCB.charStack.popString()); +} + +static inline void ag_rp_58(PCB_DECL, int c) { +/* Line -, bcip.syn */ + PCB.charStack.push((char) c); +} + +static inline void ag_rp_59(PCB_DECL, int c) { +/* Line -, bcip.syn */ + PCB.charStack.push((char) c); +} + + +#define READ_COUNTS +#define WRITE_COUNTS +#undef V +#define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) +#undef VS +#define VS(i) (PCB).vs[(PCB).ssx + i] + +#ifndef GET_CONTEXT +#define GET_CONTEXT CONTEXT = (PCB).input_context +#endif + +typedef enum { + ag_action_1, + ag_action_2, + ag_action_3, + ag_action_4, + ag_action_5, + ag_action_6, + ag_action_7, + ag_action_8, + ag_action_9, + ag_action_10, + ag_action_11, + ag_action_12 +} ag_parser_action; + + +#ifndef NULL_VALUE_INITIALIZER +#define NULL_VALUE_INITIALIZER = { 0 } +#endif + + +static const char ag_wdf[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 4, 4, 4, 4, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0 +}; + +#undef VW +#define VW(i,t) *(t) (&(PCB).vs[(PCB).ssx + (i)]) +#undef VNO +#define VNO new(&(PCB).vs[(PCB).ssx]) +#undef VRO +#define VRO(to,v) ag_replace_object((to) &(PCB).vs[(PCB).ssx], v) +#undef VWD +#define VWD(i,t) ag_delete_object((t) &(PCB).vs[(PCB).ssx + (i)]); +#undef VDO +#define VDO(to, v) ag_delete_object((to) &(PCB).vs[(PCB).ssx], v) + +template <class NewObject, class OldObject> +static inline void ag_replace_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { + delete p; + new(p) AgObjectWrapper<NewObject >(o); +} + +template <class Object> +static inline void ag_delete_object(AgObjectWrapper<Object> *p) { + delete p; +} + +template <class NewObject, class OldObject> +static inline const NewObject &ag_delete_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { + delete p; + return o; +} + + +#undef AG_WRAP_4 +#define AG_WRAP_4 AgObjectWrapper<CodeFragment > + +static void ag_delete_wrappers(PCB_DECL) { + int sn = (PCB).sn; + int sx = (PCB).ssx; + while (sx--) { + switch (ag_wdf[sn]) { + case 4: ag_delete_object((AG_WRAP_4 *) &(PCB).vs[sx]); break; + default: break; + } + sn = (PCB).ss[sx]; + } +} + +static bciParse_vs_type const ag_null_value NULL_VALUE_INITIALIZER; + +static const unsigned char ag_rpx[] = { + 0, 1, 2, 3, 0, 0, 4, 5, 6, 7, 0, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 0, 17, 0, 18, 19, 20, 21, 22, 0, 23, 0, 24, 0, 25, 0, 26, + 27, 0, 28, 29, 30, 31, 0, 32, 33, 0, 34, 35, 0, 36, 37, 0, 38, 39, + 40, 41, 42, 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, + 0, 0, 47, 48, 49, 0, 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 +}; + +static const unsigned char ag_key_itt[] = { + 0 +}; + +static const unsigned short ag_key_pt[] = { +0 +}; + +static const unsigned char ag_key_ch[] = { + 0, 42, 47,255, 47,100,101,102,105,108,115,119,255, 42,255, 42, 61,255, + 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,100,101, + 102,105,108,115,119,124,255,100,101,102,105,108,115,119,255, 42, 47,255, + 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47,101,108,115,255, 42, + 47,255, 47,255,101,108,115,255, 33, 38, 42, 60, 61, 62,124,255, 33, 38, + 60, 61, 62,124,255, 33, 38, 61,124,255, 42, 61,255, 42, 47, 61,255, 33, + 38, 42, 43, 45, 47, 60, 61, 62,124,255,124,255, 42, 61,255, 33, 38, 42, + 43, 45, 47, 60, 61, 62,124,255, 42, 47,255,108,120,255, 47,100,101,102, + 105,108,115,119,255,119,255,108,120,255,100,101,102,105,108,115,119,255, + 42, 47,255, 33, 38, 42, 47, 60, 61, 62,100,101,102,105,108,115,119,124, + 255 +}; + +static const unsigned char ag_key_act[] = { + 0,0,0,4,2,3,3,3,3,3,3,3,4,3,4,0,0,4,0,0,0,4,3,3,4,3,3,2,3,3,2,3,3,3,3, + 2,3,3,3,3,3,3,4,3,3,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,4,0,0,4,2,3,3,3, + 4,0,0,4,2,4,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,0,0,4,0,0, + 0,4,3,3,2,3,3,2,3,3,3,3,4,3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,0,0,4,3,3,4, + 2,3,2,3,3,3,3,3,4,3,4,3,3,4,3,2,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,3,3, + 3,3,3,3,3,4 +}; + +static const unsigned char ag_key_parm[] = { + 0, 61, 66, 0, 0, 93,122, 92, 94,121,123, 95, 0, 65, 0,119,103, 0, + 61, 66,104, 0, 88,122, 0,110,108, 0,101,102, 0,112,109,114, 93, 0, + 92, 94,121,123, 95,107, 0, 93,122, 92, 94,121,123, 95, 0, 61, 66, 0, + 110,108,119, 0,112,109,114,107, 0, 61, 66, 0, 0,122,121,123, 0, 61, + 66, 0, 0, 0,122,121,123, 0,110,108,119,112,109,114,107, 0,110,108, + 112,109,114,107, 0,110,108,109,107, 0,119,103, 0, 61, 66,104, 0,110, + 108, 0,101,102, 0,112,109,114,107, 0,107, 0,119,103, 0,110,108, 0, + 101,102,104,112,109,114,107, 0, 61, 66, 0, 88,122, 0, 0, 93, 0, 92, + 94,121,123, 95, 0, 95, 0, 88,122, 0, 93, 0, 92, 94,121,123, 95, 0, + 61, 66, 0,110,108,119, 0,112,109,114, 93,122, 92, 94,121,123, 95,107, + 0 +}; + +static const unsigned short ag_key_jmp[] = { + 0, 0, 0, 0, 1, 0, 2, 5, 8, 10, 13, 17, 0, 22, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 43, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22, + 45, 48, 50, 53, 57, 62, 0, 64, 66, 69, 72, 74, 77, 81, 0, 0, 0, 0, + 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106, 0, 0, + 0, 0, 71, 0,110,113,116, 0,120,122,124,126,128,130,132, 0,134,136, + 138,140,142,144, 0,146,148,150,152, 0, 0, 0, 0, 0, 0, 0, 0,154, + 156,100,158,160,103,162,164,166,168, 0,170, 0, 0, 0, 0,172,174,120, + 176,178,180,182,184,186,188, 0, 0, 0, 0,192,195, 0,134,190,137,197, + 200,202,205,209, 0,214, 0,221,224, 0,219,151,226,229,231,234,238, 0, + 0, 0, 0,243,245,247,162,249,251,253,255,257,260,263,265,268,272,277, + 0 +}; + +static const unsigned char ag_key_index[] = { + 4, 0, 13, 25, 43, 0, 0, 13, 13, 43, 0, 54, 54, 66, 66, 74, 74, 74, + 54, 76, 76, 0, 0, 0, 66, 66, 80, 76, 76, 88, 88, 88, 95,107,118,107, + 0,123, 4,140, 74, 74, 4, 43, 0, 74, 0, 0, 43, 0, 43, 43, 54, 54, + 0, 0, 76, 76, 76, 66, 76, 66, 76, 66, 76, 76, 76, 66, 76, 66, 76, 66, + 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, + 76, 66, 76, 66, 76, 43, 66, 76, 76, 76,149, 76,154, 0, 0,165, 0, 0, + 0, 88, 88, 88, 88, 88, 88, 88, 88, 0,140, 0, 0, 0, 0, 4, 43, 54, + 54, 66, 76, 76, 0, 76, 0, 43 +}; + +static const unsigned char ag_key_ends[] = { +111,0, 120,112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, +104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, +61,0, 111,0, 115,101,0, 112,0, 111,114,0, 102,0, 111,103,0, +113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 120,112,0, +111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, +61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 120,112,0, +111,103,0, 113,114,116,0, 120,112,0, 111,103,0, 113,114,116,0, +61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, +61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 124,0, 61,0, 38,0, +61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 124,0, 61,0, 38,0, +61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 111,0, 115,101,0, +112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, +104,105,108,101,0, 104,105,108,101,0, 111,0, 115,101,0, 112,0, +111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, +61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 111,0, 120,112,0, +111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, +124,0, +}; + +#define AG_TCV(x) ag_tcv[(x)] + +static const unsigned char ag_tcv[] = { + 6, 84, 84, 84, 84, 84, 84, 84, 84, 83, 70, 83, 83, 83, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 83,124, 84, 84, + 84, 84, 84, 84, 91, 89,117,115, 98,116, 76,118, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79,105, 90,111, 99,113,106, 84, 85, 85, 85, 85, 72, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 84, 84, 84, 84, 85, 84, 85, 85, 85, 85, 72, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 97, 84, 96, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84 +}; + +#ifndef SYNTAX_ERROR +#define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ + (PCB).error_message, (PCB).line, (PCB).column) +#endif + +#ifndef FIRST_LINE +#define FIRST_LINE 1 +#endif + +#ifndef FIRST_COLUMN +#define FIRST_COLUMN 1 +#endif + +#ifndef PARSER_STACK_OVERFLOW +#define PARSER_STACK_OVERFLOW {fprintf(stderr, \ + "\nParser stack overflow, line %d, column %d\n",\ + (PCB).line, (PCB).column);} +#endif + +#ifndef REDUCTION_TOKEN_ERROR +#define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ + "\nReduction token error, line %d, column %d\n", \ + (PCB).line, (PCB).column);} +#endif + + +#ifndef INPUT_CODE +#define INPUT_CODE(T) (T) +#endif + +typedef enum + {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, + ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; + +static void ag_get_key_word(PCB_DECL, int ag_k) { + int ag_save = (int) ((PCB).la_ptr - (PCB).pointer); + const unsigned char *ag_p; + int ag_ch; + while (1) { + switch (ag_key_act[ag_k]) { + case ag_cf_end_key: { + const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; + do { + if ((ag_ch = *sp++) == 0) { + int ag_k1 = ag_key_parm[ag_k]; + int ag_k2 = ag_key_pt[ag_k1]; + if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail; + (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1 + 1]; + return; + } + } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); + goto ag_fail; + } + case ag_end_key: { + const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; + do { + if ((ag_ch = *sp++) == 0) { + (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; + return; + } + } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); + } + case ag_no_match_key: +ag_fail: + (PCB).la_ptr = (PCB).pointer + ag_save; + return; + case ag_cf_set_key: { + int ag_k1 = ag_key_parm[ag_k]; + int ag_k2 = ag_key_pt[ag_k1]; + ag_k = ag_key_jmp[ag_k]; + if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break; + ag_save = (int) ((PCB).la_ptr - (PCB).pointer); + (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1+1]; + break; + } + case ag_set_key: + ag_save = (int) ((PCB).la_ptr - (PCB).pointer); + (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; + case ag_jmp_key: + ag_k = ag_key_jmp[ag_k]; + break; + case ag_accept_key: + (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; + return; + case ag_cf_accept_key: { + int ag_k1 = ag_key_parm[ag_k]; + int ag_k2 = ag_key_pt[ag_k1]; + if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) + (PCB).la_ptr = (PCB).pointer + ag_save; + else (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1+1]; + return; + } + } + ag_ch = CONVERT_CASE(*(PCB).la_ptr++); + ag_p = &ag_key_ch[ag_k]; + if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++; + if (ag_ch > 255 || *ag_p != ag_ch) { + (PCB).la_ptr = (PCB).pointer + ag_save; + return; + } + ag_k = (int) (ag_p - ag_key_ch); + } +} + + +#ifndef AG_NEWLINE +#define AG_NEWLINE 10 +#endif + +#ifndef AG_RETURN +#define AG_RETURN 13 +#endif + +#ifndef AG_FORMFEED +#define AG_FORMFEED 12 +#endif + +#ifndef AG_TABCHAR +#define AG_TABCHAR 9 +#endif + +static void ag_track(PCB_DECL) { + int ag_k = (int) ((PCB).la_ptr - (PCB).pointer); + while (ag_k--) { + switch (*(PCB).pointer++) { + case AG_NEWLINE: + (PCB).column = 1, (PCB).line++; + case AG_RETURN: + case AG_FORMFEED: + break; + case AG_TABCHAR: + (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); + break; + default: + (PCB).column++; + } + } +} + + +static void ag_prot(PCB_DECL) { + int ag_k; + ag_k = 128 - ++(PCB).btsx; + if (ag_k <= (PCB).ssx) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + return; + } + (PCB).bts[(PCB).btsx] = (PCB).sn; + (PCB).bts[ag_k] = (PCB).ssx; + (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; + (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; +} + +static void ag_undo(PCB_DECL) { + if ((PCB).drt == -1) return; + while ((PCB).btsx) { + int ag_k = 128 - (PCB).btsx; + (PCB).sn = (PCB).bts[(PCB).btsx--]; + (PCB).ssx = (PCB).bts[ag_k]; + (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; + (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; + } + (PCB).token_number = (bciParse_token_type) (PCB).drt; + (PCB).ssx = (PCB).dssx; + (PCB).sn = (PCB).dsn; + (PCB).drt = -1; +} + + +static const unsigned char ag_tstt[] = { +124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,6,0,1, + 86,87, +124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, + 70,0,68,69, +124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, + 70,65,0,63,64, +83,70,66,61,0,1, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,6,0,4,5, +124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, + 0, +70,0, +124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, + 70,0, +65,0, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,6,0,2,3,7,8,9,10, + 12,13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56, + 57,58,59,71,75,80,100,120, +79,0,77, +119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,98,90,89,83,79, + 76,72,70,66,61,0,78, +72,0, +124,123,122,121,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +91,83,70,66,61,0,1,86,87, +91,83,70,66,61,0,1,86,87, +91,83,70,66,61,0,1,86,87, +119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,98,90,89,83,70, + 66,61,0,1,86,87, +124,123,122,121,91,85,79,76,72,0,2,3,14,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +91,0,14, +91,0,14, +91,0,14, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +119,0,55, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, + 71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, + 71,75,80,100,120, +118,117,0,51,52, +116,115,0,48,49, +114,113,112,111,0,43,44,45,46, +110,109,108,0,38,40,41, +85,79,72,0, +107,0,36, +119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101, + 99,98,90,89,83,70,66,61,0,1,86,87, +106,0,33, +104,103,102,101,99,0,27,28,29,30,31, +124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1, + 86,87, +124,123,122,121,116,115,97,96,95,94,93,92,91,90,88,85,83,79,76,72,70,66,61, + 6,0,1,86,87, +91,83,70,66,61,0,1,86,87, +91,83,70,66,61,0,1,86,87, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1,86, + 87, +124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,79,76,72,0,5, +98,90,0,16,25, +91,83,70,66,61,0,1,86,87, +91,0,14, +91,0,14, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10,12, + 13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +91,0,14, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, + 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, + 59,71,75,80,100,120, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10,12, + 13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +79,0,77, +79,0,77, +116,115,79,0,73, +98,89,0,17,25, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, + 71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, + 71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, + 71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,47,48,49,50,53,54,56,57,58, + 59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,47,48,49,50,53,54,56,57,58, + 59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, + 58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,39,42,47,48,49,50,53,54,56, + 57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,39,42,47,48,49,50,53,54,56, + 57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,35,37,39,42,47,48,49,50,53, + 54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,32,35,37,39,42,47,48,49,50, + 53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10, + 12,13,14,15,16,18,19,20,21,22,23,24,26,32,35,37,39,42,47,48,49,50,53,54, + 56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, + 49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +95,0,12,21, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +88,0,11, +79,0,74, +79,0,74, +124,123,122,121,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105, + 98,97,95,94,93,92,91,90,89,85,83,79,76,72,70,66,61,0,1,86,87, +89,0,17, +89,0,17, +89,0,17, +118,117,0,51,52, +118,117,0,51,52, +116,115,0,48,49, +116,115,0,48,49, +116,115,0,48,49, +116,115,0,48,49, +114,113,112,111,0,43,44,45,46, +114,113,112,111,0,43,44,45,46, +105,98,0,25,34, +124,123,122,121,116,115,97,96,95,94,93,92,91,90,88,85,83,79,76,72,70,66,61, + 6,0,1,86,87, +98,89,0,17,25, +98,89,0,17,25, +90,0,16, +98,90,0,16,25, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1,86, + 87, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, + 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, + 59,71,75,80,100,120, +79,0, +79,0, +124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,26,32,35,37,39,42,47,48,49, + 50,53,54,56,57,58,59,71,75,80,100,120, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +98,90,0,16,25, +124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, + 48,49,50,53,54,56,57,58,59,71,75,80,100,120, +98,89,0,17,25, +124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, + 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, + 59,71,75,80,100,120, + +}; + + +static unsigned const char ag_astt[2635] = { + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,8,8,8,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,8,7,1,1,9,9,1,1,5,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,0,1,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,5,3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,7,2,1,2,2,2,1,1,1,1, + 1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,2,5,5,5,5,5, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,10,1,5,5,5,5,7,3,1,4,5,5,5,5,5,5,1,5,5,5,1,1,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0,9, +67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,69, +70,6, +62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,64, +65,8, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,1,9,53,37,3,3,3,51,50,49, + 20,44,18,3,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +52,10,80, +77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,82,53,77,77,77,77, + 11,79, +54,71, +144,144,144,144,144,144,3,144,144,144,3,1,2,13,3,3,182, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,14,3,3,149, +144,3,3,1,2,15,3,3,181, +144,3,3,1,2,16,3,3,180, +144,3,3,1,2,17,3,3,179, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,3, + 1,2,18,3,3,178, +13,15,16,17,14,88,81,10,88,19,53,54,20,59,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,20,53,37,20,55,55,55,36,34,32,31,30,29,27, + 28,29,29,26,23,22,21,19,12,11,33,35,18, +14,21,56, +14,22,57, +14,23,58, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,24,3,3,173, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,25,3,3,174, +59,51,60, +13,15,16,17,25,24,14,88,81,10,88,27,53,54,20,27,28,50,50,26,23,22,21,19,12, + 11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,28,53,54,20,27,28,49,49,26,23,22,21,19,12, + 11,33,35,18, +61,63,42,64,62, +25,24,37,66,65, +67,69,71,73,34,74,72,70,68, +75,77,79,32,80,78,76, +89,89,89,87, +81,30,82, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, + 144,144,144,144,3,3,1,2,35,3,3,158, +83,28,84, +85,87,89,91,93,54,94,92,90,88,86, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3, + 1,2,38,3,3,155, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144, + 144,3,1,2,144,39,3,3,148, +144,3,3,1,2,40,3,3,153, +144,3,3,1,2,41,3,3,152, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2, + 42,3,3,151, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,43,95, +96,39,44,17,97, +144,3,3,1,2,45,3,3,150, +14,46,98, +14,47,99, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,48,53,37,100,100,100,51, + 50,49,20,44,18,100,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26, + 23,22,21,19,12,11,33,35,18, +14,49,101, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,50,53,37,8,12,51,50,49, + 20,44,18,12,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,51,53,37,6,6,102,51,50, + 49,20,44,18,102,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23, + 22,21,19,12,11,33,35,18, +52,83,84, +52,78,76, +103,104,104,54,104, +96,105,55,58,97, +13,15,16,17,25,24,14,88,81,10,88,56,53,37,20,106,106,36,34,32,31,30,29,27, + 28,29,29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,57,53,37,20,107,107,36,34,32,31,30,29,27, + 28,29,29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,58,53,37,20,108,108,36,34,32,31,30,29,27, + 28,29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,59,3,3,177, +13,15,16,17,25,24,14,88,81,10,88,60,53,54,20,27,28,52,52,26,23,22,21,19,12, + 11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,61,3,3,176, +13,15,16,17,25,24,14,88,81,10,88,62,53,54,20,27,28,47,47,26,23,22,21,19,12, + 11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,63,3,3,175, +13,15,16,17,25,24,14,88,81,10,88,64,53,54,20,27,28,46,46,26,23,22,21,19,12, + 11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,65,53,54,20,109,27,28,109,109,26,23,22,21, + 19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,66,53,54,20,110,27,28,110,110,26,23,22,21, + 19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,67,3,3,172, +13,15,16,17,25,24,14,88,81,10,88,68,53,54,20,111,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,69,3,3,171, +13,15,16,17,25,24,14,88,81,10,88,70,53,54,20,112,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,71,3,3,170, +13,15,16,17,25,24,14,88,81,10,88,72,53,54,20,113,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,73,3,3,169, +13,15,16,17,25,24,14,88,81,10,88,74,53,54,20,114,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,75,3,3,168, +13,15,16,17,25,24,14,88,81,10,88,76,53,54,20,115,30,29,27,28,29,29,26,23,22, + 21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,77,3,3,167, +13,15,16,17,25,24,14,88,81,10,88,78,53,54,20,116,30,29,27,28,29,29,26,23,22, + 21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,79,3,3,166, +13,15,16,17,25,24,14,88,81,10,88,80,53,54,20,33,32,31,30,29,27,28,29,29,26, + 23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,81,3,3,165, +13,15,16,17,25,24,14,88,81,10,88,82,53,54,20,31,34,32,31,30,29,27,28,29,29, + 26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,83,3,3,164, +13,15,16,17,25,24,14,88,81,10,88,84,53,37,20,117,117,117,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,85,3,3,162, +13,15,16,17,25,24,14,88,81,10,88,86,53,37,20,27,27,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,87,3,3,161, +13,15,16,17,25,24,14,88,81,10,88,88,53,37,20,26,26,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,89,3,3,160, +13,15,16,17,25,24,14,88,81,10,88,90,53,37,20,25,25,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,91,3,3,159, +13,15,16,17,25,24,14,88,81,10,88,92,53,37,20,24,24,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,93,3,3,157, +13,15,16,17,25,24,14,88,81,10,88,94,53,37,20,23,23,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,38,118,40,41,42,45,14,39,88,81,10,88,95,53,37,3,3,3,51,50, + 49,20,44,18,3,48,47,46,43,19,44,44,36,34,32,31,30,29,27,28,29,29,26,23, + 22,21,19,12,11,33,35,18, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,96,3,3,156, +13,15,16,17,25,24,14,88,81,10,88,97,53,37,20,21,21,36,34,32,31,30,29,27,28, + 29,29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,98,53,37,20,119,119,119,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,99,53,37,20,120,120,120,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +40,100,121,46, +13,15,16,17,25,24,14,88,81,10,88,101,53,37,20,122,122,122,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +123,5,124, +85,103,125, +85,104,126, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, + 144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,105,3,3,147, +105,106,57, +105,107,56, +105,108,55, +61,63,44,64,62, +61,63,43,64,62, +25,24,41,66,65, +25,24,40,66,65, +25,24,39,66,65, +25,24,38,66,65, +67,69,71,73,36,74,72,70,68, +67,69,71,73,35,74,72,70,68, +127,96,117,97,128, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144, + 144,3,1,2,144,118,3,3,154, +96,105,119,16,97, +96,105,120,15,97, +39,121,13, +96,39,122,129,97, +144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2, + 123,3,3,146, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,124,53,37,7,11,51,50,49, + 20,44,18,11,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, +86,75, +86,74, +144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,127,3,3,163, +13,15,16,17,25,24,14,88,81,10,88,128,53,54,20,29,36,34,32,31,30,29,27,28,29, + 29,26,23,22,21,19,12,11,33,35,18, +13,15,16,17,25,24,14,88,81,10,88,129,53,37,20,130,130,130,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +96,39,130,131,97, +13,15,16,17,25,24,14,88,81,10,88,131,53,37,20,132,132,132,36,34,32,31,30,29, + 27,28,29,29,26,23,22,21,19,12,11,33,35,18, +96,105,132,133,97, +13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,133,53,37,9,14,51,50,49, + 20,44,18,14,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, + 19,12,11,33,35,18, + +}; + + +static const unsigned short ag_sbt[] = { + 0, 26, 52, 79, 85, 106, 129, 131, 155, 157, 214, 217, 244, 246, + 263, 282, 291, 300, 309, 335, 358, 396, 399, 402, 405, 424, 443, 446, + 475, 504, 509, 514, 523, 530, 534, 537, 568, 571, 582, 608, 636, 645, + 654, 679, 699, 704, 713, 716, 719, 775, 778, 833, 889, 892, 895, 900, + 905, 942, 979,1016,1035,1064,1083,1112,1131,1160,1190,1220,1239,1270, + 1289,1320,1339,1370,1389,1420,1439,1471,1490,1522,1541,1575,1594,1629, + 1648,1686,1705,1742,1761,1798,1817,1854,1873,1910,1929,1966,2024,2043, + 2080,2118,2156,2160,2198,2201,2204,2207,2247,2250,2253,2256,2261,2266, + 2271,2276,2281,2286,2295,2304,2309,2337,2342,2347,2350,2355,2380,2435, + 2437,2439,2458,2494,2532,2537,2575,2580,2635 +}; + + +static const unsigned short ag_sbe[] = { + 22, 49, 76, 83, 103, 128, 130, 154, 156, 175, 215, 242, 245, 259, + 278, 287, 296, 305, 331, 344, 369, 397, 400, 403, 420, 439, 444, 457, + 486, 506, 511, 518, 526, 533, 535, 564, 569, 576, 604, 632, 641, 650, + 675, 697, 701, 709, 714, 717, 736, 776, 795, 850, 890, 893, 898, 902, + 916, 953, 990,1031,1046,1079,1094,1127,1142,1171,1201,1235,1250,1285, + 1300,1335,1350,1385,1400,1435,1450,1486,1501,1537,1552,1590,1605,1644, + 1659,1701,1716,1757,1772,1813,1828,1869,1884,1925,1940,1984,2039,2054, + 2091,2129,2157,2171,2199,2202,2205,2243,2248,2251,2254,2258,2263,2268, + 2273,2278,2283,2290,2299,2306,2333,2339,2344,2348,2352,2376,2397,2436, + 2438,2454,2469,2505,2534,2548,2577,2597,2635 +}; + + +static const unsigned char ag_fl[] = { + 2,2,0,2,1,1,2,4,2,9,1,4,2,4,9,4,4,2,1,3,1,3,1,3,3,3,3,3,1,5,1,3,1,3,1, + 3,3,1,3,3,3,3,1,3,3,1,3,3,1,2,2,1,3,1,1,4,4,4,3,2,1,1,2,0,1,3,1,2,0,1, + 3,1,0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2 +}; + +static const unsigned char ag_ptt[] = { + 0, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 12, 18, + 18, 18, 15, 15, 24, 24, 24, 24, 24, 24, 26, 26, 32, 32, 35, 35, 37, 37, + 37, 39, 39, 39, 39, 39, 42, 42, 42, 47, 47, 47, 50, 50, 50, 53, 53, 54, + 54, 54, 54, 54, 54, 54, 1, 63, 63, 64, 64, 1, 68, 68, 69, 69, 1,120, + 73, 73,120,120, 71, 78, 78, 71, 71, 75, 75, 77, 77, 74, 74,100, 80, 80, + 60, 60, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 81, 81, 82, 82, 82, 86, 86, + 87, 87, 11, 17, 16, 14, 13, 19, 20, 21, 23, 22, 25, 27, 3, 28, 29, 30, + 31, 34, 33, 36, 38, 40, 41, 43, 44, 45, 46, 48, 49, 51, 52, 55, 2, 56, + 57, 58, 59 +}; + + +static void ag_ra(PCB_DECL) +{ + switch(ag_rpx[(PCB).ag_ap]) { + case 1: VRO(AG_WRAP_4 *, ag_rp_1(PCB_POINTER, VW(0, AG_WRAP_4 *))); break; + case 2: VNO AG_WRAP_4(ag_rp_2(PCB_POINTER)); break; + case 3: VRO(AG_WRAP_4 *, ag_rp_3(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 4: VRO(AG_WRAP_4 *, ag_rp_4(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 5: VRO(AG_WRAP_4 *, ag_rp_5(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_4 *); break; + case 6: VRO(AG_WRAP_4 *, ag_rp_6(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 7: VNO AG_WRAP_4(ag_rp_7(PCB_POINTER, VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *), VW(6, AG_WRAP_4 *), VW(8, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); VWD(6, AG_WRAP_4 *); VWD(8, AG_WRAP_4 *); break; + case 8: VRO(AG_WRAP_4 *, ag_rp_8(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_4 *); break; + case 9: VRO(AG_WRAP_4 *, ag_rp_9(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 10: VNO AG_WRAP_4(ag_rp_10(PCB_POINTER, VW(1, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); VWD(2, AG_WRAP_4 *); break; + case 11: VNO AG_WRAP_4(ag_rp_11(PCB_POINTER, VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *), VW(6, AG_WRAP_4 *), VW(8, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); VWD(6, AG_WRAP_4 *); VWD(8, AG_WRAP_4 *); break; + case 12: VNO AG_WRAP_4(ag_rp_12(PCB_POINTER, VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 13: VNO AG_WRAP_4(ag_rp_13(PCB_POINTER, VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 14: VRO(AG_WRAP_4 *, ag_rp_14(PCB_POINTER, VW(0, AG_WRAP_4 *))); break; + case 15: VNO AG_WRAP_4(ag_rp_15(PCB_POINTER)); break; + case 16: VNO AG_WRAP_4(ag_rp_16(PCB_POINTER, VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 17: VRO(AG_WRAP_4 *, ag_rp_17(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 18: VNO AG_WRAP_4(ag_rp_18(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 19: VNO AG_WRAP_4(ag_rp_19(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 20: VNO AG_WRAP_4(ag_rp_20(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 21: VNO AG_WRAP_4(ag_rp_21(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 22: VNO AG_WRAP_4(ag_rp_22(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 23: VRO(AG_WRAP_4 *, ag_rp_23(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); break; + case 24: VRO(AG_WRAP_4 *, ag_rp_24(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 25: VRO(AG_WRAP_4 *, ag_rp_25(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 26: VRO(AG_WRAP_4 *, ag_rp_26(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 27: VRO(AG_WRAP_4 *, ag_rp_27(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 28: VRO(AG_WRAP_4 *, ag_rp_28(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 29: VRO(AG_WRAP_4 *, ag_rp_29(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 30: VRO(AG_WRAP_4 *, ag_rp_30(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 31: VRO(AG_WRAP_4 *, ag_rp_31(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 32: VRO(AG_WRAP_4 *, ag_rp_32(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 33: VRO(AG_WRAP_4 *, ag_rp_33(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 34: VRO(AG_WRAP_4 *, ag_rp_34(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 35: VRO(AG_WRAP_4 *, ag_rp_35(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 36: VNO AG_WRAP_4(ag_rp_36(PCB_POINTER, VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 37: VNO AG_WRAP_4(ag_rp_37(PCB_POINTER, VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 38: VRO(AG_WRAP_4 *, ag_rp_38(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 39: VNO AG_WRAP_4(ag_rp_39(PCB_POINTER, V(0,(int *)))); break; + case 40: VNO AG_WRAP_4(ag_rp_40(PCB_POINTER, V(0,(int *)))); break; + case 41: VNO AG_WRAP_4(ag_rp_41(PCB_POINTER, VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 42: VNO AG_WRAP_4(ag_rp_42(PCB_POINTER, VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 43: VNO AG_WRAP_4(ag_rp_43(PCB_POINTER, VW(2, AG_WRAP_4 *))); + VWD(2, AG_WRAP_4 *); break; + case 44: VNO AG_WRAP_4(ag_rp_44(PCB_POINTER, VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 45: VNO AG_WRAP_4(ag_rp_45(PCB_POINTER, VW(1, AG_WRAP_4 *))); + VWD(1, AG_WRAP_4 *); break; + case 46: V(0,(int *)) = ag_rp_46(PCB_POINTER, V(0,(double *))); break; + case 47: V(0,(int *)) = ag_rp_47(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 48: V(0,(int *)) = ag_rp_48(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; + case 49: V(0,(double *)) = ag_rp_49(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; + case 50: V(0,(double *)) = ag_rp_50(PCB_POINTER, V(1,(double *))); break; + case 51: V(0,(double *)) = ag_rp_51(PCB_POINTER, V(0,(int *))); break; + case 52: V(0,(double *)) = ag_rp_52(PCB_POINTER, V(0,(double *)), V(1,(int *))); break; + case 53: V(0,(double *)) = ag_rp_53(PCB_POINTER, V(0,(int *))); break; + case 54: V(0,(double *)) = ag_rp_54(PCB_POINTER, V(0,(int *)), V(1,(double *))); break; + case 55: V(0,(int *)) = ag_rp_55(PCB_POINTER, V(0,(int *))); break; + case 56: V(0,(int *)) = ag_rp_56(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; + case 57: V(0,(int *)) = ag_rp_57(PCB_POINTER); break; + case 58: ag_rp_58(PCB_POINTER, V(0,(int *))); break; + case 59: ag_rp_59(PCB_POINTER, V(1,(int *))); break; + } + (PCB).la_ptr = (PCB).pointer; +} + +#define TOKEN_NAMES bciParse_token_names +const char *const bciParse_token_names[125] = { + "input string", + "white space", + "real", + "name", + "input string", + "statements", + "eof", + "statement", + "open statement", + "closed statement", + "if clause", + "\"else\"", + "while clause", + "\"for\"", + "'('", + "expression", + "';'", + "')'", + "simple statement", + "\"do\"", + "\"if\"", + "\"while\"", + "'{'", + "'}'", + "assignment expression", + "','", + "conditional expression", + "'='", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "logical or expression", + "'\\?'", + "':'", + "logical and expression", + "\"||\"", + "equality expression", + "\"&&\"", + "relational expression", + "\"==\"", + "\"!=\"", + "additive expression", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "multiplicative expression", + "'+'", + "'-'", + "unary expression", + "'*'", + "'/'", + "factor", + "primary", + "\"**\"", + "\"log\"", + "\"exp\"", + "\"sqrt\"", + "'!'", + "", + "\"/*\"", + "", + "", + "", + "\"*/\"", + "\"//\"", + "", + "", + "", + "'\\n'", + "simple real", + "", + "", + "exponent", + "integer part", + "'.'", + "fraction part", + "", + "digit", + "name string", + "letter", + "", + "", + "", + "", + "", + "", + "\"else\"", + "')'", + "';'", + "'('", + "\"for\"", + "\"do\"", + "\"if\"", + "\"while\"", + "'}'", + "'{'", + "','", + "'='", + "name", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "':'", + "'\\?'", + "\"||\"", + "\"&&\"", + "\"==\"", + "\"!=\"", + "'<'", + "\"<=\"", + "'>'", + "\">=\"", + "'+'", + "'-'", + "'*'", + "'/'", + "\"**\"", + "real", + "\"log\"", + "\"exp\"", + "\"sqrt\"", + "'!'", + +}; + +#ifndef MISSING_FORMAT +#define MISSING_FORMAT "Missing %s" +#endif +#ifndef UNEXPECTED_FORMAT +#define UNEXPECTED_FORMAT "Unexpected %s" +#endif +#ifndef UNNAMED_TOKEN +#define UNNAMED_TOKEN "input" +#endif + + +static void ag_diagnose(PCB_DECL) { + int ag_snd = (PCB).sn; + int ag_k = ag_sbt[ag_snd]; + + if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 + && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 + && *TOKEN_NAMES[ag_tstt[ag_k]]) { + sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); + } + else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); + } + else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') { + char buf[20]; + sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer))); + sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); + } + else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); + (PCB).error_message = (PCB).ag_msg; + + +} +static int ag_action_1_r_proc(PCB_DECL); +static int ag_action_2_r_proc(PCB_DECL); +static int ag_action_3_r_proc(PCB_DECL); +static int ag_action_4_r_proc(PCB_DECL); +static int ag_action_1_s_proc(PCB_DECL); +static int ag_action_3_s_proc(PCB_DECL); +static int ag_action_1_proc(PCB_DECL); +static int ag_action_2_proc(PCB_DECL); +static int ag_action_3_proc(PCB_DECL); +static int ag_action_4_proc(PCB_DECL); +static int ag_action_5_proc(PCB_DECL); +static int ag_action_6_proc(PCB_DECL); +static int ag_action_7_proc(PCB_DECL); +static int ag_action_8_proc(PCB_DECL); +static int ag_action_9_proc(PCB_DECL); +static int ag_action_10_proc(PCB_DECL); +static int ag_action_11_proc(PCB_DECL); +static int ag_action_8_proc(PCB_DECL); + + +static int (*const ag_r_procs_scan[])(PCB_DECL) = { + ag_action_1_r_proc, + ag_action_2_r_proc, + ag_action_3_r_proc, + ag_action_4_r_proc +}; + +static int (*const ag_s_procs_scan[])(PCB_DECL) = { + ag_action_1_s_proc, + ag_action_2_r_proc, + ag_action_3_s_proc, + ag_action_4_r_proc +}; + +static int (*const ag_gt_procs_scan[])(PCB_DECL) = { + ag_action_1_proc, + ag_action_2_proc, + ag_action_3_proc, + ag_action_4_proc, + ag_action_5_proc, + ag_action_6_proc, + ag_action_7_proc, + ag_action_8_proc, + ag_action_9_proc, + ag_action_10_proc, + ag_action_11_proc, + ag_action_8_proc +}; + + +static int ag_action_10_proc(PCB_DECL) { + int ag_t = (PCB).token_number; + (PCB).btsx = 0, (PCB).drt = -1; + do { + ag_track(PCB_POINTER); + (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); + (PCB).la_ptr++; + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); + if (ag_ch <= 255) { + while (ag_key_ch[ag_k] < ag_ch) ag_k++; + if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); + } + } + } while ((PCB).token_number == (bciParse_token_type) ag_t); + (PCB).la_ptr = (PCB).pointer; + return 1; +} + +static int ag_action_11_proc(PCB_DECL) { + int ag_t = (PCB).token_number; + + (PCB).btsx = 0, (PCB).drt = -1; + do { + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; + (PCB).ssx--; + ag_track(PCB_POINTER); + ag_ra(PCB_POINTER); + if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; + (PCB).ssx++; + (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); + (PCB).la_ptr++; + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); + if (ag_ch <= 255) { + while (ag_key_ch[ag_k] < ag_ch) ag_k++; + if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); + } + } + } + while ((PCB).token_number == (bciParse_token_type) ag_t); + (PCB).la_ptr = (PCB).pointer; + return 1; +} + +static int ag_action_3_r_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_3_s_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).btsx = 0, (PCB).drt = -1; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_4_r_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + return 1; +} + +static int ag_action_2_proc(PCB_DECL) { + (PCB).btsx = 0, (PCB).drt = -1; + if ((PCB).ssx >= 128) { + (PCB).exit_flag = AG_STACK_ERROR_CODE; + PARSER_STACK_OVERFLOW; + } + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + ag_track(PCB_POINTER); + return 0; +} + +static int ag_action_9_proc(PCB_DECL) { + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + ag_prot(PCB_POINTER); + (PCB).vs[(PCB).ssx] = ag_null_value; + (PCB).ss[(PCB).ssx] = (PCB).sn; + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + (PCB).la_ptr = (PCB).pointer; + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_2_r_proc(PCB_DECL) { + (PCB).ssx++; + (PCB).sn = (PCB).ag_ap; + return 0; +} + +static int ag_action_7_proc(PCB_DECL) { + --(PCB).ssx; + (PCB).la_ptr = (PCB).pointer; + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_proc(PCB_DECL) { + ag_track(PCB_POINTER); + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_r_proc(PCB_DECL) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_1_s_proc(PCB_DECL) { + (PCB).exit_flag = AG_SUCCESS_CODE; + return 0; +} + +static int ag_action_4_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return 0; +} + +static int ag_action_3_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap] - 1; + (PCB).btsx = 0, (PCB).drt = -1; + (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else (PCB).ss[(PCB).ssx] = (PCB).sn; + ag_track(PCB_POINTER); + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return 0; +} + +static int ag_action_8_proc(PCB_DECL) { + ag_undo(PCB_POINTER); + (PCB).la_ptr = (PCB).pointer; + (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; + ag_diagnose(PCB_POINTER); + SYNTAX_ERROR; + {(PCB).la_ptr = (PCB).pointer + 1; ag_track(PCB_POINTER);} + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_5_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).btsx = 0, (PCB).drt = -1; + if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + else { + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).la_ptr = (PCB).pointer; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + ag_ra(PCB_POINTER); + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + +static int ag_action_6_proc(PCB_DECL) { + int ag_sd = ag_fl[(PCB).ag_ap]; + (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; + if ((PCB).drt == -1) { + (PCB).drt=(PCB).token_number; + (PCB).dssx=(PCB).ssx; + (PCB).dsn=(PCB).sn; + } + if (ag_sd) { + (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; + } + else { + ag_prot(PCB_POINTER); + (PCB).vs[(PCB).ssx] = ag_null_value; + (PCB).ss[(PCB).ssx] = (PCB).sn; + } + (PCB).la_ptr = (PCB).pointer; + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; + unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + (PCB).ag_ap = ag_pstt[ag_t1]; + if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; + } + return (PCB).exit_flag == AG_RUNNING_CODE; +} + + +void init_bciParse(bciParse_pcb_type *PCB_POINTER) { + (PCB).la_ptr = (PCB).pointer; + (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; + (PCB).exit_flag = AG_RUNNING_CODE; + (PCB).line = FIRST_LINE; + (PCB).column = FIRST_COLUMN; + (PCB).btsx = 0, (PCB).drt = -1; +} + +void bciParse(bciParse_pcb_type *PCB_POINTER) { + init_bciParse(PCB_POINTER); + (PCB).exit_flag = AG_RUNNING_CODE; + while ((PCB).exit_flag == AG_RUNNING_CODE) { + unsigned ag_t1 = ag_sbt[(PCB).sn]; + if (ag_tstt[ag_t1]) { + unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; + (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); + (PCB).la_ptr++; + if (ag_key_index[(PCB).sn]) { + unsigned ag_k = ag_key_index[(PCB).sn]; + int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); + if (ag_ch <= 255) { + while (ag_key_ch[ag_k] < ag_ch) ag_k++; + if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); + } + } + do { + unsigned ag_tx = (ag_t1 + ag_t2)/2; + if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) + ag_t1 = ag_tx + 1; + else ag_t2 = ag_tx; + } while (ag_t1 < ag_t2); + if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) + ag_t1 = ag_sbe[(PCB).sn]; + } + (PCB).ag_ap = ag_pstt[ag_t1]; + (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER); + } +} + +