Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/ffcalc/good/ffc-w.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-W_H | |
2 #define FFC-W_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-w_vs_type; | |
35 | |
36 typedef enum { | |
37 ffc-w_white_space_token = 1, ffc-w_calculator_token = 3, | |
38 ffc-w_calculation_token, ffc-w_eof_token = 10, ffc-w_expression_token, | |
39 ffc-w_name_token, ffc-w_error_token = 14, ffc-w_term_token, | |
40 ffc-w_factor_token = 18, ffc-w_integer_part_token = 30, | |
41 ffc-w_fraction_part_token = 32, ffc-w_digit_token = 34, | |
42 ffc-w_real_token = 44 | |
43 } ffc-w_token_type; | |
44 | |
45 typedef struct ffc-w_pcb_struct{ | |
46 ffc-w_token_type token_number, reduction_token, error_frame_token; | |
47 int input_code; | |
48 int input_value; | |
49 int line, column; | |
50 int ssx, sn, error_frame_ssx; | |
51 int drt, dssx, dsn; | |
52 int ss[128]; | |
53 ffc-w_vs_type vs[128]; | |
54 int ag_ap; | |
55 const char *error_message; | |
56 char read_flag; | |
57 char exit_flag; | |
58 int bts[128], btsx; | |
59 int lab[3], rx, fx; | |
60 const unsigned char *key_sp; | |
61 int save_index, key_state; | |
62 char ag_msg[82]; | |
63 } ffc-w_pcb_type; | |
64 | |
65 #ifndef PRULE_CONTEXT | |
66 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
67 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
68 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
69 #endif | |
70 | |
71 #ifndef AG_RUNNING_CODE | |
72 /* PCB.exit_flag values */ | |
73 #define AG_RUNNING_CODE 0 | |
74 #define AG_SUCCESS_CODE 1 | |
75 #define AG_SYNTAX_ERROR_CODE 2 | |
76 #define AG_REDUCTION_ERROR_CODE 3 | |
77 #define AG_STACK_ERROR_CODE 4 | |
78 #define AG_SEMANTIC_ERROR_CODE 5 | |
79 #endif | |
80 | |
81 extern ffc-w_pcb_type ffc-w_pcb; | |
82 void init_ffc-w(void); | |
83 void ffc-w(void); | |
84 #endif | |
85 |