1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 09:38:28 +03:00

Ada, C: fix step3 error handling.

New step3 tests were added during basic implementation that broke Ada
and C.
This commit is contained in:
Joel Martin 2016-11-01 10:44:49 -05:00
parent 2bcc46af48
commit fba3aeb2fb
3 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,5 @@
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Text_IO;
with Envs;
with Eval_Callback;
@ -254,8 +255,15 @@ begin
Init (Repl_Env);
loop
Ada.Text_IO.Put ("user> ");
exit when Ada.Text_IO.End_Of_File;
Ada.Text_IO.Put_Line (Rep (Ada.Text_IO.Get_Line, Repl_Env));
begin
Ada.Text_IO.Put ("user> ");
exit when Ada.Text_IO.End_Of_File;
Ada.Text_IO.Put_Line (Rep (Ada.Text_IO.Get_Line, Repl_Env));
exception
when E : others =>
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
Ada.Exceptions.Exception_Information (E));
end;
end loop;
end Step3_Env;

View File

@ -80,6 +80,7 @@ MalVal *EVAL(MalVal *ast, Env *env) {
MalVal *a1 = _nth(ast, 1),
*a2 = _nth(ast, 2);
MalVal *res = EVAL(a2, env);
if (mal_error) return NULL;
env_set(env, a1, res);
return res;
} else if (strcmp("let*", a0->val.string) == 0) {

View File

@ -6,6 +6,8 @@
#ifdef USE_GC
#include <gc/gc.h>
void nop_free(void* ptr);
void GC_setup();
char* GC_strdup(const char *src);
#define MAL_GC_SETUP() GC_setup()
#define MAL_GC_MALLOC GC_MALLOC