X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=oberon.h;h=4b785453befda47bbdcfe1ccf9c7b9a67ccfd1cc;hb=c4d4a265b71124ad0e8588601cfc1d66aca84b96;hp=09a24c98caeaa08f59b50e8b562035b261acd9d7;hpb=1bf625553dc35ac4a5c1afceb6950fd44776a424;p=dsw-obn.git diff --git a/oberon.h b/oberon.h index 09a24c9..4b78545 100644 --- a/oberon.h +++ b/oberon.h @@ -11,34 +11,35 @@ 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; + gcc_jit_lvalue * gcc_alloc; }; typedef struct oberon_type_s oberon_type_t; @@ -114,6 +115,8 @@ struct oberon_type_s oberon_type_t * base; oberon_object_t * decl; + oberon_module_t * module; + int recursive; int initialized; gen_type_t * gen_type; @@ -136,12 +139,8 @@ enum OBERON_CLASS_PARAM, OBERON_CLASS_VAR_PARAM, OBERON_CLASS_CONST, - OBERON_CLASS_FIELD -}; - -enum -{ - OBERON_SYSPROC_ABS + OBERON_CLASS_FIELD, + OBERON_CLASS_MODULE }; /* @@ -161,6 +160,8 @@ struct oberon_object_s { char * name; int class; + int export; + int read_only; int local; int linked; @@ -178,6 +179,8 @@ struct oberon_object_s oberon_item_t * value; oberon_object_t * next; + oberon_module_t * module; + gen_var_t * gen_var; gen_proc_t * gen_proc; }; @@ -193,10 +196,11 @@ struct oberon_object_s struct oberon_module_s { char * name; + int ready; oberon_scope_t * decl; - void (* begin)(); + oberon_module_t * next; }; /* @@ -216,8 +220,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; @@ -225,16 +232,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; }; @@ -247,7 +258,8 @@ enum MODE_INDEX, MODE_FIELD, MODE_DEREF, - MODE_NIL + MODE_NIL, + MODE_NEWARR }; enum @@ -281,6 +293,7 @@ struct oberon_item_s int is_item; // == 1 oberon_type_t * result; oberon_expr_t * next; + int read_only; int mode; int integer; @@ -291,6 +304,7 @@ struct oberon_item_s int num_args; oberon_expr_t * args; + oberon_type_t * type; }; struct oberon_oper_s @@ -298,6 +312,7 @@ struct oberon_oper_s int is_item; // == 0 oberon_type_t * result; oberon_expr_t * next; + int read_only; int op; oberon_expr_t * left; @@ -310,13 +325,14 @@ union oberon_expr_u int is_item; oberon_type_t * result; oberon_expr_t * next; + int read_only; }; oberon_item_t item; 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);