From 4fba3e66dce0d167d2031a0d1f1f6f4571cbd981 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 27 Jul 2021 15:20:29 +0000 Subject: Don't use strings to identify vars, use numbers --- dat.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'dat.h') 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 */ -- cgit v1.2.3