YAP 7.1.0
index.h
1/*************************************************************************
2* *
3* YAP Prolog %W% %G%
4* *
5* Yap Prolog was developed at NCCUP - Universidade do Porto *
6* *
7* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
8* *
9**************************************************************************
10* *
11* File: index.h *
12* Last rev: *
13* mods: *
14* comments: indexation info *
15* *
16*************************************************************************/
17
18/* allowed types for clauses */
19typedef enum clause_type_enum {
20 pair_clause = 0x01,
21 struct_clause = 0x02,
22 atom_clause = 0x04,
23 int_clause = 0x08,
24 flt_clause = 0x10,
25 lgint_clause = 0x20,
26 dbref_clause = 0x40
27} clause_type;
28
29/* Four types of Clauses */
30#define MaxOptions 4
31
32/* Minimum number of clauses needed to build an hash table */
33/* must be a power of two */
34#define MIN_HASH_ENTRIES 4
35
36#define HASH_SHIFT 6
37
38/* Intermediate Data structures,
39 used to build the indexing code */
40
41/* Used to store all important information about a clause */
42typedef struct StructClauseDef {
43
44 Term Tag; /* if nonvar or nonlist, first argument */
45 yamop *Code; /* start of code for clause */
46 yamop *CurrentCode; /* start of code for clause */
47 union {
48 yamop *WorkPC; /* start of code for clause */
49 Term t_ptr;
50 CELL *c_sreg;
51 } ucd;
52} ClauseDef;
53
54/* Relevant information for groups */
55typedef struct {
56 ClauseDef *FirstClause;
57 ClauseDef *LastClause;
58 UInt VarClauses;
59 UInt AtomClauses;
60 UInt PairClauses;
61 UInt StructClauses;
62 UInt TestClauses;
63} GroupDef;
64
65/* switch_on_cons */
66typedef struct {
67 Term Tag;
68 union {
69 UInt Label;
70 yamop *labp;
71 } u_a;
73
74/* switch_on_func */
75typedef struct {
76 Functor Tag;
77 union {
78 UInt Label;
79 yamop *labp;
80 } u_f;
82
83/* switch_on_type */
84typedef struct {
85 UInt PairEntry;
86 UInt ConstEntry;
87 UInt FuncEntry;
88 UInt VarEntry;
90
91#define MAX_REG_COPIES 32
92
93typedef struct {
94 Int pos;
95 Term val;
96 Term extra;
98
99typedef enum { pc_entry, block_entry } add2index_entries;
100
101typedef struct {
102 add2index_entries flag;
103 union {
104 struct {
105 yamop **pi_pc;
106 yamop *code, *current_code, *work_pc;
107 Term tag;
108 } pce;
109 struct {
110 ClauseUnion *block;
111 yamop **entry_code;
112 } cle;
113 } uip;
115
116#define MAX_ISTACK_DEPTH 32
117
118typedef enum { REFRESH, RECORDA, RECORDZ } expand_values;
Definition: index.h:55
Definition: index.h:93
Definition: index.h:101
Definition: amidefs.h:264