Skip to content
Browse files

Rename read() to lisp_read(), fixing the OpenBSD issue.

  • Loading branch information...
1 parent 36dd606 commit 0915bfa601f8b221456b7be5d58aca25810f1b21 @skeeto skeeto committed Dec 16, 2010
Showing with 17 additions and 17 deletions.
  1. +2 −2 interp.c
  2. +3 −3 main.c
  3. +9 −9 read.c
  4. +1 −1 read.h
  5. +2 −2 test.c
View
4 interp.c
@@ -428,10 +428,10 @@ DEFUN1(eval_proc) {
return interp(exp, env);
}
-object *read(FILE *in);
+object *lisp_read(FILE *in);
DEFUN1(read_proc) {
object *in_port = FIRST;
- object *result = read(INPUT(in_port));
+ object *result = lisp_read(INPUT(in_port));
return (result == NULL) ? eof_object : result;
}
View
6 main.c
@@ -12,9 +12,9 @@ void load_library(char *libname) {
libname);
exit(3);
}
-
+
object *form;
- while((form = read(stdlib)) != NULL) {
+ while((form = lisp_read(stdlib)) != NULL) {
push_root(&form);
print_obj(interp(form, the_global_environment));
pop_root(&form);
@@ -43,7 +43,7 @@ int main(int argc, char ** argv) {
}
object *input;
- while((input = read(stdin)) != NULL) {
+ while((input = lisp_read(stdin)) != NULL) {
push_root(&input);
print_obj(interp(input, the_global_environment));
pop_root(&input);
View
18 read.c
@@ -77,7 +77,7 @@ void peek_expected_delimiter(FILE *in) {
}
}
-object *read(FILE *in);
+object *lisp_read(FILE *in);
object *read_character(FILE *in) {
int c;
@@ -118,7 +118,7 @@ object *read_pair(FILE *in) {
}
ungetc(c, in);
- car_obj = read(in);
+ car_obj = lisp_read(in);
push_root(&car_obj);
eat_whitespace(in);
@@ -127,7 +127,7 @@ object *read_pair(FILE *in) {
if(c == '.') {
peek_expected_delimiter(in);
- cdr_obj = read(in);
+ cdr_obj = lisp_read(in);
push_root(&cdr_obj);
eat_whitespace(in);
@@ -168,7 +168,7 @@ object *read_vector(FILE *in) {
}
ungetc(c, in);
- current = cons(read(in), the_empty_list);
+ current = cons(lisp_read(in), the_empty_list);
push_root(&current);
list_head = current;
push_root(&list_head);
@@ -181,7 +181,7 @@ object *read_vector(FILE *in) {
while(c != ')') {
ungetc(c, in);
- current = read(in);
+ current = lisp_read(in);
set_cdr(list_tail, cons(current, the_empty_list));
list_tail = cdr(list_tail);
@@ -196,7 +196,7 @@ object *read_vector(FILE *in) {
return vector;
}
-object *read(FILE *in) {
+object *lisp_read(FILE *in) {
int c;
short sign = 1;
int i;
@@ -291,23 +291,23 @@ object *read(FILE *in) {
return read_pair(in);
}
else if(c == '\'') {
- object *quoted = read(in);
+ object *quoted = lisp_read(in);
push_root(&quoted);
quoted = cons(quoted, the_empty_list);
quoted = cons(quote_symbol, quoted);
pop_root(&quoted);
return quoted;
}
else if(c == ',') {
- object *unquoted = read(in);
+ object *unquoted = lisp_read(in);
push_root(&unquoted);
unquoted = cons(unquoted, the_empty_list);
unquoted = cons(unquote_symbol, unquoted);
pop_root(&unquoted);
return unquoted;
}
else if(c == '`') {
- object *qquoted = read(in);
+ object *qquoted = lisp_read(in);
push_root(&qquoted);
qquoted = cons(qquoted, the_empty_list);
qquoted = cons(quasiquote_symbol, qquoted);
View
2 read.h
@@ -1,6 +1,6 @@
#ifndef READ_H
#define READ_H
-object *read(FILE *in);
+object *lisp_read(FILE *in);
#endif
View
4 test.c
@@ -132,14 +132,14 @@ int main(int argc, char ** argv) {
make_symbol("y")));
print_obj(testdef);
print_obj(interp(testdef, env));
-
+
object *testinv = list3(make_symbol("test"),
make_fixnum(10), make_fixnum(15));
print_obj(testinv);
print_obj(interp(testinv, env));
while(true) {
- object *input = read(stdin);
+ object *input = lisp_read(stdin);
print_obj(input);
print_obj(interp(input, env));
}

0 comments on commit 0915bfa

Please sign in to comment.
Something went wrong with that request. Please try again.