shithub: femtolisp

Download patch

ref: db907308eafb578adb3d8aebec76eb9293599d48
parent: b9c77aa29efeaf571081058b563239900bbda01a
author: mag <[email protected]>
date: Tue May 16 09:45:39 EDT 2023

read.h

--- a/flisp.c
+++ b/flisp.c
@@ -12,6 +12,7 @@
 #include "opcodes.h"
 #include "types.h"
 #include "print.h"
+#include "read.h"
 
 int
 isbuiltin(value_t x)
--- a/flisp.h
+++ b/flisp.h
@@ -318,11 +318,6 @@
 // Nothing changed here...just grouping by file.
 //--------------------------------------------------
 
-//--------------------------------------------------read.c
-value_t fl_read_sexpr(value_t f);
-int isnumtok_base(char *tok, value_t *pval, int base);
-//--------------------------------------------------read.c
-
 //--------------------------------------------------builtins.c
 size_t llength(value_t v);
 //--------------------------------------------------builtins.c
@@ -408,22 +403,6 @@
 #define BUILTIN_FN(l, c) extern BUILTIN(l, c);
 #include "builtin_fns.h"
 #undef BUILTIN_FN
-
-//--------------------------------------------------read.c
-int isnumtok(char *tok, value_t *pval);
-
-// defines which characters are ordinary symbol characters.
-// exceptions are '.', which is an ordinary symbol character
-// unless it's the only character in the symbol, and '#', which is
-// an ordinary symbol character unless it's the first character.
-inline int
-symchar(char c)
-{
-        //static char *special = "()[]'\";`,\\| \a\b\f\n\r\t\v";
-        char *special = "()[]'\";`,\\| \a\b\f\n\r\t\v";
-        return !strchr(special, c);
-}
-//--------------------------------------------------read.c
 
 //--------------------------------------------------equal.c
 value_t compare_(value_t a, value_t b, int eq);
--- a/iostream.c
+++ b/iostream.c
@@ -3,6 +3,7 @@
 #include "cvalues.h"
 #include "types.h"
 #include "print.h"
+#include "read.h"
 
 static value_t iostreamsym, rdsym, wrsym, apsym, crsym, truncsym;
 static value_t instrsym, outstrsym;
--- a/print.c
+++ b/print.c
@@ -5,6 +5,7 @@
 #include "cvalues.h"
 #include "ieee754.h"
 #include "print.h"
+#include "read.h"
 
 htable_t printconses;
 static uint32_t printlabel;
--- a/read.c
+++ b/read.c
@@ -1,6 +1,7 @@
 #include "llt.h"
 #include "flisp.h"
 #include "cvalues.h"
+#include "read.h"
 
 enum {
 	TOK_NONE, TOK_OPEN, TOK_CLOSE, TOK_DOT, TOK_QUOTE, TOK_SYM, TOK_NUM,
--- /dev/null
+++ b/read.h
@@ -1,0 +1,21 @@
+#ifndef READ_H
+#define READ_H
+
+value_t fl_read_sexpr(value_t f);
+int isnumtok_base(char *tok, value_t *pval, int base);
+int isnumtok(char *tok, value_t *pval);
+
+// defines which characters are ordinary symbol characters.
+// exceptions are '.', which is an ordinary symbol character
+// unless it's the only character in the symbol, and '#', which is
+// an ordinary symbol character unless it's the first character.
+inline int
+symchar(char c)
+{
+        //static char *special = "()[]'\";`,\\| \a\b\f\n\r\t\v";
+        char *special = "()[]'\";`,\\| \a\b\f\n\r\t\v";
+        return !strchr(special, c);
+}
+
+#endif
+
--- a/string.c
+++ b/string.c
@@ -6,6 +6,7 @@
 #include "operators.h"
 #include "cvalues.h"
 #include "print.h"
+#include "read.h"
 
 BUILTIN("string?", stringp)
 {