DEADSOFTWARE

Добавлены типы INTEGER и BOOLEAN
[dsw-obn.git] / oberon.h
1 #ifndef EMBEDED_OBERON_SCRIPT_H
2 #define EMBEDED_OBERON_SCRIPT_H
4 typedef struct oberon_var_s oberon_var_t;
5 typedef struct oberon_type_s oberon_type_t;
6 typedef struct oberon_module_s oberon_module_t;
7 typedef struct oberon_context_s oberon_context_t;
9 enum {
10 OBERON_TYPE_INTEGER,
11 OBERON_TYPE_BOOLEAN,
12 };
14 struct oberon_type_s
15 {
16 char * name;
17 int class;
18 int size;
19 oberon_type_t * next;
21 void * gen_type;
22 };
24 struct oberon_var_s
25 {
26 char * name;
27 oberon_type_t * type;
28 oberon_var_t * next;
30 void * gen_var;
31 };
33 struct oberon_module_s
34 {
35 char * name;
36 oberon_var_t * vars;
38 void (* begin)();
39 };
41 struct oberon_context_s
42 {
43 const char * code;
44 int code_index;
46 char c;
47 int token;
48 char * string;
49 int integer;
51 oberon_module_t * mod;
52 oberon_type_t * types;
54 void * gen_context;
55 };
57 enum {
58 MODE_VAR,
59 MODE_INTEGER,
60 MODE_BOOLEAN
61 };
63 typedef struct
64 {
65 int mode;
66 int integer;
67 int boolean;
68 oberon_var_t * var;
69 } oberon_item_t;
71 oberon_context_t * oberon_create_context();
72 void oberon_destroy_context(oberon_context_t * ctx);
73 void oberon_register_global_type(oberon_context_t * ctx, oberon_type_t * type);
74 oberon_module_t * oberon_compile_module(oberon_context_t * ctx, const char * code);
75 void oberon_error(oberon_context_t * ctx, const char * fmt, ...);
77 #endif // EMBEDED_OBERON_SCRIPT_H