summaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-27 15:20:29 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-27 15:20:29 +0000
commit4fba3e66dce0d167d2031a0d1f1f6f4571cbd981 (patch)
treea9ec00bc693e40ec4debca451de495889177b090 /dat.h
parent0a706b5b413aa96a944f45f28fb948c62e763555 (diff)
Don't use strings to identify vars, use numbers
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/dat.h b/dat.h
index b2ae80b..2855a3e 100644
--- a/dat.h
+++ b/dat.h
@@ -8,6 +8,7 @@ typedef struct Choicepoint Choicepoint;
typedef struct Clause Clause;
typedef struct Predicate Predicate;
typedef struct Module Module;
+typedef struct VarName VarName;
typedef int (*Builtin)(Term *, Binding **, Module *);
struct Operator
@@ -35,14 +36,14 @@ struct Term
union {
vlong ival;
double dval;
+ uvlong varnr;
struct Compound;
};
};
struct Binding
{
- Rune *name;
- uvlong nr; /* Unique number for each clause. Every time a clause is used, it gets a new number. */
+ uvlong varnr;
Term *value;
Binding *next;
};
@@ -93,6 +94,14 @@ struct Module
Module *next;
};
+struct VarName
+{
+ Rune *name;
+ Term *var;
+ int count;
+ VarName *next;
+};
+
/* Operator types */
enum {
Xf = 1<<0, /* 1 */