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 */
7
struct
udi_p_args
{
8
int
arg;
//indexed arg
9
void
*idxstr;
//user indexing structure
10
UdiControlBlock
control;
//user indexing structure functions
11
};
12
typedef
struct
udi_p_args
*
UdiPArg
;
13
UT_icd
arg_icd = {
sizeof
(
struct
udi_p_args
), NULL, NULL, NULL };
14
15
/* clauselist */
16
UT_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
*/
22
struct
udi_info
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
};
29
typedef
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 */
38
static
YAP_Int p_new_udi( USES_REGS1 );
39
static
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"
47
struct
si_callback_h
48
{
49
clause_list_t
cl;
50
UT_array
*clauselist;
51
void
* pred;
52
};
53
typedef
struct
si_callback_h
*
si_callback_h_t
;
54
55
static
inline
int
si_callback(
void
*key,
void
*data,
void
*arg)
56
{
57
si_callback_h_t
c = (
si_callback_h_t
) arg;
58
yamop
**cl = (
yamop
**) utarray_eltptr(c->clauselist, ((YAP_Int) data) - 1);
59
return
Yap_ClauseListExtend(c->cl, *cl, c->pred);
60
}
61
ClauseList
Definition:
clause_list.h:4
UT_array
Definition:
utarray.h:54
UT_hash_handle
Definition:
uthash.h:906
UT_icd
Definition:
utarray.h:47
pred_entry
Definition:
Yatom.h:544
si_callback_h
Definition:
udi_private.h:48
udi_control_block
Definition:
udi.h:76
udi_info
Definition:
udi_private.h:23
udi_p_args
Definition:
udi_private.h:7
yami
Definition:
amidefs.h:264
H
udi_private.h
Generated by
1.9.3