b89c4989c3cadb0cea5ca36f3c48496282a9f9a3
[egate.git] / ccl / ccl.h
1 /* CCL - public header file
2  * Europagate, 1995
3  *
4  * $Log: ccl.h,v $
5  * Revision 1.3  1995/02/14 10:25:55  adam
6  * The constructions 'qualifier rel term ...' implemented.
7  *
8  * Revision 1.2  1995/02/13  15:15:06  adam
9  * Added handling of qualifiers. Not finished yet.
10  *
11  * Revision 1.1  1995/02/13  12:35:20  adam
12  * First version of CCL. Qualifiers aren't handled yet.
13  *
14  */
15
16 #define CCL_ERR_OK                0
17 #define CCL_ERR_TERM_EXPECTED     1
18 #define CCL_ERR_RP_EXPECTED       2
19 #define CCL_ERR_SETNAME_EXPECTED  3
20 #define CCL_ERR_OP_EXPECTED       4
21 #define CCL_ERR_BAD_RP            5
22 #define CCL_ERR_UNKNOWN_QUAL      6
23 #define CCL_ERR_DOBBLE_QUAL       7
24 #define CCL_ERR_EQ_EXPECTED       8
25 #define CCL_ERR_BAD_RELATION      9
26
27 struct ccl_rpn_attr {
28     struct ccl_rpn_attr *next;
29     int type;
30     int value;
31 };
32
33 struct ccl_rpn_node {
34     enum rpn_node_kind { AND, OR, NOT, TERM, SET, PROX } kind;
35     union {
36         struct ccl_rpn_node *p[2];
37         struct {
38             char *term;
39             struct ccl_rpn_attr *attr_list;
40         } t;
41         char *setname;
42     } u;
43 };
44
45 typedef struct ccl_qualifiers *CCL_bibset;
46
47
48 struct ccl_rpn_node *ccl_find_str (CCL_bibset bibset,
49                                    const char *str, int *error, int *pos);
50 char *ccl_err_msg (int ccl_errno);
51 void ccl_rpn_delete (struct ccl_rpn_node *rpn);
52 void ccl_pr_tree (struct ccl_rpn_node *rpn);
53
54 void ccl_qual_add (CCL_bibset b, const char *name, int no, int *attr);
55 CCL_bibset ccl_qual_mk (void);
56 void ccl_qual_rm (CCL_bibset *b);
57 struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, int len);
58
59
60
61 /* use (1)
62
63    relation (2)
64                             -1  none
65                              0  ordered
66                            1-6  relation (<, <=, =, >=, >, <>)
67
68    position (3)
69                             -1  none
70                              1  first in field
71                              2  first in sub field
72                              3  any position in field
73    structure (4)
74                             -1  none
75                              0  word/phrase auto select
76                              1  phrase
77                              2  word
78                              3  key
79                              4  year
80                              5  date (normalized)
81                              6  word list 
82                            100  date (un-normalized)
83                            101  name (normalized)
84                            102  name (un-normalized)
85    truncation (5)                            
86    completeness (6)
87 */
88
89 #define CCL_BIB1_USE 1
90 #define CCL_BIB1_REL 2
91 #define CCL_BIB1_POS 3
92 #define CCL_BIB1_STR 4
93 #define CCL_BIB1_TRU 5
94 #define CCL_BIB1_COM 6
95
96 #define CCL_BIB1_STR_WP (-1)
97 #define CCL_BIB1_REL_ORDER (-1)
98
99 #define CCL_TRUNC_L      1
100 #define CCL_TRUNC_R      2
101 #define CCL_TRUNC_LR     4
102 #define CCL_TRUNC_NONE   8
103 #define CCL_TRUNC_HASH   16
104 #define CCL_TRUNC_REG    32