|
|
@ -114,7 +114,7 @@ Pointer read1(Pointer streamPtr, Pointer env) { |
|
|
|
case NATIVE_FUNC: |
|
|
|
case NATIVE_FUNC: |
|
|
|
return NATIVE_FUNC(macro)(LIST(streamPtr, character(get_utf8(stream))), env); |
|
|
|
return NATIVE_FUNC(macro)(LIST(streamPtr, character(get_utf8(stream))), env); |
|
|
|
case FUNC: |
|
|
|
case FUNC: |
|
|
|
return eval_fn(LIST(macro, streamPtr, character(get_utf8(stream))), env); |
|
|
|
return eval(LIST(macro, streamPtr, character(get_utf8(stream))), env); |
|
|
|
default: break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -139,22 +139,14 @@ Pointer read1(Pointer streamPtr, Pointer env) { |
|
|
|
Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
Pointer streamPtr = CAR(args); |
|
|
|
Pointer streamPtr = CAR(args); |
|
|
|
streamPtr = streamPtr == NIL ? environment_get(env, STANDARD_INPUT) : streamPtr; |
|
|
|
streamPtr = streamPtr == NIL ? environment_get(env, STANDARD_INPUT) : streamPtr; |
|
|
|
Stream stream = STREAM(streamPtr); |
|
|
|
|
|
|
|
Pointer result = read1(streamPtr, env); |
|
|
|
Pointer result = read1(streamPtr, env); |
|
|
|
char c; |
|
|
|
|
|
|
|
while((c = getc(stream)) && isspace(c) && c != '\n'); |
|
|
|
|
|
|
|
if (c != '\n') ungetc(c, stream); |
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Pointer set_reader_macro(Pointer c, Pointer fn) { |
|
|
|
|
|
|
|
READTABLE = table_set(READTABLE, c, fn); |
|
|
|
|
|
|
|
return T; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pointer set_reader_macro_fn(Pointer args, Pointer env) { |
|
|
|
Pointer set_reader_macro_fn(Pointer args, Pointer env) { |
|
|
|
(void) env; |
|
|
|
(void) env; |
|
|
|
return set_reader_macro(CAR(args), CAR(CDR (args))); |
|
|
|
READTABLE = table_set(READTABLE, CHAR(CAR(args)), CAR(CDR(args))); |
|
|
|
|
|
|
|
return T; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool return_char(Stream stream) { |
|
|
|
static bool return_char(Stream stream) { |
|
|
|