ref: 310ccf23d770b7f9e7589c3ef2611c1565009a7e
parent: 0cc160518d4d3653064fe3a6cd3dfd476e999f5a
author: mag <[email protected]>
date: Tue May 16 08:17:06 EDT 2023
operators.h
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@
equalhash.o\
table.o\
iostream.o\
+ operators.o\
cvalues.o\
read.o\
print.o\
@@ -77,9 +78,13 @@
.c.o:
${CC} -o $@ -c $< ${CFLAGS}
-cvalues.o: operators.c
+builtins.o: operators.h
+cvalues.o: operators.h
+equal.o: operators.h
+print.o: operators.h
+string.o: operators.h
-flisp.o: flisp.c flisp.h maxstack.inc opcodes.h builtin_fns.h
+flisp.o: flisp.c flisp.h operators.h maxstack.inc opcodes.h builtin_fns.h
flmain.o: flmain.c boot.h flisp.h
boot.h: flisp.boot
--- a/builtins.c
+++ b/builtins.c
@@ -4,6 +4,7 @@
#include "llt.h"
#include "flisp.h"
+#include "operators.h"
size_t
llength(value_t v)
--- a/cvalues.c
+++ b/cvalues.c
@@ -1,7 +1,6 @@
#include "llt.h"
#include "flisp.h"
-
-#include "operators.c"
+#include "operators.h"
value_t int8sym, uint8sym, int16sym, uint16sym, int32sym, uint32sym;
value_t int64sym, uint64sym, mpintsym;
--- a/equal.c
+++ b/equal.c
@@ -1,5 +1,6 @@
#include "llt.h"
#include "flisp.h"
+#include "operators.h"
#include "opcodes.h"
#define BOUNDED_COMPARE_BOUND 128
--- a/flisp.c
+++ b/flisp.c
@@ -7,6 +7,7 @@
#include "llt.h"
#include "flisp.h"
+#include "operators.h"
#include "opcodes.h"
int
--- a/flisp.h
+++ b/flisp.h
@@ -397,21 +397,21 @@
//--------------------------------------------------types.c
//--------------------------------------------------operators.c
-double conv_to_double(void *data, numerictype_t tag);
-void conv_from_double(void *data, double d, numerictype_t tag);
-mpint *conv_to_mpint(void *data, numerictype_t tag);
-int64_t conv_to_int64(void *data, numerictype_t tag);
-uint64_t conv_to_uint64(void *data, numerictype_t tag);
-int32_t conv_to_int32(void *data, numerictype_t tag);
-uint32_t conv_to_uint32(void *data, numerictype_t tag);
-
-#if defined(ULONG64)
-#define conv_to_long conv_to_int64
-#define conv_to_ulong conv_to_uint64
-#else
-#define conv_to_long conv_to_int32
-#define conv_to_ulong conv_to_uint32
-#endif
+//double conv_to_double(void *data, numerictype_t tag);
+//void conv_from_double(void *data, double d, numerictype_t tag);
+//mpint *conv_to_mpint(void *data, numerictype_t tag);
+//int64_t conv_to_int64(void *data, numerictype_t tag);
+//uint64_t conv_to_uint64(void *data, numerictype_t tag);
+//int32_t conv_to_int32(void *data, numerictype_t tag);
+//uint32_t conv_to_uint32(void *data, numerictype_t tag);
+//
+//#if defined(ULONG64)
+//#define conv_to_long conv_to_int64
+//#define conv_to_ulong conv_to_uint64
+//#else
+//#define conv_to_long conv_to_int32
+//#define conv_to_ulong conv_to_uint32
+//#endif
//--------------------------------------------------operators.c
--- a/operators.c
+++ b/operators.c
@@ -1,4 +1,6 @@
#include "llt.h"
+#include "flisp.h"
+#include "operators.h"
mpint *
conv_to_mpint(void *data, numerictype_t tag)
--- /dev/null
+++ b/operators.h
@@ -1,0 +1,27 @@
+#ifndef OPERATORS_H
+#define OPERATORS_H
+
+mpint * conv_to_mpint(void *data, numerictype_t tag);
+double conv_to_double(void *data, numerictype_t tag);
+void conv_from_double(void *dest, double d, numerictype_t tag);
+
+int64_t conv_to_int64(void *data, numerictype_t tag);
+uint64_t conv_to_uint64(void *data, numerictype_t tag);
+int32_t conv_to_int32(void *data, numerictype_t tag);
+uint32_t conv_to_uint32(void *data, numerictype_t tag);
+
+int cmp_same_lt(void *a, void *b, numerictype_t tag);
+int cmp_same_eq(void *a, void *b, numerictype_t tag);
+int cmp_lt(void *a, numerictype_t atag, void *b, numerictype_t btag);
+int cmp_eq(void *a, numerictype_t atag, void *b, numerictype_t btag, int equalnans);
+
+#if defined(ULONG64)
+#define conv_to_long conv_to_int64
+#define conv_to_ulong conv_to_uint64
+#else
+#define conv_to_long conv_to_int32
+#define conv_to_ulong conv_to_uint32
+#endif
+
+#endif
+
--- a/print.c
+++ b/print.c
@@ -1,5 +1,6 @@
#include "llt.h"
#include "flisp.h"
+#include "operators.h"
#include "opcodes.h"
#include "ieee754.h"
--- a/string.c
+++ b/string.c
@@ -3,6 +3,7 @@
*/
#include "llt.h"
#include "flisp.h"
+#include "operators.h"
BUILTIN("string?", stringp)
{