2 * Sherlock: Custom Parts of Configuration
4 * (c) 2001--2003 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
10 /* Word types (at most 7 of them + WT_RESERVED and WT_MAX) */
12 #define WT_RESERVED 0 /* Reserved word type */
13 #define WT_TEXT 1 /* Ordinary text */
14 #define WT_EMPH 2 /* Emphasized text */
15 #define WT_SMALL 3 /* Small font */
16 #define WT_SMALL_HEADING 4 /* Heading */
17 #define WT_BIG_HEADING 5 /* Larger heading */
18 #define WT_ALT 6 /* Alternate texts for graphical elements */
19 #define WT_LINK 7 /* Link text */
22 /* Descriptive names used for user output */
23 #define WORD_TYPE_USER_NAMES \
24 "reserved", "text", "emph", "small", "hdr1", "hdr2", "alt", "link"
26 /* Keywords for word type names */
27 #define WORD_TYPE_NAMES \
28 T(WORD, ~(1 << WT_LINK)) \
29 T(TEXT, 1 << WT_TEXT) \
30 T(EMPH, 1 << WT_EMPH) \
31 T(SMALL, 1 << WT_SMALL) \
32 T(HDR, (1 << WT_SMALL_HEADING) | (1 << WT_BIG_HEADING)) \
33 T(HDR1, 1 << WT_SMALL_HEADING) \
34 T(HDR2, 1 << WT_BIG_HEADING) \
38 /* These types are always matched without accents if accent mode is set to "auto" */
39 #define WORD_TYPES_NO_AUTO_ACCENT 0
41 /* These types belong to all languages */
42 #define WORD_TYPES_ALL_LANGS (1 << WT_LINK)
44 /* Meta information types (at most 16 of them + MT_MAX) */
46 #define MT_TITLE 0 /* Document title */
47 #define MT_KEYWORD 1 /* Keyword from the document */
48 #define MT_MISC 2 /* Unclassified metas */
51 #define META_TYPE_USER_NAMES \
52 "title", "keywd", "misc"
54 /* Keywords for meta type names */
55 #define META_TYPE_NAMES \
56 T(TITLE, 1 << MT_TITLE) \
57 T(KEYWD, 1 << MT_KEYWORD) \
60 #define META_TYPES_NO_AUTO_ACCENT 0
61 #define META_TYPES_ALL_LANGS 0
65 #define ST_RESERVED 0 /* Reserved string type */
66 #define ST_URL 1 /* URL of the document */
67 #define ST_HOST 2 /* Host name */
68 #define ST_DOMAIN 3 /* Domain name */
69 #define ST_REF 4 /* URL reference */
72 #define STRING_TYPE_USER_NAMES \
73 "URL", "host", "domain", "ref", "type4", "type5", "type6", "type7", \
74 "type8", "type9", "type10", "type11", "type12", "type13", "type14", "type15"
76 #define STRING_TYPE_NAMES \
78 T(HOST, 1 << ST_HOST) \
79 T(DOMAIN, 1 << ST_DOMAIN) \
82 #define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF))
83 /* These must be indexed in lowercase form */
84 #define STRING_TYPES_CASE_INSENSITIVE ((1 << ST_HOST) | (1 << ST_DOMAIN))
87 * Definitions of custom attributes:
89 * First of all, you need to define your own card_attr fields which will
90 * contain your attributes: CUSTOM_CARD_ATTRS lists them.
91 * Please order the attributes by decreasing size to get optimum padding.
93 * Then define custom_create_attrs() which will get the object description
94 * and set your card_attr fields accordingly.
96 * Finally, you have to define CUSTOM_ATTRS with matching rules:
98 * INT_ATTR(id, keyword, get_func, parse_func) -- unsigned integer attribute
100 * id C identifier of the attribute
101 * keywd search server keyword for the attribute
102 * int get_func(struct card_attr *ca)
103 * get attribute value from the card_attr
104 * byte *parse_func(u32 *dest, byte *value, uns intval)
105 * parse value in query (returns error message or NULL)
106 * for KEYWD = "string", it gets value="string", intval=0
107 * for KEYWD = num, it gets value=NULL, intval=num.
109 * SMALL_SET_ATTR(id, keyword, get_func, parse_func)
110 * -- integers 0..31 with set matching
112 * A good place for definitions of the functions is lib/custom.c.
118 /* No custom attributes defined yet */
120 #define CUSTOM_CARD_ATTRS
122 static inline void custom_create_attrs(struct odes *odes UNUSED, struct card_attr *ca UNUSED) { }