mini-mes: Debugging to stderr.

* scaffold/mini-mes.c (error, bload_env, main): Send debug info to
  stderr.

throw/catch dinges: URG
This commit is contained in:
Jan Nieuwenhuizen 2017-03-26 22:12:24 +02:00
parent a226588a5e
commit 408696f380
2 changed files with 22 additions and 20 deletions

5
mes.c
View file

@ -431,8 +431,9 @@ error (SCM key, SCM x)
if ((throw = assq_ref_env (cell_symbol_throw, r0)) != cell_undefined)
return apply (throw, cons (key, cons (x, cell_nil)), r0);
display_error_ (key);
fputs (": ", stderr);
eputs (": ");
display_error_ (x);
eputs ("\n");
assert (!"error");
}
@ -521,7 +522,7 @@ SCM
set_env_x (SCM x, SCM e, SCM a)
{
SCM p = assert_defined (x, assq (x, a));
if (TYPE (p) != TPAIR) error (cell_symbol_not_a_pair, cons (p, x));
if (TYPE (p) != TPAIR) error (cell_symbol_not_a_pair, cons (p, x));
return set_cdr_x (p, e);
}

View file

@ -422,9 +422,10 @@ error (SCM key, SCM x)
SCM throw;
if ((throw = assq_ref_env (cell_symbol_throw, r0)) != cell_undefined)
return apply (throw, cons (key, cons (x, cell_nil)), r0);
display_ (key);
puts (": ");
display_error_ (key);
eputs (": ");
display_ (x);
eputs ("\n");
assert (0);
}
@ -1633,27 +1634,27 @@ bload_env (SCM a) ///((internal))
if (g_debug)
{
puts ("symbols: ");
eputs ("symbols: ");
SCM s = g_symbols;
while (s && s != cell_nil) {
display_ (CAR (s));
puts (" ");
display_error_ (CAR (s));
eputs (" ");
s = CDR (s);
}
puts ("\n");
puts ("functions: ");
puts (itoa (g_function));
puts ("\n");
eputs ("\n");
eputs ("functions: ");
eputs (itoa (g_function));
eputs ("\n");
for (int i = 0; i < g_function; i++)
{
puts ("[");
puts (itoa (i));
puts ("]: ");
puts (g_functions[i].name);
puts ("\n");
eputs ("[");
eputs (itoa (i));
eputs ("]: ");
eputs (g_functions[i].name);
eputs ("\n");
}
display_ (r0);
puts ("\n");
//display_error_ (r0);
//puts ("\n");
}
return r2;
}
@ -1699,12 +1700,12 @@ main (int argc, char *argv[])
if (g_debug)
{
eputs ("program: ");
display_ (r1);
display_error_ (r1);
eputs ("\n");
}
r3 = cell_vm_begin;
r1 = eval_apply ();
display_ (r1);
display_error_ (r1);
eputs ("\n");
#if !MES_MINI