|
|
|
@ -85,6 +85,10 @@ Pointer peek_char_fn(Pointer args, Pointer env) {
@@ -85,6 +85,10 @@ Pointer peek_char_fn(Pointer args, Pointer env) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return character(c); |
|
|
|
|
/* printf("%s: %d\n", __FILE__, __LINE__); */ |
|
|
|
|
/* char c = getc(stream); */ |
|
|
|
|
/* printf("%s: %d: %c\n", __FILE__, __LINE__, c); */ |
|
|
|
|
/* return character(ungetc(c, stream)); */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Pointer read_char_fn(Pointer args, Pointer env) { |
|
|
|
@ -139,9 +143,14 @@ Pointer read1(Pointer streamPtr, Pointer env) {
@@ -139,9 +143,14 @@ Pointer read1(Pointer streamPtr, Pointer env) {
|
|
|
|
|
Pointer read_fn(Pointer args, Pointer env) { |
|
|
|
|
Pointer streamPtr = CAR(args); |
|
|
|
|
streamPtr = streamPtr == NIL ? environment_get(env, STANDARD_INPUT) : streamPtr; |
|
|
|
|
Stream stream = STREAM(streamPtr); |
|
|
|
|
/* Stream stream = STREAM(streamPtr); */ |
|
|
|
|
Pointer result = read1(streamPtr, env); |
|
|
|
|
peek_char(T, stream); |
|
|
|
|
/* peek_char(T, stream); */ |
|
|
|
|
/* getc(stream); */ |
|
|
|
|
/* char c; */ |
|
|
|
|
/* getc(stream); */ |
|
|
|
|
/* while((c = getc(stream)) >= 0 && c == ' ') ungetc(c, stream); */ |
|
|
|
|
/* if (c != EOF) ungetc(c, stream); */ |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|