00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __ESP_H__
00011 #define __ESP_H__
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015
00016 #ifndef NULL
00017 #define NULL (0)
00018 #endif
00019
00020 #ifndef FALSE
00021 #define FALSE (0)
00022 #endif
00023
00024 #ifndef TRUE
00025 #define TRUE (1)
00026 #endif
00027
00028 enum _type{
00029 ENUM_t = 0,
00030 STR_t,
00031 BOOL_t,
00032 INT_t,
00033 FLT_t
00034 };
00035
00036 typedef unsigned char Bool;
00037
00038
00039
00040
00041 typedef struct _Enumerator{
00042 int nvalue;
00043 unsigned long *value;
00044 char **literal;
00045 }Enumerator;
00046
00047 typedef union _Initializer{
00048 Enumerator enumerator;
00049 char *string;
00050 Bool bool;
00051 long integer;
00052 double floating;
00053 }Initializer;
00054
00055 typedef struct _Typedecl{
00056 char *identifier;
00057 int specifier;
00058 int sign;
00059 int exp;
00060 int flt;
00061 }Typedecl;
00062
00063 typedef struct _Structdecl{
00064 char *identifier;
00065
00066 char **typename;
00067 int *typeid;
00068 int ntype;
00069
00070 char **classname;
00071 int *classid;
00072 int nclass;
00073
00074 Initializer *initializer;
00075 }Structdecl;
00076
00077 typedef struct _Classdecl {
00078 char *identifier;
00079 Structdecl *structdecl;
00080 int nstructdecl;
00081 }Classdecl;
00082
00083 typedef struct _Namesdecl {
00084 char *identifier;
00085 Classdecl *classdecl;
00086 int nclassdecl;
00087 }Namesdecl;
00088
00089 typedef struct _Declare {
00090 Typedecl *typedecl;
00091 Namesdecl *namesdecl;
00092 int ntypedecl;
00093 int nnamesdecl;
00094 }Declare;
00095
00096
00097
00098
00099
00100 typedef union _Value{
00101 unsigned long enumerator;
00102 char *string;
00103 Bool bool;
00104 long *integer;
00105 double *floating;
00106 }Value;
00107
00108 typedef struct _Construct{
00109 int namesid;
00110 int classid;
00111 int structid;
00112
00113 char *name;
00114
00115 struct _Construct **construct;
00116 int nconstruct;
00117
00118 int *nvalue;
00119 Value **value;
00120 }Construct;
00121
00122 typedef struct _Implement{
00123 int defnamesid;
00124 int nconstruct;
00125 Construct **construct;
00126 }Implement;
00127
00128
00129
00130
00131
00132 extern void openfile(char *string);
00133 extern int yywrap(void);
00134 extern void yyerror(char *errmsg);
00135
00136
00137 extern Declare *init_declare(void);
00138 extern int type_identifier(char *ident);
00139 extern void type_declarator(int sp, char *bitfield, int id);
00140 extern int struct_identifier(char *ident);
00141 extern void type_declaration(int id, char *name);
00142 extern void class_declaration(int id, char *name);
00143 extern void struct_declarator(void);
00144 extern int class_identifier(char *ident);
00145 extern void class_declarator(void);
00146 extern int names_identifier(char *ident);
00147 extern void names_declarator(void);
00148
00149 extern void integer_initializer(long val);
00150 extern void floating_initializer(double val);
00151 extern void string_initializer(char *val);
00152 extern void enum_initializer(char *val);
00153 extern void bool_initializer(Bool val);
00154 extern Bool true_or_false(char *words);
00155
00156
00157
00158
00159 extern Implement *init_implement(Declare *declare);
00160 extern void namespace_definition(int id);
00161 extern void default_namespace(int id);
00162 extern int declared_namesid(char *ident);
00163 extern int declared_classid(char *ident);
00164 extern int class_definition(int id, char *name);
00165 extern int declared_typename(char *name);
00166 extern int declared_classname(char *name);
00167 extern int referred_classname(char *name);
00168 extern void type_operator(char *name);
00169 extern void class_operator(char *name);
00170 extern void nest_operator(char *name);
00171 extern void bool_literal(Bool val);
00172 extern void string_literal(char *literal);
00173 extern void enumerator_literal(char *literal);
00174 extern void integer_literal(long lval);
00175 extern void floating_literal(double dval);
00176 extern void separator(void);
00177 extern void reference(int id);
00178 extern void subclassname(char *name);
00179 extern void nest_operator(char *name);
00180 extern void nest_implementation(void);
00181 extern void type_implementation(void);
00182 extern void class_implementation(void);
00183 extern void definition(int classid);
00184
00185
00186
00187 extern void print_typedecl(Declare *declare);
00188 extern void print_namesdecl(Declare *declare);
00189 extern void print_declare(Declare *declare);
00190 extern void print_construct(Declare *declare, Construct *construct);
00191 extern void print_implement(Declare *declare,Implement *implement);
00192
00193
00194
00195 #ifdef __cplusplus
00196 }
00197 #endif
00198 #endif