Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/examples/good/rcalc.h @ 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 #ifndef RCALC_H | |
2 #define RCALC_H | |
3 | |
4 typedef union { | |
5 long alignment; | |
6 char ag_vt_2[sizeof(int)]; | |
7 char ag_vt_3[sizeof(long)]; | |
8 } rcalc_vs_type; | |
9 | |
10 typedef enum { | |
11 rcalc_ws_token = 1, rcalc_calculation_token = 3, rcalc_expression_token, | |
12 rcalc_eof_token, rcalc_term_token, rcalc_factor_token = 9, | |
13 rcalc_thousands_token = 15, rcalc_hundreds_token, rcalc_m_token = 18, | |
14 rcalc_hundreds_field_token, rcalc_tens_token, rcalc_c_token = 22, | |
15 rcalc_d_token, rcalc_count_hundreds_token, rcalc_tens_field_token, | |
16 rcalc_units_token, rcalc_x_token = 28, rcalc_l_token, | |
17 rcalc_count_tens_token, rcalc_i_token, rcalc_v_token, | |
18 rcalc_count_units_token, rcalc_roman_numeral_token = 40 | |
19 } rcalc_token_type; | |
20 | |
21 typedef struct rcalc_pcb_struct{ | |
22 rcalc_token_type token_number, reduction_token, error_frame_token; | |
23 int input_code; | |
24 int input_value; | |
25 int line, column; | |
26 int ssx, sn, error_frame_ssx; | |
27 int drt, dssx, dsn; | |
28 int ss[128]; | |
29 rcalc_vs_type vs[128]; | |
30 int ag_ap; | |
31 const char *error_message; | |
32 char read_flag; | |
33 char exit_flag; | |
34 int input_context; | |
35 int cs[128]; | |
36 int bts[128], btsx; | |
37 unsigned char * pointer; | |
38 unsigned char * la_ptr; | |
39 const unsigned char *key_sp; | |
40 int save_index, key_state; | |
41 char ag_msg[82]; | |
42 } rcalc_pcb_type; | |
43 | |
44 #ifndef PRULE_CONTEXT | |
45 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
46 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
47 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
48 #endif | |
49 | |
50 #ifndef AG_RUNNING_CODE | |
51 /* PCB.exit_flag values */ | |
52 #define AG_RUNNING_CODE 0 | |
53 #define AG_SUCCESS_CODE 1 | |
54 #define AG_SYNTAX_ERROR_CODE 2 | |
55 #define AG_REDUCTION_ERROR_CODE 3 | |
56 #define AG_STACK_ERROR_CODE 4 | |
57 #define AG_SEMANTIC_ERROR_CODE 5 | |
58 #endif | |
59 | |
60 extern rcalc_pcb_type rcalc_pcb; | |
61 void init_rcalc(void); | |
62 void rcalc(void); | |
63 #endif | |
64 |