a97f2d7d71606da039bf0ded4764654dd8b64005
6 #include "../include/oberon.h"
8 static oberon_context_t
* ctx
;
9 static oberon_module_t
* mod
;
12 import_module(const char * name
)
18 snprintf(fname
, 256, "%s.obn", name
);
19 fp
= fopen(fname
, "r");
22 printf("can't open file %s\n", fname
);
30 fseek(fp
, 0, SEEK_END
);
32 fseek(fp
, 0, SEEK_SET
);
34 source
= calloc(1, len
+ 1);
35 fread(source
, len
, 1, fp
);
41 main(int argc
, char ** argv
)
47 printf("use: %s <module>\n", argv
[0]);
51 code
= import_module(argv
[1]);
53 ctx
= oberon_create_context(import_module
);
54 mod
= oberon_compile_module(ctx
, code
);
56 oberon_destroy_context(ctx
);