DEADSOFTWARE

Реализован вызов процедуры-переменной
[dsw-obn.git] / test.c
diff --git a/test.c b/test.c
index 2247eac4b7f42e6c463a01918e822d2adf45915e..d828f4a2e855adbbd24d2852738453892614f634 100644 (file)
--- a/test.c
+++ b/test.c
@@ -1,16 +1,25 @@
 #include "oberon.h"
+#include "generator.h"
 #include <assert.h>
 
-static oberon_type_t integer = { "INTEGER", OBERON_TYPE_INTEGER, sizeof(int) };
-static oberon_type_t boolean = { "BOOLEAN", OBERON_TYPE_BOOLEAN, sizeof(int) };
-
 static const char source[] =
        "MODULE Test;"
+       "TYPE"
+       "       Callback = PROCEDURE() : INTEGER;"
+       ""
        "VAR"
+       "       cb : Callback;"
        "       i : INTEGER;"
-       "       b : BOOLEAN;"
+       ""
+       "PROCEDURE RelBack;"
        "BEGIN"
-       "       i := 10;"
+       "       i := 666;"
+       "END RelBack;"
+       ""
+       "BEGIN;"
+       "       i := 1;"
+       "       i := cb();"
+       "       RelBack;"
        "END Test."
 ;
 
@@ -21,8 +30,9 @@ int
 main(int argc, char ** argv)
 {
        ctx = oberon_create_context();
-       oberon_register_global_type(ctx, &integer);
-       oberon_register_global_type(ctx, &boolean);
        mod = oberon_compile_module(ctx, source);
+       //mod -> begin();
+       oberon_generator_dump(ctx, "dump.txt");
+       oberon_destroy_context(ctx);
        return 0;
 }