X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=oberon.h;h=9956fdc09d0a9bc77edff1d295ce48b7d4f35ee5;hb=c15b86365824545bdee7d813ce0c796f1bdff592;hp=9d17afdb16e76ff0bbfa3e8d2ce30d4b80e46a7b;hpb=2d029d2c2b27639e3a2b6c43e63788b00110818e;p=dsw-obn.git diff --git a/oberon.h b/oberon.h index 9d17afd..9956fdc 100644 --- a/oberon.h +++ b/oberon.h @@ -11,33 +11,34 @@ typedef struct gen_context_s gen_context_t; struct gen_proc_s { - gcc_jit_function * gcc_func; + gcc_jit_function * gcc_func; }; struct gen_type_s { - gcc_jit_type * gcc_type; - gcc_jit_struct * gcc_struct; + gcc_jit_type * gcc_type; + gcc_jit_struct * gcc_struct; }; struct gen_var_s { - gcc_jit_lvalue * gcc_lvalue; - gcc_jit_param * gcc_param; - gcc_jit_field * gcc_field; + gcc_jit_lvalue * gcc_lvalue; + gcc_jit_param * gcc_param; + gcc_jit_field * gcc_field; }; struct gen_block_s { - gcc_jit_block * gcc_block; + gcc_jit_block * gcc_block; gen_block_t * up; }; struct gen_context_s { - gcc_jit_context * gcc_context; - gcc_jit_result * gcc_result; + gcc_jit_context * gcc_context; + gcc_jit_result * gcc_result; gen_block_t * block; + unsigned record_count; }; typedef struct oberon_type_s oberon_type_t; @@ -135,7 +136,8 @@ enum OBERON_CLASS_PARAM, OBERON_CLASS_VAR_PARAM, OBERON_CLASS_CONST, - OBERON_CLASS_FIELD + OBERON_CLASS_FIELD, + OBERON_CLASS_MODULE }; /* @@ -148,6 +150,9 @@ enum * next -- ссылка на следующий объект в списке. */ +typedef oberon_expr_t * (*GenerateFuncCallback)(oberon_context_t *, int, oberon_expr_t *); +typedef void (*GenerateProcCallback)(oberon_context_t *, int, oberon_expr_t *); + struct oberon_object_s { char * name; @@ -158,13 +163,19 @@ struct oberon_object_s int initialized; oberon_object_t * parent; - int has_return; // for proc + oberon_scope_t * scope; // for proc + int has_return; // for proc + int sysproc; + GenerateFuncCallback genfunc; + GenerateProcCallback genproc; oberon_type_t * type; oberon_item_t * value; oberon_object_t * next; + oberon_module_t * module; + gen_var_t * gen_var; gen_proc_t * gen_proc; }; @@ -180,10 +191,11 @@ struct oberon_object_s struct oberon_module_s { char * name; + int ready; oberon_scope_t * decl; - void (* begin)(); + oberon_module_t * next; }; /* @@ -203,8 +215,11 @@ struct oberon_module_s * world_scope -- область видимости "мир" - выше модуля. */ +typedef const char * (*ModuleImportCallback)(const char * name); + struct oberon_context_s { + /*** SCANER DATA ***/ const char * code; int code_index; @@ -212,16 +227,20 @@ struct oberon_context_s int token; char * string; int integer; + /*** END SCANER DATA ***/ + /*** PARSER DATA ***/ oberon_scope_t * decl; oberon_module_t * mod; + /*** END PARSER DATA ***/ oberon_type_t * int_type; oberon_type_t * bool_type; oberon_type_t * void_type; oberon_type_t * void_ptr_type; oberon_scope_t * world_scope; - + oberon_module_t * module_list; + ModuleImportCallback import_module; gen_context_t * gen_context; }; @@ -239,15 +258,22 @@ enum enum { - OP_LOGIC_NOT, OP_UNARY_MINUS, + OP_BITWISE_NOT, + OP_LOGIC_NOT, + OP_ABS, + OP_ADD, OP_SUB, OP_MUL, OP_DIV, OP_MOD, + OP_BITWISE_AND, + OP_BITWISE_XOR, + OP_BITWISE_OP, OP_LOGIC_AND, OP_LOGIC_OR, + OP_EQ, OP_NEQ, OP_LSS, @@ -296,7 +322,7 @@ union oberon_expr_u oberon_oper_t oper; }; -oberon_context_t * oberon_create_context(); +oberon_context_t * oberon_create_context(ModuleImportCallback import_module); void oberon_destroy_context(oberon_context_t * ctx); void oberon_register_global_type(oberon_context_t * ctx, oberon_type_t * type); oberon_module_t * oberon_compile_module(oberon_context_t * ctx, const char * code);