Skip to content

Commit 7697db2

Browse files
committed
readfile bug fixed: terminating at nil
1 parent 7091780 commit 7697db2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

arc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
#endif
3636

3737
namespace arc {
38-
constexpr auto VERSION = "0.34";
39-
4038
enum type {
4139
T_NIL,
4240
T_CONS,

library.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ by args passed in, so that future calls with the same inputs can save work."
10401040
(def readfile (filename)
10411041
(with (p (infile filename 'text)
10421042
r nil)
1043-
(whilet e (read p) (= r (cons e r)))
1043+
(whiler e (read p '_eof) '_eof (= r (cons e r)))
10441044
(rev r)))
10451045

10461046
(def readfile1 (filename)

main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "arc.h"
22

3+
constexpr auto VERSION = "0.35";
4+
35
void print_logo() {
4-
printf("Arc++ %s\n", arc::VERSION);
6+
printf("Arc++ %s\n", VERSION);
57
}
68

79
int main(int argc, char **argv)
@@ -24,7 +26,7 @@ int main(int argc, char **argv)
2426
return 0;
2527
}
2628
else if (strcmp(opt, "-v") == 0) {
27-
puts(arc::VERSION);
29+
puts(VERSION);
2830
return 0;
2931
}
3032
}

0 commit comments

Comments
 (0)