DEADSOFTWARE

Добавлены типы INTEGER и BOOLEAN
[dsw-obn.git] / oberon.h
index 7fee329106ba6f15a64fa07afbeaf1deff994f35..ec742c6bd7af90c18b3850a37fe2163b12407de4 100644 (file)
--- a/oberon.h
+++ b/oberon.h
@@ -1,22 +1,24 @@
 #ifndef EMBEDED_OBERON_SCRIPT_H
 #define EMBEDED_OBERON_SCRIPT_H
 
-enum {
-       OBERON_TYPE_INTEGER,
-       OBERON_TYPE_BOOLEAN,
-};
-
 typedef struct oberon_var_s oberon_var_t;
 typedef struct oberon_type_s oberon_type_t;
 typedef struct oberon_module_s oberon_module_t;
 typedef struct oberon_context_s oberon_context_t;
 
+enum {
+       OBERON_TYPE_INTEGER,
+       OBERON_TYPE_BOOLEAN,
+};
+
 struct oberon_type_s
 {
        char * name;
        int class;
        int size;
        oberon_type_t * next;
+
+       void * gen_type;
 };
 
 struct oberon_var_s
@@ -24,12 +26,16 @@ struct oberon_var_s
         char * name;
         oberon_type_t * type;
         oberon_var_t * next;
+
+       void * gen_var;
 };
 
 struct oberon_module_s
 {
        char * name;
        oberon_var_t * vars;
+
+       void (* begin)();
 };
 
 struct oberon_context_s
@@ -43,12 +49,29 @@ struct oberon_context_s
        int integer;
 
        oberon_module_t * mod;
-
        oberon_type_t * types;
+
+       void * gen_context;
+};
+
+enum {
+       MODE_VAR,
+       MODE_INTEGER,
+       MODE_BOOLEAN
 };
 
+typedef struct
+{
+       int mode;
+       int integer;
+       int boolean;
+       oberon_var_t * var;
+} oberon_item_t;
+
 oberon_context_t * oberon_create_context();
+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);
+void oberon_error(oberon_context_t * ctx, const char * fmt, ...);
 
 #endif // EMBEDED_OBERON_SCRIPT_H