X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fcustom.h;h=250a7bac19afc6636efac7ce32aff61cfc26e050;hb=157acec25f2e60c76607edc3d62cf23fe47f4efe;hp=2244dd848a5c532cfc4b6429752472a7db086fac;hpb=13bc5e1c30abb77c6e1120b2e0bf50cd0ab94a6a;p=libucw.git diff --git a/lib/custom.h b/lib/custom.h index 2244dd84..250a7bac 100644 --- a/lib/custom.h +++ b/lib/custom.h @@ -1,19 +1,13 @@ /* * Sherlock: Custom Parts of Configuration * - * (c) 2001 Martin Mares + * (c) 2001--2002 Martin Mares */ /* Name of this customization (version suffix) */ #define SHER_SUFFIX "" -/* Features */ - -#define SHERLOCK_CONFIG_LARGE_DB /* Support for DB files >4GB */ -#define SHERLOCK_CONFIG_LFS /* Large files on 32-bit systems */ -#define SHERLOCK_CONFIG_LFS_LIBC /* LFS supported directly by libc */ - /* Word types */ enum word_type { @@ -84,3 +78,43 @@ enum string_type { #define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF) | (1 << ST_BACKREF)) /* These must be indexed in lowercase form */ #define STRING_TYPES_CASE_INSENSITIVE ((1 << ST_HOST) | (1 << ST_DOMAIN)) + +/* + * Definitions of custom attributes: + * + * INT_ATTR(type, id, oattr, keyword, get_func, parse_func) + * + * type data type used to hold the value + * id C identifier of the attribute + * oattr object attribute we get the value from + * keywd search server keyword for the attribute + * void get_func(struct card_attr *ca, byte *attr) + * parse object attribute (may be NULL) + * byte *parse_func(u32 *dest, byte *value, uns intval) + * parse value in query (returns error message or NULL) + * for KEYWD = "string", it gets value="string", intval=0 + * for KEYWD = num, it gets value=NULL, intval=num. + * + * A good place for definitions of the functions is lib/custom.c. + * + * Please order the attributes by decreasing size to get optimum padding. + * + * If you also want the search server to sort by a custom attribute + * on ties, define CUSTOM_SORTING. + */ + +#if 0 /* Example */ + +#define CUSTOM_ATTRS INT_ATTR(u32, lm, 'L', LM, custom_get_lm, custom_parse_lm) + +struct card_attr; +void custom_get_lm(struct card_attr *ca, byte *attr); +byte *custom_parse_lm(u32 *dest, byte *value, uns intval); + +#define CUSTOM_SORTING + +#else + +#define CUSTOM_ATTRS + +#endif