38 #include "../base/ver.h"
42 #include "../base/str.h"
45 #ifndef CHECK_INCLUDED
46 #include "../base/check.h"
49 #ifndef STRTAB_INCLUDED
50 #include "../dom/strtab.h"
54 #include "../rel/bind.h"
58 #include "../rel/rel.h"
61 #ifndef LIST_1_INCLUDED
62 #include "../rel/list_1.h"
65 #ifndef LIST_2_INCLUDED
66 #include "../rel/list_2.h"
69 #ifndef SET_1_INCLUDED
70 #include "../rel/set_1.h"
73 #ifndef SET_2_INCLUDED
74 #include "../rel/set_2.h"
77 #ifndef REL_N_N_INCLUDED
78 #include "../rel/rel_n_n.h"
81 #ifndef ARGTYPE_INCLUDED
94 static const int PRED_MAX_RELS = 5;
100 static const long PRED_MAGIC = 0x5052440AL;
151 void set_argtype(
int arg_no,
argtype_t arg_type) {
153 CHECK(arg_no >= 0,
"pred_c::set_argtype: arg_no is negative");
154 CHECK(arg_no < Arity,
"pred_c::set_argtype: arg_no too large");
156 "pred_c::set_argtype: argtype already set");
157 CHECK(argtype_valid(arg_type),
158 "pred_c::set_argtype: arg_type is invalid");
160 ArgType[arg_no] = arg_type;
166 CHECK(arg_no >= 0,
"pred_c::argtype: arg_no is negative");
167 CHECK(arg_no < Arity,
"pred_c::argtype: arg_no too large");
169 return ArgType[arg_no];
175 void set_dom(
int arg_no,
strtab_t dom) {
177 CHECK(arg_no >= 0,
"pred_c::set_dom: arg_no is negative");
178 CHECK(arg_no < Arity,
"pred_c::set_dom: arg_no too large");
180 CHECK(Dom[arg_no] == STRTAB_NULL,
181 "pred_c::set_dom: arg_no is already set");
189 CHECK(arg_no >= 0,
"pred_c::arg_dom: arg_no is negative");
190 CHECK(arg_no < Arity,
"pred_c::arg_dom: arg_no too large");
198 bool add_rel(
rel_t rel, bind_t bind);
202 return add_rel(rel, BIND_F);
206 return add_rel(rel, BIND_FF);
210 return add_rel(rel, BIND_B);
214 return add_rel(rel, BIND_BB);
218 return add_rel(rel, BIND_BF);
222 bool store_fact(
int args[]);
231 void set_next(
pred_c *next_pred) {
233 HashNext = next_pred;
290 rel_t Rel[PRED_MAX_RELS];
293 bind_t Bind[PRED_MAX_RELS];
315 #define PRED_NULL (static_cast<pred_t>(0))
#define VER_MAX_PRED_ARGS
Definition: ver.h:220
#define CHECK_VALID(EX)
Definition: check.h:85
const char * str_t
Definition: str.h:41
#define STR_NULL
Definition: str.h:52
Enumeration type for types of predicate arguments.
enum argtype_enum argtype_t
#define CHECK(EX, MSG)
Definition: check.h:69
#define CHECK_PAR(PAR, PLACE)
Definition: check.h:102