Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/bugs/good/wraperror.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 WRAPERROR_H | |
2 #define WRAPERROR_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 long alignment; | |
31 char ag_vt_2[sizeof(int)]; | |
32 char ag_vt_4[sizeof(AgObjectWrapper<foo >)]; | |
33 char ag_vt_5[sizeof(bar)]; | |
34 } wraperror_vs_type; | |
35 | |
36 typedef enum { | |
37 wraperror_file_token = 1, wraperror_declarations_token, | |
38 wraperror_eof_token, wraperror_declaration_token, | |
39 wraperror_foo_decl_token = 6, wraperror_bar_decl_token = 8, | |
40 wraperror_error_token | |
41 } wraperror_token_type; | |
42 | |
43 typedef struct wraperror_pcb_struct{ | |
44 wraperror_token_type token_number, reduction_token, error_frame_token; | |
45 int input_code; | |
46 int input_value; | |
47 int line, column; | |
48 int ssx, sn, error_frame_ssx; | |
49 int drt, dssx, dsn; | |
50 int ss[128]; | |
51 wraperror_vs_type vs[128]; | |
52 int ag_ap; | |
53 const char *error_message; | |
54 char read_flag; | |
55 char exit_flag; | |
56 int bts[128], btsx; | |
57 char ag_msg[82]; | |
58 } wraperror_pcb_type; | |
59 | |
60 #ifndef PRULE_CONTEXT | |
61 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
62 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
63 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
64 #endif | |
65 | |
66 #ifndef AG_RUNNING_CODE | |
67 /* PCB.exit_flag values */ | |
68 #define AG_RUNNING_CODE 0 | |
69 #define AG_SUCCESS_CODE 1 | |
70 #define AG_SYNTAX_ERROR_CODE 2 | |
71 #define AG_REDUCTION_ERROR_CODE 3 | |
72 #define AG_STACK_ERROR_CODE 4 | |
73 #define AG_SEMANTIC_ERROR_CODE 5 | |
74 #endif | |
75 | |
76 extern wraperror_pcb_type wraperror_pcb; | |
77 void init_wraperror(void); | |
78 void wraperror(void); | |
79 #endif | |
80 |