comparison tests/agcl/ffcalc/good/ffc.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 FFC_H
2 #define FFC_H
3
4 typedef union {
5 double alignment;
6 char ag_vt_2[sizeof(int)];
7 char ag_vt_4[sizeof(double)];
8 } ffc_vs_type;
9
10 typedef enum {
11 ffc_white_space_token = 1, ffc_calculator_token = 3,
12 ffc_calculation_token, ffc_eof_token = 10, ffc_expression_token,
13 ffc_name_token, ffc_error_token = 14, ffc_term_token,
14 ffc_factor_token = 18, ffc_integer_part_token = 30,
15 ffc_fraction_part_token = 32, ffc_digit_token = 34, ffc_real_token = 44
16 } ffc_token_type;
17
18 typedef struct ffc_pcb_struct{
19 ffc_token_type token_number, reduction_token, error_frame_token;
20 int input_code;
21 int input_value;
22 int line, column;
23 int ssx, sn, error_frame_ssx;
24 int drt, dssx, dsn;
25 int ss[128];
26 ffc_vs_type vs[128];
27 int ag_ap;
28 const char *error_message;
29 char read_flag;
30 char exit_flag;
31 int bts[128], btsx;
32 int lab[3], rx, fx;
33 const unsigned char *key_sp;
34 int save_index, key_state;
35 char ag_msg[82];
36 } ffc_pcb_type;
37
38 #ifndef PRULE_CONTEXT
39 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx]))
40 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx])
41 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx])
42 #endif
43
44 #ifndef AG_RUNNING_CODE
45 /* PCB.exit_flag values */
46 #define AG_RUNNING_CODE 0
47 #define AG_SUCCESS_CODE 1
48 #define AG_SYNTAX_ERROR_CODE 2
49 #define AG_REDUCTION_ERROR_CODE 3
50 #define AG_STACK_ERROR_CODE 4
51 #define AG_SEMANTIC_ERROR_CODE 5
52 #endif
53
54 extern ffc_pcb_type ffc_pcb;
55 void init_ffc(void);
56 void ffc(void);
57 #endif
58