YAP 7.1.0
udi_private.h
1#include "config.h"
2#include "udi.h"
3#include "utarray.h"
4#include "uthash.h"
5
6/* Argument Indexing */
7struct udi_p_args {
8 int arg; //indexed arg
9 void *idxstr; //user indexing structure
10 UdiControlBlock control; //user indexing structure functions
11};
12typedef struct udi_p_args *UdiPArg;
13UT_icd arg_icd = {sizeof(struct udi_p_args), NULL, NULL, NULL };
14
15/* clauselist */
16UT_icd cl_icd = {sizeof(yamop *), NULL, NULL, NULL };
17
18/*
19 * All the info we need to enter user indexed code
20 * stored in a uthash
21 */
23{
24 PredEntry *p; //predicate (need to identify asserts)
25 UT_array *clauselist; //clause list used on returns
26 UT_array *args; //indexed args
27 UT_hash_handle hh; //uthash handle
28};
29typedef struct udi_info *UdiInfo;
30
31/* to ease code for a UdiInfo hash table*/
32#define HASH_FIND_UdiInfo(head,find,out) \
33 HASH_FIND(hh,head,find,sizeof(PredEntry),out)
34#define HASH_ADD_UdiInfo(head,p,add) \
35 HASH_ADD_KEYPTR(hh,head,p,sizeof(PredEntry *),add)
36
37/* used during init */
38static YAP_Int p_new_udi( USES_REGS1 );
39static YAP_Int p_udi_args_init(Term spec, int arity, UdiInfo blk);
40
41/*
42 * Indexing Search and intersection Helpers
43 */
44
45/* single indexing helpers (no intersection needed just create clauselist) */
46#include "clause_list.h"
48{
50 UT_array *clauselist;
51 void * pred;
52};
53typedef struct si_callback_h * si_callback_h_t;
54
55static inline int si_callback(void *key, void *data, void *arg)
56{
58 yamop **cl = (yamop **) utarray_eltptr(c->clauselist, ((YAP_Int) data) - 1);
59 return Yap_ClauseListExtend(c->cl, *cl, c->pred);
60}
61
Definition: utarray.h:47
Definition: Yatom.h:544
Definition: amidefs.h:264