mirror of
https://github.com/kanaka/mal.git
synced 2024-11-10 12:47:45 +03:00
Ada: steps 3 and 4 do need eval_callback
This commit is contained in:
parent
988812a6f1
commit
365f02539b
17
ada/Makefile
17
ada/Makefile
@ -6,9 +6,8 @@ STEP0_DEPS=${DIRS}
|
||||
STEP1_DEPS=${STEP0_DEPS} types.ad[bs] types-vector.ad[bs] types-hash_map.ad[bs] \
|
||||
reader.ad[bs] printer.ad[bs] smart_pointers.ad[bs]
|
||||
STEP2_DEPS=${STEP1_DEPS}
|
||||
STEP3_DEPS=${STEP2_DEPS} envs.ad[bs]
|
||||
STEP3_DEPS=${STEP2_DEPS} envs.ad[bs] eval_callback.ads
|
||||
STEP4_DEPS=${STEP3_DEPS} core.ad[bs]
|
||||
STEP5_DEPS=${STEP4_DEPS} eval_callback.ads
|
||||
|
||||
all: ${DIRS} ${PROGS}
|
||||
|
||||
@ -21,14 +20,14 @@ step%:
|
||||
step0_repl: step0_repl.adb ${STEP0_DEPS}
|
||||
step1_read_print: step1_read_print.adb ${STEP1_DEPS}
|
||||
step2_eval: step2_eval.adb ${STEP2_DEPS}
|
||||
step3_env: step3_env.adb ${STEP3_DEPS}
|
||||
step3_env: step3_env.adb eval_callback.ads ${STEP3_DEPS}
|
||||
step4_if_fn_do: step4_if_fn_do.adb ${STEP4_DEPS}
|
||||
step5_tco: step5_tco.adb ${STEP5_DEPS}
|
||||
step6_file: step6_file.adb ${STEP5_DEPS}
|
||||
step7_quote: step7_quote.adb ${STEP5_DEPS}
|
||||
step8_macros: step8_macros.adb ${STEP5_DEPS}
|
||||
step9_try: step9_try.adb ${STEP5_DEPS}
|
||||
stepA_mal: stepa_mal.adb ${STEP5_DEPS}
|
||||
step5_tco: step5_tco.adb ${STEP4_DEPS}
|
||||
step6_file: step6_file.adb ${STEP4_DEPS}
|
||||
step7_quote: step7_quote.adb ${STEP4_DEPS}
|
||||
step8_macros: step8_macros.adb ${STEP4_DEPS}
|
||||
step9_try: step9_try.adb ${STEP4_DEPS}
|
||||
stepA_mal: stepa_mal.adb ${STEP4_DEPS}
|
||||
|
||||
clean:
|
||||
rm -f ${PROGS}
|
||||
|
@ -2,6 +2,7 @@ with Ada.Command_Line;
|
||||
with Ada.Text_IO;
|
||||
with Ada.IO_Exceptions;
|
||||
with Envs;
|
||||
with Eval_Callback;
|
||||
with Printer;
|
||||
with Reader;
|
||||
with Smart_Pointers;
|
||||
@ -235,6 +236,11 @@ procedure Step3_Env is
|
||||
|
||||
begin
|
||||
|
||||
-- Save a function pointer back to the Eval function.
|
||||
-- Can't use 'Access here because of Ada rules but 'Unrestricted_Access is OK
|
||||
-- as we know Eval will be in scope for the lifetime of the program.
|
||||
Eval_Callback.Eval := Eval'Unrestricted_Access;
|
||||
|
||||
if Ada.Command_Line.Argument_Count > 0 then
|
||||
if Ada.Command_Line.Argument (1) = "-d" then
|
||||
Debug := True;
|
||||
|
@ -4,6 +4,7 @@ with Ada.Text_IO;
|
||||
with Ada.IO_Exceptions;
|
||||
with Core;
|
||||
with Envs;
|
||||
with Eval_Callback;
|
||||
with Printer;
|
||||
with Reader;
|
||||
with Smart_Pointers;
|
||||
@ -278,6 +279,11 @@ procedure Step4_If_Fn_Do is
|
||||
|
||||
begin
|
||||
|
||||
-- Save a function pointer back to the Eval function.
|
||||
-- Can't use 'Access here because of Ada rules but 'Unrestricted_Access is OK
|
||||
-- as we know Eval will be in scope for the lifetime of the program.
|
||||
Eval_Callback.Eval := Eval'Unrestricted_Access;
|
||||
|
||||
Cmd_Args := 0;
|
||||
while Ada.Command_Line.Argument_Count > Cmd_Args loop
|
||||
Cmd_Args := Cmd_Args + 1;
|
||||
|
@ -332,6 +332,11 @@ procedure Step5_TCO is
|
||||
|
||||
begin
|
||||
|
||||
-- Save a function pointer back to the Eval function.
|
||||
-- Can't use 'Access here because of Ada rules but 'Unrestricted_Access is OK
|
||||
-- as we know Eval will be in scope for the lifetime of the program.
|
||||
Eval_Callback.Eval := Eval'Unrestricted_Access;
|
||||
|
||||
Cmd_Args := 0;
|
||||
while Ada.Command_Line.Argument_Count > Cmd_Args loop
|
||||
Cmd_Args := Cmd_Args + 1;
|
||||
@ -342,11 +347,6 @@ begin
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
-- Save a function pointer back to the Eval function.
|
||||
-- Can't use 'Access here because of Ada rules but 'Unrestricted_Access is OK
|
||||
-- as we know Eval will be in scope for the lifetime of the program.
|
||||
Eval_Callback.Eval := Eval'Unrestricted_Access;
|
||||
|
||||
Repl_Env := Envs.New_Env;
|
||||
|
||||
Core.Init (Repl_Env);
|
||||
|
Loading…
Reference in New Issue
Block a user