shithub: femtolisp

Download patch

ref: b9c77aa29efeaf571081058b563239900bbda01a
parent: f0a22a73b7f964b5edd6d7397468b48c344843c0
author: mag <mag-one@autistici.org>
date: Tue May 16 09:40:58 EDT 2023

type.h print.h

--- a/Makefile
+++ b/Makefile
@@ -78,16 +78,6 @@
 .c.o:
 	${CC} -o $@ -c $< ${CFLAGS}
 
-builtins.o: builtins.c operators.h cvalues.h
-cvalues.o: cvalues.c operators.h cvalues.h
-equal.o: equal.c operators.h cvalues.h
-print.o: print.c operators.h cvalues.h
-read.o: read.c cvalues.h
-string.o: string.c operators.h cvalues.h
-iostream.o: iostream.c cvalues.h
-table.o: table.c cvalues.h
-types.o: types.c cvalues.h
-
 flisp.o: flisp.c flisp.h operators.h cvalues.h maxstack.inc opcodes.h builtin_fns.h
 flmain.o: flmain.c boot.h flisp.h cvalues.h
 
--- a/cvalues.c
+++ b/cvalues.c
@@ -2,6 +2,7 @@
 #include "flisp.h"
 #include "operators.h"
 #include "cvalues.h"
+#include "types.h"
 
 value_t int8sym, uint8sym, int16sym, uint16sym, int32sym, uint32sym;
 value_t int64sym, uint64sym, mpintsym;
--- a/flisp.c
+++ b/flisp.c
@@ -10,6 +10,8 @@
 #include "operators.h"
 #include "cvalues.h"
 #include "opcodes.h"
+#include "types.h"
+#include "print.h"
 
 int
 isbuiltin(value_t x)
--- a/flisp.h
+++ b/flisp.h
@@ -334,15 +334,6 @@
 uintptr_t hash_lispvalue(value_t a);
 //--------------------------------------------------equal.c
 
-//--------------------------------------------------print.c
-void fl_print(ios_t *f, value_t v);
-void print_traverse(value_t v);
-void fl_print_chr(char c, ios_t *f);
-void fl_print_str(char *s, ios_t *f);
-void fl_print_child(ios_t *f, value_t v);
-//--------------------------------------------------print.c
-
-
 //--------------------------------------------------iostream.c
 int fl_isiostream(value_t v);
 ios_t *fl_toiostream(value_t v);
@@ -349,12 +340,6 @@
 //--------------------------------------------------iostream.c
 
 
-//--------------------------------------------------types.c
-fltype_t *get_type(value_t t);
-fltype_t *get_array_type(value_t eltype);
-fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab, cvinitfunc_t init);
-//--------------------------------------------------types.c
-
 //--------------------------------------------------------------------------------
 // New declarations here.. needed to permit files splitting
 // (and grouped by files).
@@ -440,18 +425,9 @@
 }
 //--------------------------------------------------read.c
 
-//--------------------------------------------------types.c
-void relocate_typetable(void);
-//--------------------------------------------------types.c
-
 //--------------------------------------------------equal.c
 value_t compare_(value_t a, value_t b, int eq);
 //--------------------------------------------------equal.c
-
-//--------------------------------------------------print.c
-extern htable_t printconses;
-extern int SCR_WIDTH;
-//--------------------------------------------------print.c
 
 #endif
 
--- a/flmain.c
+++ b/flmain.c
@@ -1,6 +1,7 @@
 #include "llt.h"
 #include "flisp.h"
 #include "cvalues.h"
+#include "print.h"
 
 static value_t
 argv_list(int argc, char *argv[])
--- a/iostream.c
+++ b/iostream.c
@@ -1,6 +1,8 @@
 #include "llt.h"
 #include "flisp.h"
 #include "cvalues.h"
+#include "types.h"
+#include "print.h"
 
 static value_t iostreamsym, rdsym, wrsym, apsym, crsym, truncsym;
 static value_t instrsym, outstrsym;
--- a/print.c
+++ b/print.c
@@ -4,6 +4,7 @@
 #include "opcodes.h"
 #include "cvalues.h"
 #include "ieee754.h"
+#include "print.h"
 
 htable_t printconses;
 static uint32_t printlabel;
--- /dev/null
+++ b/print.h
@@ -1,0 +1,14 @@
+#ifndef PRINT_H
+#define PRINT_H
+
+extern htable_t printconses;
+extern int SCR_WIDTH;
+
+void fl_print(ios_t *f, value_t v);
+void print_traverse(value_t v);
+void fl_print_chr(char c, ios_t *f);
+void fl_print_str(char *s, ios_t *f);
+void fl_print_child(ios_t *f, value_t v);
+
+#endif
+
--- a/string.c
+++ b/string.c
@@ -5,6 +5,7 @@
 #include "flisp.h"
 #include "operators.h"
 #include "cvalues.h"
+#include "print.h"
 
 BUILTIN("string?", stringp)
 {
--- a/table.c
+++ b/table.c
@@ -2,6 +2,8 @@
 #include "flisp.h"
 #include "equalhash.h"
 #include "cvalues.h"
+#include "types.h"
+#include "print.h"
 
 static value_t tablesym;
 static fltype_t *tabletype;
--- a/types.c
+++ b/types.c
@@ -1,7 +1,6 @@
 #include "llt.h"
 #include "flisp.h"
 #include "cvalues.h"
-
 #include "equalhash.h"
 
 fltype_t *
--- /dev/null
+++ b/types.h
@@ -1,0 +1,10 @@
+#ifndef TYPES_H
+#define TYPES_H
+
+fltype_t *get_type(value_t t);
+fltype_t *get_array_type(value_t eltype);
+fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab, cvinitfunc_t init);
+void relocate_typetable(void);
+
+#endif
+