2 * Sherlock: Custom Parts of Configuration
4 * (c) 2001--2002 Martin Mares <mj@ucw.cz>
7 /* Name of this customization (version suffix) */
14 WT_RESERVED, /* Reserved word type */
15 WT_TEXT, /* Ordinary text */
16 WT_EMPH, /* Emphasized text */
17 WT_SMALL, /* Small font */
18 WT_TITLE, /* Document title */
19 WT_SMALL_HEADING, /* Heading */
20 WT_BIG_HEADING, /* Larger heading */
21 WT_KEYWORD, /* Explicitly marked keyword */
22 WT_META, /* Various meta-information */
23 WT_ALT, /* Alternate texts for graphical elements */
24 WT_URL1, /* Word extracted from document URL (low and high weight) */
26 WT_FILE, /* Part of file name */
27 WT_LINK, /* Link text */
31 /* Descriptive names used for user output */
32 #define WORD_TYPE_USER_NAMES \
33 "reserved", "text", "emph", "small", "title", "hdr1", "hdr2", "keywd", \
34 "meta", "alt", "urlword1", "urlword2", "nameword", "link", "type14", "type15"
36 /* Keywords for word type names */
37 #define WORD_TYPE_NAMES \
38 T(WORD, ~((1 << WT_FILE) | (1 << WT_LINK))) \
39 T(TEXT, 1 << WT_TEXT) \
40 T(EMPH, 1 << WT_EMPH) \
41 T(SMALL, 1 << WT_SMALL) \
42 T(TITLE, 1 << WT_TITLE) \
43 T(HDR, (1 << WT_SMALL_HEADING) | (1 << WT_BIG_HEADING)) \
44 T(HDR1, 1 << WT_SMALL_HEADING) \
45 T(HDR2, 1 << WT_BIG_HEADING) \
46 T(KEYWD, 1 << WT_KEYWORD) \
47 T(META, 1 << WT_META) \
49 T(URLWORD, (1 << WT_URL1) | (1 << WT_URL2)) \
50 T(FILE, 1 << WT_FILE) \
53 /* These types are not shown in document contexts */
54 #define WORD_TYPES_HIDDEN ((1 << WT_URL1) | (1 << WT_URL2) | (1 << WT_FILE))
56 /* These types are always matched without accents if accent mode is set to "auto" */
57 #define WORD_TYPES_NO_AUTO_ACCENT ((1 << WT_URL1) | (1 << WT_URL2) | (1 << WT_FILE) | (1 << WT_LINK))
62 ST_RESERVED, /* Reserved string type */
63 ST_URL, /* URL of the document */
64 ST_HOST, /* Host name */
65 ST_DOMAIN, /* Domain name */
66 ST_REF, /* URL reference */
67 ST_BACKREF, /* Back-reference (frame or redirect source) */
71 #define STRING_TYPE_USER_NAMES \
72 "URL", "host", "domain", "ref", "backref", "type5", "type6", "type7", \
73 "type8", "type9", "type10", "type11", "type12", "type13", "type14", "type15"
75 #define STRING_TYPE_NAMES \
77 T(HOST, 1 << ST_HOST) \
78 T(DOMAIN, 1 << ST_DOMAIN) \
80 T(BACKREF, 1 << ST_BACKREF)
82 #define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF) | (1 << ST_BACKREF))
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 * INT_ATTR(type, id, oattr, keyword, get_func, parse_func)
91 * type data type used to hold the value
92 * id C identifier of the attribute
93 * oattr object attribute we get the value from
94 * keywd search server keyword for the attribute
95 * void get_func(struct card_attr *ca, byte *attr)
96 * parse object attribute (may be NULL)
97 * byte *parse_func(u32 *dest, byte *value, uns intval)
98 * parse value in query (returns error message or NULL)
99 * for KEYWD = "string", it gets value="string", intval=0
100 * for KEYWD = num, it gets value=NULL, intval=num.
102 * A good place for definitions of the functions is lib/custom.c.
104 * Please order the attributes by decreasing size to get optimum padding.
109 #define CUSTOM_ATTRS INT_ATTR(u32, lm, 'L', LM, custom_get_lm, custom_parse_lm)
112 void custom_get_lm(struct card_attr *ca, byte *attr);
113 byte *custom_parse_lm(u32 *dest, byte *value, uns intval);