comparison tests/agcl/ffcalc/good/ffc-wa.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-WA_H
2 #define FFC-WA_H
3
4 #ifndef AG_OBJECT_WRAPPER_DEFINED
5 #define AG_OBJECT_WRAPPER_DEFINED
6
7 #ifndef AG_PLACEMENT_DELETE_REQUIRED
8 #if _MSC_VER >= 1200 || __INTEL_COMPILER
9 #define AG_PLACEMENT_DELETE_REQUIRED 1
10 #endif
11 #endif
12
13 template <class Object>
14 class AgObjectWrapper {
15 Object object;
16 public:
17 void operator delete(void *) {}
18 void *operator new(size_t, void *p) { return p;}
19 #if AG_PLACEMENT_DELETE_REQUIRED
20 void operator delete(void *, void *) { }
21 #endif
22 AgObjectWrapper(const Object &o) : object(o) {}
23 ~AgObjectWrapper() {}
24 operator Object &() {return object;}
25 };
26
27 #endif
28
29 typedef union {
30 double alignment;
31 char ag_vt_2[sizeof(int)];
32 char ag_vt_4[sizeof(AgObjectWrapper<Number >)];
33 char ag_vt_5[sizeof(double)];
34 } ffc-wa_vs_type;
35
36 typedef enum {
37 ffc-wa_white_space_token = 1, ffc-wa_calculator_token = 3,
38 ffc-wa_calculation_token, ffc-wa_eof_token = 10, ffc-wa_expression_token,
39 ffc-wa_name_token, ffc-wa_term_token = 14, ffc-wa_factor_token = 17,
40 ffc-wa_integer_part_token = 29, ffc-wa_fraction_part_token = 31,
41 ffc-wa_digit_token = 33, ffc-wa_real_token = 43
42 } ffc-wa_token_type;
43
44 typedef struct ffc-wa_pcb_struct{
45 ffc-wa_token_type token_number, reduction_token, error_frame_token;
46 int input_code;
47 int input_value;
48 int line, column;
49 int ssx, sn, error_frame_ssx;
50 int drt, dssx, dsn;
51 int ss[128];
52 ffc-wa_vs_type vs[128];
53 int ag_ap;
54 const char *error_message;
55 char read_flag;
56 char exit_flag;
57 int bts[128], btsx;
58 int (* const *gt_procs)(void);
59 int (* const *r_procs)(void);
60 int (* const *s_procs)(void);
61 int lab[3], rx, fx;
62 const unsigned char *key_sp;
63 int save_index, key_state;
64 int ag_error_depth, ag_min_depth, ag_tmp_depth;
65 int ag_rss[2*128], ag_lrss;
66 char ag_msg[82];
67 int ag_resynch_active;
68 } ffc-wa_pcb_type;
69
70 #ifndef PRULE_CONTEXT
71 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx]))
72 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx])
73 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx])
74 #endif
75
76 #ifndef AG_RUNNING_CODE
77 /* PCB.exit_flag values */
78 #define AG_RUNNING_CODE 0
79 #define AG_SUCCESS_CODE 1
80 #define AG_SYNTAX_ERROR_CODE 2
81 #define AG_REDUCTION_ERROR_CODE 3
82 #define AG_STACK_ERROR_CODE 4
83 #define AG_SEMANTIC_ERROR_CODE 5
84 #endif
85
86 extern ffc-wa_pcb_type ffc-wa_pcb;
87 void init_ffc-wa(void);
88 void ffc-wa(void);
89 #endif
90