aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sciteco.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sciteco.h')
-rw-r--r--src/sciteco.h44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/sciteco.h b/src/sciteco.h
index 88078c2..9d34d50 100644
--- a/src/sciteco.h
+++ b/src/sciteco.h
@@ -23,19 +23,49 @@
#include <Scintilla.h>
-#if TECO_INTEGER == 32
+#if TECO_NUMBER == 32
+
typedef gint32 teco_int_t;
-#define TECO_INT_MODIFIER G_GINT32_MODIFIER
-#define TECO_INT_FORMAT G_GINT32_FORMAT
-#elif TECO_INTEGER == 64
+#define TECO_INT_MODIFIER G_GINT32_MODIFIER
+#define TECO_INT_FORMAT G_GINT32_FORMAT
+
+typedef gfloat teco_float_t;
+#define TECO_FLOAT_MODIFIER ""
+#define TECO_FLOAT_FORMAT "g"
+
+#elif TECO_NUMBER == 64
+
typedef gint64 teco_int_t;
-#define TECO_INT_MODIFIER G_GINT64_MODIFIER
-#define TECO_INT_FORMAT G_GINT64_FORMAT
+#define TECO_INT_MODIFIER G_GINT64_MODIFIER
+#define TECO_INT_FORMAT G_GINT64_FORMAT
+
+typedef gdouble teco_float_t;
+#define TECO_FLOAT_MODIFIER "l"
+#define TECO_FLOAT_FORMAT "lg"
+
#else
-#error Invalid TECO integer storage size
+
+#error Invalid TECO number storage size
+
#endif
/**
+ * A number cell - either integer or float.
+ * The tagging is stored outside (either in
+ * a flag or on the operator stack).
+ */
+typedef union {
+ teco_int_t i;
+ teco_float_t f;
+} teco_number_t;
+
+/*
+ * FIXME: The storage size of float and double are not guaranteed
+ * to be 32-bit and 64-bit.
+ */
+//G_STATIC_ASSERT(sizeof(teco_number_t) == sizeof(teco_int_t));
+
+/**
* A TECO boolean - this differs from C booleans.
* See teco_is_success()/teco_is_failure().
*/