|
|
@ -100,11 +100,9 @@ Pointer read_char_fn(Pointer args, Pointer env) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Pointer buffer; |
|
|
|
static Pointer buffer; |
|
|
|
Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
|
|
|
|
Pointer streamPtr = CAR(args); |
|
|
|
Pointer read1(Pointer streamPtr, Pointer env) { |
|
|
|
Stream stream = streamPtr == NIL |
|
|
|
Stream stream = STREAM(streamPtr); |
|
|
|
? STREAM(environment_get(env, STANDARD_INPUT)) |
|
|
|
|
|
|
|
: STREAM(streamPtr); |
|
|
|
|
|
|
|
double num = 0; |
|
|
|
double num = 0; |
|
|
|
Pointer macro; |
|
|
|
Pointer macro; |
|
|
|
Char c = peek_char(T, stream); |
|
|
|
Char c = peek_char(T, stream); |
|
|
@ -138,6 +136,15 @@ Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
return symbol(STRING(buffer).data, STRING(buffer).length - 1); |
|
|
|
return symbol(STRING(buffer).data, STRING(buffer).length - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
|
|
|
|
Pointer streamPtr = CAR(args); |
|
|
|
|
|
|
|
streamPtr = streamPtr == NIL ? environment_get(env, STANDARD_INPUT) : streamPtr; |
|
|
|
|
|
|
|
Stream stream = STREAM(streamPtr); |
|
|
|
|
|
|
|
Pointer result = read1(streamPtr, env); |
|
|
|
|
|
|
|
peek_char(T, stream); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Pointer set_reader_macro(Pointer c, Pointer fn) { |
|
|
|
Pointer set_reader_macro(Pointer c, Pointer fn) { |
|
|
|
READTABLE = table_set(READTABLE, c, fn); |
|
|
|
READTABLE = table_set(READTABLE, c, fn); |
|
|
|
return T; |
|
|
|
return T; |
|
|
|