diff --git a/ikc3/ikc3.c b/ikc3/ikc3.c
index bd5b005..6e9be7b 100644
--- a/ikc3/ikc3.c
+++ b/ikc3/ikc3.c
@@ -10,6 +10,7 @@
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
+#include <errno.h>
#include <string.h>
#include "../libkc3/kc3.h"
#include "config.h"
@@ -41,60 +42,20 @@ sw buf_ignore_character (s_buf *buf)
return csize;
}
-sw ikc3_buf_ignore_spaces (s_buf *out, s_buf *in)
-{
- character c;
- sw csize;
- sw r;
- sw result = 0;
- assert(in);
- assert(out);
- while ((r = buf_peek_character_utf8(in, &c)) > 0 &&
- c < UCD_MAX &&
- g_ucd[c].flags & (UCD_OTHER_CONTROL | UCD_SEPARATOR_SPACE)) {
- csize = r;
- if ((r = buf_ignore(in, csize)) != csize)
- return -1;
- result += csize;
- if ((r = buf_flush(out)) < 0)
- return -1;
- }
- if (r < 0)
- return r;
- return result;
-}
-
-sw buf_xfer_spaces (s_buf *out, s_buf *in)
-{
- character c;
- sw csize;
- sw r;
- sw size = 0;
- assert(in);
- assert(out);
- while ((r = buf_peek_character_utf8(in, &c)) > 0 &&
- c < UCD_MAX &&
- g_ucd[c].flags & (UCD_OTHER_CONTROL | UCD_SEPARATOR_SPACE)) {
- csize = r;
- if ((r = buf_xfer(out, in, csize)) != csize)
- return -1;
- size += csize;
- if ((r = buf_flush(out)) < 0)
- return -1;
- }
- if (r < 0)
- return r;
- return size;
-}
-
sw ikc3_run (void)
{
s_tag input;
sw r;
s_tag result;
- while ((r = ikc3_buf_ignore_spaces(&g_kc3_env.out,
- &g_kc3_env.in)) >= 0) {
- if ((r = buf_parse_tag(&g_kc3_env.in, &input)) > 0) {
+ while (1) {
+ r = buf_ignore_spaces(&g_kc3_env.in);
+ if (r < 0)
+ return 0;
+ r = buf_parse_comments(&g_kc3_env.in);
+ if (r < 0)
+ return 0;
+ r = buf_parse_tag(&g_kc3_env.in, &input);
+ if (r > 0) {
if (! eval_tag(&input, &result)) {
tag_clean(&input);
continue;
@@ -102,25 +63,33 @@ sw ikc3_run (void)
if (buf_inspect_tag(&g_kc3_env.out, &result) < 0) {
tag_clean(&input);
tag_clean(&result);
- break;
+ return 0;
}
tag_clean(&input);
tag_clean(&result);
}
+ if (r < 0)
+ return 0;
if ((r = buf_write_1(&g_kc3_env.out, "\n")) < 0)
- break;
+ return 0;
if ((r = buf_flush(&g_kc3_env.out)) < 0)
- break;
+ return 0;
if (r < 0 ||
(r == 0 &&
(r = buf_ignore_character(&g_kc3_env.in)) <= 0))
- break;
+ return 0;
}
return 0;
}
int main (int argc, char **argv)
{
+ sw e = 0;
+ s_env *env;
+ s_tag *file_dir;
+ s_tag file_dir_save;
+ s_tag *file_path;
+ s_tag file_path_save;
FILE *fp = 0;
char in_data[BUF_SIZE];
s_buf in_original;
@@ -129,13 +98,14 @@ int main (int argc, char **argv)
return usage("ikc3");
if (! kc3_init(NULL, &argc, &argv))
return 1;
- in_original = g_kc3_env.in;
- buf_init(&g_kc3_env.in, false, sizeof(in_data), in_data);
+ env = &g_kc3_env;
+ in_original = env->in;
+ buf_init(&env->in, false, sizeof(in_data), in_data);
while (argc) {
if (! strcmp("--load", *argv) ||
! strcmp("-l", *argv)) {
if (argc < 2) {
- err_write_1(g_kc3_env.argv[0]);
+ err_write_1(env->argv[0]);
err_write_1(": ");
err_write_1(*argv);
err_write_1(" without an argument\n");
@@ -144,12 +114,36 @@ int main (int argc, char **argv)
goto clean;
}
fp = fopen(argv[1], "rb");
- if (! buf_file_open_r(&g_kc3_env.in, fp)) {
+ if (! fp) {
+ e = errno;
+ err_write_1("ikc3: ");
+ err_write_1(argv[1]);
+ err_write_1(": ");
+ err_write_1(strerror(e));
+ err_write_1("\n");
+ assert(! "ikc3: fopen");
+ r = 1;
+ goto clean;
+ }
+ if (! buf_file_open_r(&env->in, fp)) {
+ r = -1;
+ goto clean;
+ }
+ file_dir = frame_get_w(&env->global_frame, &g_sym___DIR__);
+ file_dir_save = *file_dir;
+ file_path = frame_get_w(&env->global_frame, &g_sym___FILE__);
+ file_path_save = *file_path;
+ tag_init_str_1(file_path, NULL, argv[1]);
+ file_dir->type = TAG_STR;
+ if (! file_dirname(&file_path->data.str, &file_dir->data.str)) {
+ buf_file_close(&env->in);
r = -1;
goto clean;
}
r = ikc3_run();
- buf_file_close(&g_kc3_env.in);
+ *file_dir = file_dir_save;
+ *file_path = file_path_save;
+ buf_file_close(&env->in);
fclose(fp);
if (r)
goto clean;
@@ -164,18 +158,18 @@ int main (int argc, char **argv)
break;
}
#if HAVE_WINEDITLINE
- buf_wineditline_open_r(&g_kc3_env.in, "ikc3> ", ".ikc3_history");
+ buf_wineditline_open_r(&env->in, "ikc3> ", ".ikc3_history");
#else
- buf_linenoise_open_r(&g_kc3_env.in, "ikc3> ", ".ikc3_history");
+ buf_linenoise_open_r(&env->in, "ikc3> ", ".ikc3_history");
#endif
r = ikc3_run();
- clean:
#if HAVE_WINEDITLINE
- buf_wineditline_close(&g_kc3_env.in, ".ikc3_history");
+ buf_wineditline_close(&env->in, ".ikc3_history");
#else
- buf_linenoise_close(&g_kc3_env.in, ".ikc3_history");
+ buf_linenoise_close(&env->in, ".ikc3_history");
#endif
- g_kc3_env.in = in_original;
+ clean:
+ env->in = in_original;
kc3_clean(NULL);
return r;
}
diff --git a/kc3s/kc3s.c b/kc3s/kc3s.c
index bac903d..aea9fbd 100644
--- a/kc3s/kc3s.c
+++ b/kc3s/kc3s.c
@@ -90,6 +90,11 @@ sw kc3s_run (void)
int main (int argc, char **argv)
{
+ s_env *env;
+ s_tag *file_dir;
+ s_tag file_dir_save;
+ s_tag *file_path;
+ s_tag file_path_save;
FILE *fp;
char in_data[BUF_SIZE];
s_buf in_original;
@@ -98,13 +103,14 @@ int main (int argc, char **argv)
return usage(argv[0]);
if (! kc3_init(NULL, &argc, &argv))
return 1;
- in_original = g_kc3_env.in;
- buf_init(&g_kc3_env.in, false, sizeof(in_data), in_data);
+ env = &g_kc3_env;
+ in_original = env->in;
+ buf_init(&env->in, false, sizeof(in_data), in_data);
while (argc) {
if (! strcmp("--load", *argv) ||
! strcmp("-l", *argv)) {
if (argc < 2) {
- err_write_1(g_kc3_env.argv[0]);
+ err_write_1(env->argv[0]);
err_write_1(": ");
err_write_1(*argv);
err_write_1(" without an argument\n");
@@ -113,12 +119,25 @@ int main (int argc, char **argv)
goto clean;
}
fp = fopen(argv[1], "rb");
- if (! buf_file_open_r(&g_kc3_env.in, fp)) {
+ if (! buf_file_open_r(&env->in, fp)) {
+ r = -1;
+ goto clean;
+ }
+ file_dir = frame_get_w(&env->global_frame, &g_sym___DIR__);
+ file_dir_save = *file_dir;
+ file_path = frame_get_w(&env->global_frame, &g_sym___FILE__);
+ file_path_save = *file_path;
+ tag_init_str_1(file_path, NULL, argv[1]);
+ file_dir->type = TAG_STR;
+ if (! file_dirname(&file_path->data.str, &file_dir->data.str)) {
+ buf_file_close(&env->in);
r = -1;
goto clean;
}
r = kc3s_run();
- buf_file_close(&g_kc3_env.in);
+ *file_dir = file_dir_save;
+ *file_path = file_path_save;
+ buf_file_close(&env->in);
fclose(fp);
if (r)
goto clean;
@@ -134,7 +153,7 @@ int main (int argc, char **argv)
}
r = kc3s_run();
clean:
- g_kc3_env.in = in_original;
+ env->in = in_original;
kc3_clean(NULL);
return r;
}
diff --git a/lib/kc3/0.1/ekc3.kc3 b/lib/kc3/0.1/ekc3.kc3
index fd4d79e..59342b6 100644
--- a/lib/kc3/0.1/ekc3.kc3
+++ b/lib/kc3/0.1/ekc3.kc3
@@ -1,6 +1,6 @@
defmodule EKC3 do
- dlopen(__DIR__ + "libekc3.so")
+ dlopen(__DIR__ + "/libekc3.so")
def render_file = cfn Str "ekc3_render_file" (Str)
diff --git a/libkc3/binding.c b/libkc3/binding.c
index 7dd7853..9599ab5 100644
--- a/libkc3/binding.c
+++ b/libkc3/binding.c
@@ -46,6 +46,18 @@ const s_tag * binding_get (const s_binding *binding, const s_sym *name)
return NULL;
}
+s_tag * binding_get_w (s_binding *binding, const s_sym *name)
+{
+ s_binding *b;
+ b = binding;
+ while (b) {
+ if (b->name == name)
+ return &b->value;
+ b = b->next;
+ }
+ return NULL;
+}
+
s_binding * binding_init (s_binding *binding, const s_sym *name,
const s_tag *value, s_binding *next)
{
diff --git a/libkc3/binding.h b/libkc3/binding.h
index ebb9268..118871a 100644
--- a/libkc3/binding.h
+++ b/libkc3/binding.h
@@ -15,22 +15,24 @@
#include "types.h"
-/* stack-allocation compatible functions */
+/* Stack-allocation compatible functions, call binding_clean after
+ use. */
void binding_clean (s_binding *binding);
s_binding * binding_init (s_binding *binding, const s_sym *name,
const s_tag *value, s_binding *next);
-/* constructors */
-s_binding * binding_new (const s_sym *name, const s_tag *value,
- s_binding *next);
-
-/* destructors */
+/* Heap-allocation functions, call binding_delete* after use. */
s_binding * binding_delete (s_binding *binding);
void binding_delete_all (s_binding *binding);
+s_binding * binding_new (const s_sym *name, const s_tag *value,
+ s_binding *next);
-/* observers */
+/* Observers. */
const s_tag * binding_get (const s_binding *binding, const s_sym *name);
const s_tag * binding_is_bound (const s_binding *binding,
const s_sym *name);
+/* Operators. */
+s_tag * binding_get_w (s_binding *binding, const s_sym *name);
+
#endif /* LIBC3_BINDING_H */
diff --git a/libkc3/buf.c3 b/libkc3/buf.c3
deleted file mode 100644
index f2b80bc..0000000
--- a/libkc3/buf.c3
+++ /dev/null
@@ -1,8 +0,0 @@
-defmodule Buf do
- defstruct do
- Str str
- u64 rpos
- u64 wpos
- sw flush (Buf buf)
- sw refill (Buf buf)
-
diff --git a/libkc3/buf_parse.c b/libkc3/buf_parse.c
index 1bf9782..004d338 100644
--- a/libkc3/buf_parse.c
+++ b/libkc3/buf_parse.c
@@ -1187,12 +1187,16 @@ sw buf_parse_comment (s_buf *buf)
if ((r = buf_read_1(buf, "#")) <= 0)
goto restore;
result += r1 + r;
- while ((r = buf_peek_character_utf8(buf, &c)) > 0 &&
- c != '\n') {
+ while (1) {
+ r = buf_peek_character_utf8(buf, &c);
+ if (r <= 0)
+ break;
csize = r;
if ((r = buf_ignore(buf, csize)) < 0)
goto clean;
result += csize;
+ if (c == '\n')
+ break;
}
if (r < 0)
goto clean;
diff --git a/libkc3/env.c b/libkc3/env.c
index 6896e84..9c2eaea 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -13,8 +13,8 @@
#include <string.h>
#include <unistd.h>
#include "alloc.h"
-#include "assert.h"
#include "array.h"
+#include "assert.h"
#include "binding.h"
#include "block.h"
#include "buf.h"
@@ -23,7 +23,6 @@
#include "buf_inspect.h"
#include "buf_parse.h"
#include "buf_save.h"
-#include "kc3_main.h"
#include "call.h"
#include "cfn.h"
#include "compare.h"
@@ -43,21 +42,25 @@
#include "fn_clause.h"
#include "frame.h"
#include "ident.h"
+#include "integer.h"
#include "io.h"
+#include "kc3_main.h"
#include "list.h"
#include "map.h"
#include "module.h"
#include "str.h"
#include "struct.h"
#include "struct_type.h"
+#include "sym.h"
#include "tag.h"
#include "tag_init.h"
#include "tuple.h"
-#include "integer.h"
s_env g_kc3_env;
static s_env * env_init_args (s_env *env, int *argc, char ***argv);
+static s_env * env_init_globals (s_env *env);
+static s_env * env_init_toplevel (s_env *env);
bool env_call_get (s_env *env, s_call *call)
{
@@ -1946,8 +1949,10 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
return NULL;
sym_init_g_sym();
env->error_handler = NULL;
- env->frame = frame_new(NULL); // toplevel
- frame_init(&env->global_frame, NULL); // globals
+ if (! env_init_toplevel(env))
+ return NULL;
+ if (! env_init_globals(env))
+ return NULL;
buf_init_alloc(&env->in, BUF_SIZE);
buf_file_open_r(&env->in, stdin);
buf_init_alloc(&env->out, BUF_SIZE);
@@ -1956,18 +1961,18 @@ s_env * env_init (s_env *env, int *argc, char ***argv)
buf_file_open_w(&env->err, stderr);
facts_init(&env->facts);
env->path = list_new_str_1
- (NULL, ".", list_new_str_1
- (NULL, "..", list_new_str_1
- (NULL, "../Resources", list_new_str_1
- (NULL, "../..", list_new_str_1
- (NULL, "../../..", list_new_str_1
- (NULL, "../../../..", list_new_str_1
- (NULL, "../../../../..", list_new_str_1
- (NULL, "../../../../../..", NULL))))))));
+ (NULL, "./", list_new_str_1
+ (NULL, "../", list_new_str_1
+ (NULL, "../Resources/", list_new_str_1
+ (NULL, "../../", list_new_str_1
+ (NULL, "../../../", list_new_str_1
+ (NULL, "../../../../", list_new_str_1
+ (NULL, "../../../../../", list_new_str_1
+ (NULL, "../../../../../../", NULL))))))));
str_init_1(&path, NULL, "lib/kc3/0.1/");
if (! file_search(&path, &g_sym_x, &env->module_path)) {
- err_puts("env_init: module_path not found");
- assert(! "env_init: module path not found");
+ err_puts("env_init: lib/kc3/0.1 not found in module path");
+ assert(! "env_init: lib/kc3/0.1 not found in module path");
return NULL;
}
env->current_defmodule = &g_sym_KC3;
@@ -2012,6 +2017,30 @@ s_env * env_init_args (s_env *env, int *argc, char ***argv)
return env;
}
+s_env * env_init_globals (s_env *env)
+{
+ if (! frame_init(&env->global_frame, NULL))
+ return NULL;
+ if (! tag_init_str(&env->file_dir, NULL, env->argv0_dir.size,
+ env->argv0_dir.ptr.pchar))
+ return NULL;
+ if (! frame_binding_new(&env->global_frame, &g_sym___DIR__,
+ &env->file_dir))
+ return NULL;
+ if (! tag_init_str_1(&env->file_path, NULL, env->argv[0]))
+ return NULL;
+ if (! frame_binding_new(&env->global_frame, &g_sym___FILE__,
+ &env->file_path))
+ return NULL;
+ return env;
+}
+
+s_env * env_init_toplevel (s_env *env)
+{
+ env->frame = frame_new(NULL);
+ return env;
+}
+
s_tag * env_let (s_env *env, const s_tag *tag, const s_block *block,
s_tag *dest)
{
@@ -2069,6 +2098,10 @@ s_tag * env_let (s_env *env, const s_tag *tag, const s_block *block,
bool env_load (s_env *env, const s_str *path)
{
s_buf buf;
+ s_tag dir;
+ s_tag env_file_dir;
+ s_tag env_file_path;
+ s_tag path_tag;
sw r;
s_tag tag = {0};
s_tag tmp;
@@ -2080,6 +2113,16 @@ bool env_load (s_env *env, const s_str *path)
buf_clean(&buf);
return false;
}
+ dir.type = TAG_STR;
+ if (! file_dirname(path, &dir.data.str)) {
+ buf_clean(&buf);
+ return false;
+ }
+ tag_init_str(&path_tag, NULL, path->size, path->ptr.pchar);
+ env_file_dir = env->file_dir;
+ env_file_path = env->file_path;
+ env->file_dir = dir;
+ env->file_path = path_tag;
while (1) {
if ((r = buf_parse_tag(&buf, &tag)) < 0) {
buf_getc_close(&buf);
@@ -2099,6 +2142,8 @@ bool env_load (s_env *env, const s_str *path)
}
buf_getc_close(&buf);
buf_clean(&buf);
+ env->file_dir = env_file_dir;
+ env->file_path = env_file_path;
return true;
}
diff --git a/libkc3/file.c b/libkc3/file.c
index 8b490d5..d2348d0 100644
--- a/libkc3/file.c
+++ b/libkc3/file.c
@@ -118,7 +118,7 @@ s_str * file_dirname (const s_str *path, s_str *dest)
return str_init(dest, NULL, 2, "./");
if (! dirsep_pos)
return str_init(dest, NULL, 1, "/");
- return str_init_slice(dest, path, 0, dirsep_pos + 1);
+ return str_init_slice(dest, path, 0, dirsep_pos);
}
s_tag * file_mtime (const s_str *path, s_tag *dest)
diff --git a/libkc3/frame.c b/libkc3/frame.c
index a917c33..7107db8 100644
--- a/libkc3/frame.c
+++ b/libkc3/frame.c
@@ -69,6 +69,21 @@ const s_tag * frame_get (const s_frame *frame, const s_sym *sym)
return NULL;
}
+s_tag * frame_get_w (s_frame *frame, const s_sym *sym)
+{
+ s_frame *f;
+ s_tag *result;
+ assert(sym);
+ f = frame;
+ while (f) {
+ result = binding_get_w(f->bindings, sym);
+ if (result)
+ return result;
+ f = f->next;
+ }
+ return NULL;
+}
+
s_frame * frame_init (s_frame *frame, s_frame *next)
{
s_frame tmp = {0};
diff --git a/libkc3/frame.h b/libkc3/frame.h
index 18f6774..9fa6925 100644
--- a/libkc3/frame.h
+++ b/libkc3/frame.h
@@ -15,22 +15,23 @@
#include "types.h"
-/* stack-allocation compatible functions */
+/* Stack-allocation compatible functions, call frame_clean after use. */
s_frame * frame_clean (s_frame *frame);
s_frame * frame_init (s_frame *frame, s_frame *next);
-/* constructors */
+/* Constructors. */
s_frame * frame_new (s_frame *next);
-/* destructors */
+/* Destructors. */
s_frame * frame_delete (s_frame *frame);
void frame_delete_all (s_frame *frame);
-/* modifiers */
+/* Operators. */
s_frame * frame_binding_new (s_frame *frame, const s_sym *name,
- const s_tag *value);
+ const s_tag *value);
+s_tag * frame_get_w (s_frame *frame, const s_sym *sym);
-/* observers */
+/* Observers. */
const s_tag * frame_get (const s_frame *frame, const s_sym *sym);
#endif /* LIBKC3_FRAME_H */
diff --git a/libkc3/kc3.c b/libkc3/kc3.c
index a2c718c..019a96c 100644
--- a/libkc3/kc3.c
+++ b/libkc3/kc3.c
@@ -108,8 +108,16 @@ void ** kc3_dlopen (const s_str *path, void **dest)
{
assert(path);
assert(dest);
- printf("dlopen %p := %s\n", (void *) dest, path->ptr.pchar);
+ err_write_1("kc3_dlopen: ");
+ err_inspect_str(path);
+ err_write_1("\n");
*dest = dlopen(path->ptr.pchar, RTLD_GLOBAL);
+ if (! *dest) {
+ err_write_1("kc3_dlopen: ");
+ err_inspect_str(path);
+ err_puts(": dlopen failed");
+ assert(! "kc3_dlopen: dlopen failed");
+ }
return dest;
}
diff --git a/libkc3/kc3.h b/libkc3/kc3.h
index 2994628..0d6242e 100644
--- a/libkc3/kc3.h
+++ b/libkc3/kc3.h
@@ -62,6 +62,7 @@
#include "file.h"
#include "fn.h"
#include "fn_clause.h"
+#include "frame.h"
#include "hash.h"
#include "ident.h"
#include "integer.h"
diff --git a/libkc3/sym.c b/libkc3/sym.c
index a93f893..fdecba8 100644
--- a/libkc3/sym.c
+++ b/libkc3/sym.c
@@ -22,6 +22,8 @@
#include "sym.h"
#include "tag_type.h"
+const s_sym g_sym___DIR__ = {{{NULL}, 7, {"__DIR__"}}};
+const s_sym g_sym___FILE__ = {{{NULL}, 8, {"__FILE__"}}};
const s_sym g_sym__brackets = {{{NULL}, 2, {"[]"}}};
const s_sym g_sym__equal = {{{NULL}, 1, {"="}}};
const s_sym g_sym__paren = {{{NULL}, 2, {"()"}}};
@@ -315,6 +317,8 @@ const s_sym ** sym_init_copy (const s_sym **sym,
void sym_init_g_sym (void)
{
+ sym_register(&g_sym___DIR__, NULL);
+ sym_register(&g_sym___FILE__, NULL);
sym_register(&g_sym__brackets, NULL);
sym_register(&g_sym__equal, NULL);
sym_register(&g_sym__paren, NULL);
diff --git a/libkc3/sym.h b/libkc3/sym.h
index 1c3374e..0c8d3c6 100644
--- a/libkc3/sym.h
+++ b/libkc3/sym.h
@@ -26,6 +26,8 @@
#define SYM_MAX 1024
+extern const s_sym g_sym___DIR__;
+extern const s_sym g_sym___FILE__;
extern const s_sym g_sym__brackets;
extern const s_sym g_sym__equal;
extern const s_sym g_sym__paren;
diff --git a/libkc3/types.h b/libkc3/types.h
index 11076e4..3c0910c 100644
--- a/libkc3/types.h
+++ b/libkc3/types.h
@@ -652,6 +652,8 @@ struct env {
s_buf err;
s_error_handler *error_handler;
s_facts facts;
+ s_tag file_dir;
+ s_tag file_path;
s_frame *frame;
s_frame global_frame;
s_buf in;
diff --git a/test/ikc3/comment.in b/test/ikc3/comment.in
index bddc50e..31884f7 100644
--- a/test/ikc3/comment.in
+++ b/test/ikc3/comment.in
@@ -12,4 +12,4 @@
"c"
# 9
# 10
-# 11
\ No newline at end of file
+# 11
diff --git a/test/ikc3/globals.in b/test/ikc3/globals.in
new file mode 100644
index 0000000..c6e92bb
--- /dev/null
+++ b/test/ikc3/globals.in
@@ -0,0 +1,4 @@
+quote __DIR__
+__DIR__
+quote __FILE__
+__FILE__
diff --git a/test/ikc3/globals.out.expected b/test/ikc3/globals.out.expected
new file mode 100644
index 0000000..4bb1292
--- /dev/null
+++ b/test/ikc3/globals.out.expected
@@ -0,0 +1,4 @@
+__DIR__
+"./"
+__FILE__
+"globals.in"
diff --git a/test/ikc3/globals.ret.expected b/test/ikc3/globals.ret.expected
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/ikc3/globals.ret.expected
@@ -0,0 +1 @@
+0
diff --git a/test/ikc3_test b/test/ikc3_test
index 99fbef3..564a79c 100755
--- a/test/ikc3_test
+++ b/test/ikc3_test
@@ -40,7 +40,7 @@ fi
for TARGET in $TARGETS; do
RESULT=test_ok
- $IKC3 < ${TARGET}.in > ${TARGET}.out 2>&1
+ $IKC3 --load ${TARGET}.in --quit > ${TARGET}.out 2>&1
echo $? > ${TARGET}.ret
if ! diff -abu ${TARGET}.out.expected ${TARGET}.out > ${TARGET}.diff
then