aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/csx.h84
-rw-r--r--include/csxbind.h55
2 files changed, 125 insertions, 14 deletions
diff --git a/include/csx.h b/include/csx.h
index 2087212..8dfab4a 100644
--- a/include/csx.h
+++ b/include/csx.h
@@ -2,28 +2,84 @@
#define CSX_INCLUDED
-typedef void *(csx_list_fn)(void *head, ...);
-void *csx_list(void *head, ...);
+typedef struct csxobj {
+ int mark;
+ char *type;
+ char data[1]; /* data is here only for easy conversion back */
+} csxobj;
-typedef void *(csx_pair_fn)(void *a, void *b, void *c, ...);
-void *csx_pair(void *a, void *b, void *c, ...);
+csxobj *csx_obj(void *p);
-typedef int *(csx_int_fn)(int num);
-int *csx_int(int num);
-typedef double *(csx_real_fn)(double num);
-double *csx_real(double num);
+typedef struct csxpair {
+ void *head;
+ void *tail;
+} csxpair;
-void *csx_run(void *expression);
-typedef void *(*csx_base_data)(void *arg);
-csx_base_data *csx_base(csx_base_data base);
+typedef struct csxbasenames {
+ char *name;
+ char *pair;
+ char *str;
+ char *_int;
+ char *base;
+ char *fn;
+ char *sx;
+ char *set;
+ char *_isset;
+ char *sethead;
+ char *settail;
+ char *head;
+ char *tail;
+ char *qt;
+ char *same;
+ char *type;
+ char *_do;
+ char *_if;
+ char *_plus;
+ char *_star;
+ char *neg;
+ char *div;
+ char *mod;
+ char *_less;
+ char *_more;
+ char *out;
+ char *in;
+ char *len;
+ char *run;
+ char *context;
+ char *newcontext;
+ char *_exit;
+} csxbasenames;
-char *csx_name(const char *name);
+typedef struct csxi {
+ void **objs;
+ int objslen;
+ int objssize;
+ void **stack;
+ int stacklen;
+ int stacksize;
+ int lastlen;
+ void *null;
+ int *one;
+ csxbasenames basenames;
+ csxpair *context;
+} csxi;
-char *csx_str(const char *str);
+void csx_init(csxi *csx);
+void csx_free(csxi *csx);
-void csx_free();
+csxpair *csx_list(csxi *csx, void *head, ...);
+csxpair *csx_dot(csxi *csx, void *a, void *b, void *c, ...);
+csxpair *csx_pair(csxi *csx, void *head, void *tail);
+char *csx_name(csxi *csx, const char *name);
+char *csx_str(csxi *csx, const char *str);
+int *csx_int(csxi *csx, int num);
+
+void *csx_run(csxi *csx, void *expression);
+
+typedef void *(*csxbase)(csxi *csx, void *arg);
+csxbase *csx_base(csxi *csx, csxbase base);
#endif
diff --git a/include/csxbind.h b/include/csxbind.h
new file mode 100644
index 0000000..84a73d9
--- /dev/null
+++ b/include/csxbind.h
@@ -0,0 +1,55 @@
+#ifndef CSX_INCLUDED_BIND
+#define CSX_INCLUDED_BIND
+
+
+#include "csx.h"
+
+
+extern char *name;
+extern char *pair;
+extern char *str;
+extern char *_int;
+extern char *base;
+extern char *fn;
+extern char *sx;
+extern char *set;
+extern char *_isset;
+extern char *sethead;
+extern char *settail;
+extern char *head;
+extern char *tail;
+extern char *qt;
+extern char *same;
+extern char *type;
+extern char *_do;
+extern char *_if;
+extern char *_plus;
+extern char *_star;
+extern char *neg;
+extern char *div;
+extern char *mod;
+extern char *_less;
+extern char *_more;
+extern char *out;
+extern char *in;
+extern char *len;
+extern char *run;
+extern char *context;
+extern char *newcontext;
+extern char *_exit;
+
+void init();
+
+csxpair *L(void *head, ...);
+csxpair *D(void *a, void *b, void *c, ...);
+csxpair *P(void *head, void *tail);
+char *N(const char *name);
+char *S(const char *str);
+int *I(int num);
+
+void *R(void *expression);
+
+csxbase *newbase(csxbase base);
+
+
+#endif