aboutsummaryrefslogtreecommitdiff
path: root/make/core.mk
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
committerJoel Martin <github@martintribe.org>2014-04-16 23:57:50 -0500
commit8cb5cda46cf3aef847ae3926dc53a5e5f87fe261 (patch)
tree13e5b2878f19ee24272ead8a92a9cb84b33ad0e5 /make/core.mk
parenta05f7822b10ed4cdd61ed8384299a003baf1c1c6 (diff)
downloadmal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.tar.gz
mal-8cb5cda46cf3aef847ae3926dc53a5e5f87fe261.zip
All: move some fns to core. Major cleanup.
- Don't import/require core until step4. - Define cond/or macros from step8
Diffstat (limited to 'make/core.mk')
-rw-r--r--make/core.mk12
1 files changed, 11 insertions, 1 deletions
diff --git a/make/core.mk b/make/core.mk
index fbea5ea..80f51ac 100644
--- a/make/core.mk
+++ b/make/core.mk
@@ -8,6 +8,8 @@ __mal_core_included := true
_TOP_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(_TOP_DIR)util.mk
include $(_TOP_DIR)types.mk
+include $(_TOP_DIR)readline.mk
+include $(_TOP_DIR)reader.mk
include $(_TOP_DIR)printer.mk
@@ -49,12 +51,16 @@ number_divide = $(call _pnumber,$(call int_divide,$($(word 1,$(1))_value),$($(wo
# String functions
+string? = $(if $(call _string?,$(1)),$(__true),$(__false))
+
pr_str = $(call _string,$(call _pr_str_mult,$(1),yes, ))
str = $(call _string,$(call _pr_str_mult,$(1),,))
prn = $(info $(call _pr_str_mult,$(1),yes, ))
println = $(info $(subst \n,$(NEWLINE),$(call _pr_str_mult,$(1),, )))
-string? = $(if $(call _string?,$(1)),$(__true),$(__false))
+readline= $(foreach res,$(call _string,$(call READLINE,"$(call str_decode,$($(1)_value))")),$(if $(READLINE_EOF),$(__nil),$(res)))
+read_str= $(call READ_STR,$(1))
+slurp = $(call _string,$(call _read_file,$(call str_decode,$($(1)_value))))
subs = $(strip \
$(foreach start,$(call gmsl_plus,1,$(call int_decode,$($(word 2,$(1))_value))),\
@@ -205,10 +211,14 @@ core_ns = type obj_type \
symbol? symbol? \
function? function? \
string? string? \
+ \
pr-str pr_str \
str str \
prn prn \
println println \
+ readline readline \
+ read-string read_str \
+ slurp slurp \
subs subs \
number? number? \
< number_lt \