diff options
Diffstat (limited to 'make')
| -rw-r--r-- | make/step1_read_print.mk | 2 | ||||
| -rw-r--r-- | make/step2_eval.mk | 2 | ||||
| -rw-r--r-- | make/step3_env.mk | 2 | ||||
| -rw-r--r-- | make/step4_if_fn_do.mk | 2 | ||||
| -rw-r--r-- | make/step6_file.mk | 8 | ||||
| -rw-r--r-- | make/step7_quote.mk | 8 | ||||
| -rw-r--r-- | make/step8_macros.mk | 8 | ||||
| -rw-r--r-- | make/step9_interop.mk | 8 | ||||
| -rw-r--r-- | make/stepA_more.mk | 12 |
9 files changed, 37 insertions, 15 deletions
diff --git a/make/step1_read_print.mk b/make/step1_read_print.mk index a5fe2d2..f695a7e 100644 --- a/make/step1_read_print.mk +++ b/make/step1_read_print.mk @@ -28,5 +28,5 @@ endef REP = $(call PRINT,$(strip $(call EVAL,$(strip $(call READ,$(1))),$(REPL_ENV)))) REPL = $(info $(call REP,$(call READLINE,"user> ")))$(if $(READLINE_EOF),,$(call REPL)) -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step2_eval.mk b/make/step2_eval.mk index 96cd98f..34b1dab 100644 --- a/make/step2_eval.mk +++ b/make/step2_eval.mk @@ -69,5 +69,5 @@ $(call do,$(call _assoc!,$(REPL_ENV),-,number_subtract)) $(call do,$(call _assoc!,$(REPL_ENV),*,number_multiply)) $(call do,$(call _assoc!,$(REPL_ENV),/,number_divide)) -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step3_env.mk b/make/step3_env.mk index acc038d..b548874 100644 --- a/make/step3_env.mk +++ b/make/step3_env.mk @@ -91,5 +91,5 @@ REPL_ENV := $(call ENV_SET,$(REPL_ENV),-,number_subtract) REPL_ENV := $(call ENV_SET,$(REPL_ENV),*,number_multiply) REPL_ENV := $(call ENV_SET,$(REPL_ENV),/,number_divide) -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step4_if_fn_do.mk b/make/step4_if_fn_do.mk index 13dcf1c..47f7fe4 100644 --- a/make/step4_if_fn_do.mk +++ b/make/step4_if_fn_do.mk @@ -109,5 +109,5 @@ $(call _import_core,$(core_ns)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! not (fn* (a) (if a false true))) )) -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step6_file.mk b/make/step6_file.mk index 494cbb2..f779d12 100644 --- a/make/step6_file.mk +++ b/make/step6_file.mk @@ -106,6 +106,8 @@ _fref = $(eval REPL_ENV := $(call ENV_SET,$(REPL_ENV),$(1),$(call _function,$$(c _import_core = $(if $(strip $(1)),$(call _fref,$(word 1,$(1)),$(word 2,$(1)))$(call _import_core,$(wordlist 3,$(words $(1)),$(1))),) $(call _import_core,$(core_ns)) REPL_ENV := $(call ENV_SET,$(REPL_ENV),eval,$(call _function,$$(call EVAL,$$(1),$$(REPL_ENV)))) +_argv := $(call _list) +REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! not (fn* (a) (if a false true))) )) @@ -113,11 +115,13 @@ $(call do,$(call REP, (def! load-file (fn* (f) (eval (read-string (str "(do " (s # Load and eval any files specified on the command line $(if $(MAKECMDGOALS),\ - $(foreach file,$(MAKECMDGOALS),$(call do,$(call REP, (load-file "$(file)") )))\ + $(foreach arg,$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)),\ + $(call do,$(call _conj!,$(_argv),$(call _string,$(arg)))))\ + $(call do,$(call REP, (load-file "$(word 1,$(MAKECMDGOALS))") )) \ $(eval INTERACTIVE :=),) .PHONY: none $(MAKECMDGOALS) none $(MAKECMDGOALS): @true -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step7_quote.mk b/make/step7_quote.mk index 072e407..c734ad1 100644 --- a/make/step7_quote.mk +++ b/make/step7_quote.mk @@ -123,6 +123,8 @@ _fref = $(eval REPL_ENV := $(call ENV_SET,$(REPL_ENV),$(1),$(call _function,$$(c _import_core = $(if $(strip $(1)),$(call _fref,$(word 1,$(1)),$(word 2,$(1)))$(call _import_core,$(wordlist 3,$(words $(1)),$(1))),) $(call _import_core,$(core_ns)) REPL_ENV := $(call ENV_SET,$(REPL_ENV),eval,$(call _function,$$(call EVAL,$$(1),$$(REPL_ENV)))) +_argv := $(call _list) +REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! not (fn* (a) (if a false true))) )) @@ -130,11 +132,13 @@ $(call do,$(call REP, (def! load-file (fn* (f) (eval (read-string (str "(do " (s # Load and eval any files specified on the command line $(if $(MAKECMDGOALS),\ - $(foreach file,$(MAKECMDGOALS),$(call do,$(call REP, (load-file "$(file)") )))\ + $(foreach arg,$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)),\ + $(call do,$(call _conj!,$(_argv),$(call _string,$(arg)))))\ + $(call do,$(call REP, (load-file "$(word 1,$(MAKECMDGOALS))") )) \ $(eval INTERACTIVE :=),) .PHONY: none $(MAKECMDGOALS) none $(MAKECMDGOALS): @true -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step8_macros.mk b/make/step8_macros.mk index f4234d2..5a0007c 100644 --- a/make/step8_macros.mk +++ b/make/step8_macros.mk @@ -146,6 +146,8 @@ _fref = $(eval REPL_ENV := $(call ENV_SET,$(REPL_ENV),$(1),$(call _function,$$(c _import_core = $(if $(strip $(1)),$(call _fref,$(word 1,$(1)),$(word 2,$(1)))$(call _import_core,$(wordlist 3,$(words $(1)),$(1))),) $(call _import_core,$(core_ns)) REPL_ENV := $(call ENV_SET,$(REPL_ENV),eval,$(call _function,$$(call EVAL,$$(1),$$(REPL_ENV)))) +_argv := $(call _list) +REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! not (fn* (a) (if a false true))) )) @@ -155,11 +157,13 @@ $(call do,$(call REP, (defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (co # Load and eval any files specified on the command line $(if $(MAKECMDGOALS),\ - $(foreach file,$(MAKECMDGOALS),$(call do,$(call REP, (load-file "$(file)") )))\ + $(foreach arg,$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)),\ + $(call do,$(call _conj!,$(_argv),$(call _string,$(arg)))))\ + $(call do,$(call REP, (load-file "$(word 1,$(MAKECMDGOALS))") )) \ $(eval INTERACTIVE :=),) .PHONY: none $(MAKECMDGOALS) none $(MAKECMDGOALS): @true -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/step9_interop.mk b/make/step9_interop.mk index 2dfe7e0..07ad5a3 100644 --- a/make/step9_interop.mk +++ b/make/step9_interop.mk @@ -150,6 +150,8 @@ _fref = $(eval REPL_ENV := $(call ENV_SET,$(REPL_ENV),$(1),$(call _function,$$(c _import_core = $(if $(strip $(1)),$(call _fref,$(word 1,$(1)),$(word 2,$(1)))$(call _import_core,$(wordlist 3,$(words $(1)),$(1))),) $(call _import_core,$(core_ns)) REPL_ENV := $(call ENV_SET,$(REPL_ENV),eval,$(call _function,$$(call EVAL,$$(1),$$(REPL_ENV)))) +_argv := $(call _list) +REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! not (fn* (a) (if a false true))) )) @@ -159,11 +161,13 @@ $(call do,$(call REP, (defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (co # Load and eval any files specified on the command line $(if $(MAKECMDGOALS),\ - $(foreach file,$(MAKECMDGOALS),$(call do,$(call REP, (load-file "$(file)") )))\ + $(foreach arg,$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)),\ + $(call do,$(call _conj!,$(_argv),$(call _string,$(arg)))))\ + $(call do,$(call REP, (load-file "$(word 1,$(MAKECMDGOALS))") )) \ $(eval INTERACTIVE :=),) .PHONY: none $(MAKECMDGOALS) none $(MAKECMDGOALS): @true -# Call the read-eval-print loop +# repl loop $(if $(strip $(INTERACTIVE)),$(call REPL)) diff --git a/make/stepA_more.mk b/make/stepA_more.mk index 8b92178..dc07b01 100644 --- a/make/stepA_more.mk +++ b/make/stepA_more.mk @@ -165,6 +165,8 @@ _fref = $(eval REPL_ENV := $(call ENV_SET,$(REPL_ENV),$(1),$(call _function,$$(c _import_core = $(if $(strip $(1)),$(call _fref,$(word 1,$(1)),$(word 2,$(1)))$(call _import_core,$(wordlist 3,$(words $(1)),$(1))),) $(call _import_core,$(core_ns)) REPL_ENV := $(call ENV_SET,$(REPL_ENV),eval,$(call _function,$$(call EVAL,$$(1),$$(REPL_ENV)))) +_argv := $(call _list) +REPL_ENV := $(call ENV_SET,$(REPL_ENV),*ARGV*,$(_argv)) # core.mal: defined in terms of the language itself $(call do,$(call REP, (def! *host-language* "make") )) @@ -175,11 +177,15 @@ $(call do,$(call REP, (defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (co # Load and eval any files specified on the command line $(if $(MAKECMDGOALS),\ - $(foreach file,$(MAKECMDGOALS),$(call do,$(call REP, (load-file "$(file)") )))\ + $(foreach arg,$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)),\ + $(call do,$(call _conj!,$(_argv),$(call _string,$(arg)))))\ + $(call do,$(call REP, (load-file "$(word 1,$(MAKECMDGOALS))") )) \ $(eval INTERACTIVE :=),) .PHONY: none $(MAKECMDGOALS) none $(MAKECMDGOALS): @true -# Call the read-eval-print loop -$(if $(strip $(INTERACTIVE)),$(call REPL)) +# repl loop +$(if $(strip $(INTERACTIVE)),\ + $(call do,$(call REP, (println (str "Mal [" *host-language* "]")) )) \ + $(call REPL)) |
