| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#ifndef __LIBSWISH3_H__ |
|---|
| 22 |
#define __LIBSWISH3_H__ |
|---|
| 23 |
|
|---|
| 24 |
#include <sys/types.h> |
|---|
| 25 |
#include <sys/stat.h> |
|---|
| 26 |
#include <time.h> |
|---|
| 27 |
#include <libxml/parser.h> |
|---|
| 28 |
#include <libxml/hash.h> |
|---|
| 29 |
#include <libxml/xmlstring.h> |
|---|
| 30 |
|
|---|
| 31 |
#define SWISH_LIB_VERSION "0.1.0" |
|---|
| 32 |
#define SWISH_VERSION "3.0.0" |
|---|
| 33 |
#define SWISH_BUFFER_CHUNK_SIZE 16384 |
|---|
| 34 |
#define SWISH_TOKEN_LIST_SIZE 1024 |
|---|
| 35 |
#define SWISH_MAXSTRLEN 2048 |
|---|
| 36 |
#define SWISH_MAX_HEADERS 6 |
|---|
| 37 |
#define SWISH_RD_BUFFER_SIZE 65536 // used ?? |
|---|
| 38 |
#define SWISH_MAX_WORD_LEN 256 |
|---|
| 39 |
#define SWISH_MIN_WORD_LEN 1 |
|---|
| 40 |
#define SWISH_STACK_SIZE 255 |
|---|
| 41 |
#define SWISH_CONTRACTIONS 1 |
|---|
| 42 |
#define SWISH_SPECIAL_ARG 1 |
|---|
| 43 |
#define SWISH_MAX_SORT_STRING_LEN 100 |
|---|
| 44 |
|
|---|
| 45 |
#define SWISH_DATE_FORMAT_STRING "%Y-%m-%d %H:%M:%S %Z" |
|---|
| 46 |
#define SWISH_URL_LENGTH 255 |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
#define SWISH_HEADER_ROOT "swish" |
|---|
| 50 |
#define SWISH_INCLUDE_FILE "IncludeConfigFile" |
|---|
| 51 |
#define SWISH_CLASS_ATTRIBUTES "XMLClassAttributes" |
|---|
| 52 |
#define SWISH_PROP "PropertyNames" |
|---|
| 53 |
#define SWISH_META "MetaNames" |
|---|
| 54 |
#define SWISH_MIME "MIME" |
|---|
| 55 |
#define SWISH_PARSERS "Parsers" |
|---|
| 56 |
#define SWISH_INDEX "Index" |
|---|
| 57 |
#define SWISH_ALIAS "TagAlias" |
|---|
| 58 |
#define SWISH_WORDS "Words" |
|---|
| 59 |
#define SWISH_DEFAULT_PARSER "default" |
|---|
| 60 |
#define SWISH_PARSER_TXT "TXT" |
|---|
| 61 |
#define SWISH_PARSER_XML "XML" |
|---|
| 62 |
#define SWISH_PARSER_HTML "HTML" |
|---|
| 63 |
#define SWISH_DEFAULT_PARSER_TYPE "HTML" |
|---|
| 64 |
#define SWISH_INDEX_FORMAT "Format" |
|---|
| 65 |
#define SWISH_INDEX_NAME "Name" |
|---|
| 66 |
#define SWISH_INDEX_LOCALE "Locale" |
|---|
| 67 |
#define SWISH_DEFAULT_VALUE "1" |
|---|
| 68 |
#define SWISH_TOKENIZE "Tokenize" |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
#define SWISH_DEFAULT_METANAME "swishdefault" |
|---|
| 72 |
#define SWISH_TITLE_METANAME "swishtitle" |
|---|
| 73 |
#define SWISH_TITLE_TAG "title" |
|---|
| 74 |
#define SWISH_BODY_TAG "body" |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
#define SWISH_DEFAULT_MIME "text/plain" |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
#define SWISH_INDEX_FILENAME "index.swish3" |
|---|
| 81 |
#define SWISH_XAPIAN_FORMAT "xapian" |
|---|
| 82 |
#define SWISH_SWISH_FORMAT "swish" |
|---|
| 83 |
#define SWISH_HYPERE_FORMAT "hypere" |
|---|
| 84 |
#define SWISH_INDEX_FILEFORMAT "swish" |
|---|
| 85 |
#define SWISH_HEADER_FILE "swish.xml" |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
#define SWISH_PROP_STRING 1 |
|---|
| 89 |
#define SWISH_PROP_DATE 2 |
|---|
| 90 |
#define SWISH_PROP_INT 3 |
|---|
| 91 |
|
|---|
| 92 |
#define SWISH_PROP_RECCNT "swishreccount" |
|---|
| 93 |
#define SWISH_PROP_RANK "swishrank" |
|---|
| 94 |
#define SWISH_PROP_DOCID "swishfilenum" |
|---|
| 95 |
#define SWISH_PROP_DOCPATH "swishdocpath" |
|---|
| 96 |
#define SWISH_PROP_DBFILE "swishdbfile" |
|---|
| 97 |
#define SWISH_PROP_TITLE "swishtitle" |
|---|
| 98 |
#define SWISH_PROP_SIZE "swishdocsize" |
|---|
| 99 |
#define SWISH_PROP_MTIME "swishlastmodified" |
|---|
| 100 |
#define SWISH_PROP_DESCRIPTION "swishdescription" |
|---|
| 101 |
#define SWISH_TOKENPOS_BUMPER "\3" |
|---|
| 102 |
#define SWISH_DOT '.' |
|---|
| 103 |
#define SWISH_SPACE ' ' |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
typedef enum { |
|---|
| 107 |
SWISH_META_DEFAULT_ID = 0, |
|---|
| 108 |
SWISH_META_TITLE_ID, |
|---|
| 109 |
SWISH_META_THIS_MUST_COME_LAST_ID |
|---|
| 110 |
} SWISH_META_ID; |
|---|
| 111 |
|
|---|
| 112 |
typedef enum { |
|---|
| 113 |
SWISH_PROP_DOCID_ID = 0, |
|---|
| 114 |
SWISH_PROP_DOCPATH_ID, |
|---|
| 115 |
SWISH_PROP_DBFILE_ID, |
|---|
| 116 |
SWISH_PROP_TITLE_ID, |
|---|
| 117 |
SWISH_PROP_SIZE_ID, |
|---|
| 118 |
SWISH_PROP_MTIME_ID, |
|---|
| 119 |
SWISH_PROP_DESCRIPTION_ID, |
|---|
| 120 |
SWISH_PROP_NWORDS_ID, |
|---|
| 121 |
SWISH_PROP_MIME_ID, |
|---|
| 122 |
SWISH_PROP_PARSER_ID, |
|---|
| 123 |
SWISH_PROP_THIS_MUST_COME_LAST_ID |
|---|
| 124 |
} SWISH_PROP_ID; |
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
#define SWISH_PREFIX_URL "U" |
|---|
| 128 |
#define SWISH_PREFIX_MTIME "T" |
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
#define SWISH_MAX_WORD_LEN 256 |
|---|
| 133 |
#define SWISH_MAX_FILE_LEN 102400000 |
|---|
| 134 |
|
|---|
| 135 |
#if defined(WIN32) && !defined (__CYGWIN__) |
|---|
| 136 |
#define SWISH_PATH_SEP '\\' |
|---|
| 137 |
#define SWISH_EXT_SEP "\\." |
|---|
| 138 |
#else |
|---|
| 139 |
#define SWISH_PATH_SEP "/" |
|---|
| 140 |
#define SWISH_EXT_SEP "/." |
|---|
| 141 |
#endif |
|---|
| 142 |
|
|---|
| 143 |
#define SWISH_EXT_CH '.' |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
#define SWISH_DEFAULT_ENCODING "UTF-8" |
|---|
| 147 |
#define SWISH_LOCALE "en_US.UTF-8" |
|---|
| 148 |
#define SWISH_ENCODING_ERROR 100 |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
typedef enum { |
|---|
| 152 |
SWISH_DEBUG_DOCINFO = 1, |
|---|
| 153 |
SWISH_DEBUG_TOKENIZER = 2, |
|---|
| 154 |
SWISH_DEBUG_TOKENLIST = 4, |
|---|
| 155 |
SWISH_DEBUG_PARSER = 8, |
|---|
| 156 |
SWISH_DEBUG_CONFIG = 16, |
|---|
| 157 |
SWISH_DEBUG_MEMORY = 32, |
|---|
| 158 |
SWISH_DEBUG_NAMEDBUFFER = 64 |
|---|
| 159 |
} SWISH_DEBUG_LEVELS; |
|---|
| 160 |
|
|---|
| 161 |
#define SWISH_DEBUG_MSG(args...) \ |
|---|
| 162 |
swish_debug(__FILE__, __LINE__, __func__, args) |
|---|
| 163 |
|
|---|
| 164 |
#define SWISH_CROAK(args...) \ |
|---|
| 165 |
swish_croak(__FILE__, __LINE__, __func__, args) |
|---|
| 166 |
|
|---|
| 167 |
#define SWISH_WARN(args...) \ |
|---|
| 168 |
swish_warn(__FILE__, __LINE__, __func__, args) |
|---|
| 169 |
|
|---|
| 170 |
#ifdef __cplusplus |
|---|
| 171 |
extern "C" { |
|---|
| 172 |
#endif |
|---|
| 173 |
|
|---|
| 174 |
typedef char boolean; |
|---|
| 175 |
typedef struct swish_3 swish_3; |
|---|
| 176 |
typedef struct swish_StringList swish_StringList; |
|---|
| 177 |
typedef struct swish_Config swish_Config; |
|---|
| 178 |
typedef struct swish_ConfigFlags swish_ConfigFlags; |
|---|
| 179 |
typedef struct swish_ConfigValue swish_ConfigValue; |
|---|
| 180 |
typedef struct swish_DocInfo swish_DocInfo; |
|---|
| 181 |
typedef struct swish_MetaStackElement swish_MetaStackElement; |
|---|
| 182 |
typedef struct swish_MetaStackElement *swish_MetaStackElementPtr; |
|---|
| 183 |
typedef struct swish_MetaStack swish_MetaStack; |
|---|
| 184 |
typedef struct swish_MetaName swish_MetaName; |
|---|
| 185 |
typedef struct swish_Property swish_Property; |
|---|
| 186 |
typedef struct swish_Token swish_Token; |
|---|
| 187 |
typedef struct swish_TokenList swish_TokenList; |
|---|
| 188 |
typedef struct swish_TokenIterator swish_TokenIterator; |
|---|
| 189 |
typedef struct swish_ParserData swish_ParserData; |
|---|
| 190 |
typedef struct swish_Tag swish_Tag; |
|---|
| 191 |
typedef struct swish_TagStack swish_TagStack; |
|---|
| 192 |
typedef struct swish_Analyzer swish_Analyzer; |
|---|
| 193 |
typedef struct swish_Parser swish_Parser; |
|---|
| 194 |
typedef struct swish_NamedBuffer swish_NamedBuffer; |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
struct swish_3 |
|---|
| 201 |
{ |
|---|
| 202 |
int ref_cnt; |
|---|
| 203 |
void *stash; |
|---|
| 204 |
swish_Config *config; |
|---|
| 205 |
swish_Analyzer *analyzer; |
|---|
| 206 |
swish_Parser *parser; |
|---|
| 207 |
}; |
|---|
| 208 |
|
|---|
| 209 |
struct swish_StringList |
|---|
| 210 |
{ |
|---|
| 211 |
int n; |
|---|
| 212 |
xmlChar** word; |
|---|
| 213 |
}; |
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
struct swish_Config |
|---|
| 217 |
{ |
|---|
| 218 |
int ref_cnt; |
|---|
| 219 |
void *stash; |
|---|
| 220 |
xmlHashTablePtr misc; |
|---|
| 221 |
xmlHashTablePtr properties; |
|---|
| 222 |
xmlHashTablePtr metanames; |
|---|
| 223 |
xmlHashTablePtr tag_aliases; |
|---|
| 224 |
xmlHashTablePtr parsers; |
|---|
| 225 |
xmlHashTablePtr mimes; |
|---|
| 226 |
xmlHashTablePtr index; |
|---|
| 227 |
xmlHashTablePtr stringlists; |
|---|
| 228 |
struct swish_ConfigFlags *flags; |
|---|
| 229 |
}; |
|---|
| 230 |
|
|---|
| 231 |
struct swish_ConfigFlags |
|---|
| 232 |
{ |
|---|
| 233 |
boolean tokenize; |
|---|
| 234 |
boolean context_as_meta; |
|---|
| 235 |
xmlHashTablePtr meta_ids; |
|---|
| 236 |
xmlHashTablePtr prop_ids; |
|---|
| 237 |
|
|---|
| 238 |
}; |
|---|
| 239 |
|
|---|
| 240 |
struct swish_NamedBuffer |
|---|
| 241 |
{ |
|---|
| 242 |
int ref_cnt; |
|---|
| 243 |
void *stash; |
|---|
| 244 |
xmlHashTablePtr hash; |
|---|
| 245 |
}; |
|---|
| 246 |
|
|---|
| 247 |
struct swish_DocInfo |
|---|
| 248 |
{ |
|---|
| 249 |
time_t mtime; |
|---|
| 250 |
off_t size; |
|---|
| 251 |
xmlChar * mime; |
|---|
| 252 |
xmlChar * encoding; |
|---|
| 253 |
xmlChar * uri; |
|---|
| 254 |
unsigned int nwords; |
|---|
| 255 |
xmlChar * ext; |
|---|
| 256 |
xmlChar * parser; |
|---|
| 257 |
xmlChar * update; |
|---|
| 258 |
int ref_cnt; |
|---|
| 259 |
}; |
|---|
| 260 |
|
|---|
| 261 |
struct swish_MetaName |
|---|
| 262 |
{ |
|---|
| 263 |
int ref_cnt; |
|---|
| 264 |
int id; |
|---|
| 265 |
xmlChar *name; |
|---|
| 266 |
int bias; |
|---|
| 267 |
xmlChar *alias_for; |
|---|
| 268 |
}; |
|---|
| 269 |
|
|---|
| 270 |
struct swish_Property |
|---|
| 271 |
{ |
|---|
| 272 |
int ref_cnt; |
|---|
| 273 |
int id; |
|---|
| 274 |
xmlChar *name; |
|---|
| 275 |
boolean ignore_case; |
|---|
| 276 |
boolean type; |
|---|
| 277 |
boolean verbatim; |
|---|
| 278 |
xmlChar *alias_for; |
|---|
| 279 |
unsigned int max; |
|---|
| 280 |
boolean sort; |
|---|
| 281 |
}; |
|---|
| 282 |
|
|---|
| 283 |
struct swish_Token |
|---|
| 284 |
{ |
|---|
| 285 |
unsigned int pos; |
|---|
| 286 |
swish_MetaName *meta; |
|---|
| 287 |
xmlChar *value; |
|---|
| 288 |
xmlChar *context; |
|---|
| 289 |
unsigned int len; |
|---|
| 290 |
int ref_cnt; |
|---|
| 291 |
}; |
|---|
| 292 |
|
|---|
| 293 |
struct swish_TokenList |
|---|
| 294 |
{ |
|---|
| 295 |
unsigned int n; |
|---|
| 296 |
unsigned int pos; |
|---|
| 297 |
xmlHashTablePtr contexts; |
|---|
| 298 |
xmlBufferPtr buf; |
|---|
| 299 |
swish_Token** tokens; |
|---|
| 300 |
int ref_cnt; |
|---|
| 301 |
}; |
|---|
| 302 |
|
|---|
| 303 |
struct swish_TokenIterator |
|---|
| 304 |
{ |
|---|
| 305 |
swish_TokenList *tl; |
|---|
| 306 |
swish_Analyzer *a; |
|---|
| 307 |
unsigned int pos; |
|---|
| 308 |
int ref_cnt; |
|---|
| 309 |
}; |
|---|
| 310 |
|
|---|
| 311 |
struct swish_Tag |
|---|
| 312 |
{ |
|---|
| 313 |
xmlChar *raw; |
|---|
| 314 |
xmlChar *baked; |
|---|
| 315 |
xmlChar *context; |
|---|
| 316 |
struct swish_Tag *next; |
|---|
| 317 |
unsigned int n; |
|---|
| 318 |
}; |
|---|
| 319 |
|
|---|
| 320 |
struct swish_TagStack |
|---|
| 321 |
{ |
|---|
| 322 |
swish_Tag *head; |
|---|
| 323 |
swish_Tag *temp; |
|---|
| 324 |
unsigned int count; |
|---|
| 325 |
char *name; |
|---|
| 326 |
}; |
|---|
| 327 |
|
|---|
| 328 |
struct swish_Analyzer |
|---|
| 329 |
{ |
|---|
| 330 |
unsigned int maxwordlen; |
|---|
| 331 |
unsigned int minwordlen; |
|---|
| 332 |
boolean tokenize; |
|---|
| 333 |
int (*tokenizer) (swish_TokenIterator*, xmlChar*, swish_MetaName*, xmlChar*); |
|---|
| 334 |
xmlChar* (*stemmer) (xmlChar*); |
|---|
| 335 |
unsigned int lc; |
|---|
| 336 |
void *stash; |
|---|
| 337 |
void *regex; |
|---|
| 338 |
int ref_cnt; |
|---|
| 339 |
}; |
|---|
| 340 |
|
|---|
| 341 |
struct swish_Parser |
|---|
| 342 |
{ |
|---|
| 343 |
int ref_cnt; |
|---|
| 344 |
void (*handler)(swish_ParserData*); |
|---|
| 345 |
void *stash; |
|---|
| 346 |
}; |
|---|
| 347 |
|
|---|
| 348 |
struct swish_ParserData |
|---|
| 349 |
{ |
|---|
| 350 |
swish_3 *s3; |
|---|
| 351 |
xmlBufferPtr meta_buf; |
|---|
| 352 |
xmlBufferPtr prop_buf; |
|---|
| 353 |
xmlChar *tag; |
|---|
| 354 |
swish_DocInfo *docinfo; |
|---|
| 355 |
boolean no_index; |
|---|
| 356 |
boolean is_html; |
|---|
| 357 |
boolean bump_word; |
|---|
| 358 |
unsigned int offset; |
|---|
| 359 |
swish_TagStack *metastack; |
|---|
| 360 |
swish_TagStack *propstack; |
|---|
| 361 |
swish_TagStack *domstack; |
|---|
| 362 |
xmlParserCtxtPtr ctxt; |
|---|
| 363 |
swish_TokenIterator *token_iterator; |
|---|
| 364 |
swish_NamedBuffer *properties; |
|---|
| 365 |
swish_NamedBuffer *metanames; |
|---|
| 366 |
}; |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
void swish_init(); |
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
swish_3 * swish_init_swish3( void (*handler) (swish_ParserData *), void *stash ); |
|---|
| 384 |
void swish_free_swish3( swish_3 *s3 ); |
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
xmlChar * swish_slurp_fh( FILE * fh, long flen ); |
|---|
| 393 |
xmlChar * swish_slurp_file_len( xmlChar *filename, long flen ); |
|---|
| 394 |
xmlChar * swish_slurp_file( xmlChar *filename ); |
|---|
| 395 |
boolean swish_file_exists( xmlChar *filename ); |
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
int swish_hash_add( xmlHashTablePtr hash, xmlChar *key, void * value ); |
|---|
| 405 |
int swish_hash_replace( xmlHashTablePtr hash, xmlChar *key, void *value ); |
|---|
| 406 |
int swish_hash_delete( xmlHashTablePtr hash, xmlChar *key ); |
|---|
| 407 |
boolean swish_hash_exists( xmlHashTablePtr hash, xmlChar *key ); |
|---|
| 408 |
int swish_hash_exists_or_add( xmlHashTablePtr hash, xmlChar *key, xmlChar *value ); |
|---|
| 409 |
void swish_hash_merge( xmlHashTablePtr hash1, xmlHashTablePtr hash2 ); |
|---|
| 410 |
void * swish_hash_fetch( xmlHashTablePtr hash, xmlChar *key ); |
|---|
| 411 |
xmlHashTablePtr swish_init_hash(int size); |
|---|
| 412 |
void swish_hash_free( xmlHashTablePtr hash ); |
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
void swish_init_memory(); |
|---|
| 421 |
void * swish_xrealloc(void *ptr, size_t size); |
|---|
| 422 |
void * swish_xmalloc( size_t size ); |
|---|
| 423 |
void swish_xfree( void *ptr ); |
|---|
| 424 |
void swish_mem_debug(); |
|---|
| 425 |
long int swish_get_memcount(); |
|---|
| 426 |
xmlChar * swish_xstrdup( const xmlChar * ptr ); |
|---|
| 427 |
xmlChar * swish_xstrndup( const xmlChar * ptr, int len ); |
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
double swish_time_elapsed(void); |
|---|
| 436 |
double swish_time_cpu(void); |
|---|
| 437 |
char * swish_print_time(double time); |
|---|
| 438 |
char * swish_print_fine_time(double time); |
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
void swish_set_error_handle( FILE *where ); |
|---|
| 447 |
void swish_croak(const char *file, int line, const char *func, char *msg,...); |
|---|
| 448 |
void swish_warn(const char *file, int line, const char *func, char *msg,...); |
|---|
| 449 |
void swish_debug(const char *file, int line, const char *func, char *msg,...); |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
void swish_verify_utf8_locale(); |
|---|
| 458 |
boolean swish_is_ascii( xmlChar *str ); |
|---|
| 459 |
int swish_bytes_in_wchar( int wchar ); |
|---|
| 460 |
int swish_utf8_chr_len( xmlChar *utf8 ); |
|---|
| 461 |
int swish_utf8_codepoint( xmlChar *utf8 ); |
|---|
| 462 |
int swish_utf8_num_chrs( xmlChar *utf8 ); |
|---|
| 463 |
void swish_utf8_next_chr( xmlChar *s, int *i ); |
|---|
| 464 |
void swish_utf8_prev_chr( xmlChar *s, int *i ); |
|---|
| 465 |
wchar_t * swish_locale_to_wchar(xmlChar * str); |
|---|
| 466 |
xmlChar * swish_wchar_to_locale(wchar_t * str); |
|---|
| 467 |
wchar_t * swish_wstr_tolower(wchar_t *s); |
|---|
| 468 |
xmlChar * swish_str_tolower(xmlChar *s ); |
|---|
| 469 |
xmlChar * swish_utf8_str_tolower(xmlChar *s); |
|---|
| 470 |
xmlChar * swish_ascii_str_tolower(xmlChar *s); |
|---|
| 471 |
xmlChar * swish_str_skip_ws(xmlChar *s); |
|---|
| 472 |
void swish_str_trim_ws(xmlChar *string); |
|---|
| 473 |
boolean swish_str_all_ws(xmlChar * s); |
|---|
| 474 |
boolean swish_str_all_ws_len(xmlChar * s, int len); |
|---|
| 475 |
void swish_debug_wchars( const wchar_t * widechars ); |
|---|
| 476 |
int swish_wchar_t_comp(const void *s1, const void *s2); |
|---|
| 477 |
int swish_sort_wchar(wchar_t *s); |
|---|
| 478 |
swish_StringList * swish_make_stringlist(xmlChar * line); |
|---|
| 479 |
swish_StringList * swish_init_stringlist(); |
|---|
| 480 |
void swish_free_stringlist(swish_StringList *sl); |
|---|
| 481 |
void swish_merge_stringlists(swish_StringList *sl1, swish_StringList *sl2); |
|---|
| 482 |
swish_StringList * swish_copy_stringlist(swish_StringList *sl); |
|---|
| 483 |
int swish_string_to_int( char *buf ); |
|---|
| 484 |
xmlChar * swish_int_to_string( int val ); |
|---|
| 485 |
xmlChar * swish_long_to_string( long val ); |
|---|
| 486 |
xmlChar * swish_double_to_string( double val ); |
|---|
| 487 |
xmlChar * swish_date_to_string( int y, int m, int d ); |
|---|
| 488 |
|
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 |
swish_Config * swish_init_config(); |
|---|
| 497 |
void swish_config_set_default( swish_Config *config ); |
|---|
| 498 |
void swish_config_merge(swish_Config *config1, swish_Config *config2); |
|---|
| 499 |
swish_Config * swish_add_config( xmlChar * conf, swish_Config * config ); |
|---|
| 500 |
swish_Config * swish_parse_config( xmlChar * conf, swish_Config * config ); |
|---|
| 501 |
void swish_debug_config( swish_Config * config ); |
|---|
| 502 |
void swish_free_config(swish_Config * config); |
|---|
| 503 |
xmlHashTablePtr swish_mime_hash(); |
|---|
| 504 |
xmlChar * swish_get_mime_type( swish_Config * config, xmlChar * fileext ); |
|---|
| 505 |
xmlChar * swish_get_parser( swish_Config * config, xmlChar *mime ); |
|---|
| 506 |
void swish_config_test_alias_fors( swish_Config *c ); |
|---|
| 507 |
swish_ConfigFlags * swish_init_config_flags(); |
|---|
| 508 |
void swish_free_config_flags( swish_ConfigFlags *flags ); |
|---|
| 509 |
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 |
|
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
swish_Parser * swish_init_parser( void (*handler) (swish_ParserData *) ); |
|---|
| 517 |
void swish_free_parser( swish_Parser * parser ); |
|---|
| 518 |
int swish_parse_file( swish_3 * s3, |
|---|
| 519 |
xmlChar *filename); |
|---|
| 520 |
int swish_parse_fh( swish_3 * s3, |
|---|
| 521 |
FILE * fh); |
|---|
| 522 |
int swish_parse_buffer( swish_3 * s3, |
|---|
| 523 |
xmlChar * buf); |
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
swish_TokenList * swish_init_token_list(); |
|---|
| 532 |
void swish_free_token_list( swish_TokenList *tl ); |
|---|
| 533 |
int swish_add_token( swish_TokenList *tl, |
|---|
| 534 |
xmlChar *token, |
|---|
| 535 |
int token_len, |
|---|
| 536 |
swish_MetaName *meta, |
|---|
| 537 |
xmlChar *context ); |
|---|
| 538 |
int swish_set_token_value( |
|---|
| 539 |
swish_TokenList *tl, |
|---|
| 540 |
xmlChar *token, |
|---|
| 541 |
int len ); |
|---|
| 542 |
swish_Token * swish_init_token(); |
|---|
| 543 |
void swish_free_token( swish_Token *t ); |
|---|
| 544 |
swish_TokenIterator *swish_init_token_iterator( swish_Analyzer *a ); |
|---|
| 545 |
void swish_free_token_iterator( swish_TokenIterator *ti ); |
|---|
| 546 |
swish_Token * swish_next_token( swish_TokenIterator *it ); |
|---|
| 547 |
int swish_tokenize3( swish_TokenIterator *ti, |
|---|
| 548 |
xmlChar *buf, |
|---|
| 549 |
swish_MetaName *meta, |
|---|
| 550 |
xmlChar *context ); |
|---|
| 551 |
int swish_tokenize3_ascii( |
|---|
| 552 |
swish_TokenIterator *ti, |
|---|
| 553 |
xmlChar *buf, |
|---|
| 554 |
swish_MetaName *meta, |
|---|
| 555 |
xmlChar *context ); |
|---|
| 556 |
int swish_tokenize3_utf8( |
|---|
| 557 |
swish_TokenIterator *ti, |
|---|
| 558 |
xmlChar *buf, |
|---|
| 559 |
swish_MetaName *meta, |
|---|
| 560 |
xmlChar *context ); |
|---|
| 561 |
void swish_debug_token_list( swish_TokenIterator *it ); |
|---|
| 562 |
void swish_debug_token( swish_Token *t ); |
|---|
| 563 |
|
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 |
|
|---|
| 569 |
|
|---|
| 570 |
|
|---|
| 571 |
swish_Analyzer * swish_init_analyzer( swish_Config * config ); |
|---|
| 572 |
void swish_free_analyzer( swish_Analyzer * analyzer ); |
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
|
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 |
swish_DocInfo * swish_init_docinfo(); |
|---|
| 581 |
void swish_free_docinfo( swish_DocInfo * ptr ); |
|---|
| 582 |
int swish_check_docinfo(swish_DocInfo * docinfo, swish_Config * config); |
|---|
| 583 |
int swish_docinfo_from_filesystem( xmlChar *filename, |
|---|
| 584 |
swish_DocInfo * i, |
|---|
| 585 |
swish_ParserData *parser_data ); |
|---|
| 586 |
void swish_debug_docinfo( swish_DocInfo * docinfo ); |
|---|
| 587 |
xmlChar * swish_get_file_ext( xmlChar *url ); |
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 |
|
|---|
| 595 |
swish_NamedBuffer * swish_init_nb( xmlHashTablePtr confhash ); |
|---|
| 596 |
void swish_free_nb( swish_NamedBuffer * nb ); |
|---|
| 597 |
void swish_debug_nb( swish_NamedBuffer * nb, xmlChar * label ); |
|---|
| 598 |
void swish_add_buf_to_nb( swish_NamedBuffer *nb, |
|---|
| 599 |
xmlChar * name, |
|---|
| 600 |
xmlBufferPtr buf, |
|---|
| 601 |
xmlChar * joiner, |
|---|
| 602 |
boolean cleanwsp, |
|---|
| 603 |
boolean autovivify); |
|---|
| 604 |
void swish_add_str_to_nb( swish_NamedBuffer * nb, |
|---|
| 605 |
xmlChar * name, |
|---|
| 606 |
xmlChar * str, |
|---|
| 607 |
unsigned int len, |
|---|
| 608 |
xmlChar * joiner, |
|---|
| 609 |
boolean cleanwsp, |
|---|
| 610 |
boolean autovivify); |
|---|
| 611 |
void swish_append_buffer( xmlBufferPtr buf, xmlChar * txt, int len ); |
|---|
| 612 |
xmlChar* swish_nb_get_value( swish_NamedBuffer* nb, xmlChar* key ); |
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
|
|---|
| 620 |
swish_Property * swish_init_property( xmlChar *name ); |
|---|
| 621 |
void swish_free_property( swish_Property *prop ); |
|---|
| 622 |
void swish_debug_property( swish_Property *prop ); |
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
|
|---|
| 627 |
|
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
swish_MetaName * swish_init_metaname( xmlChar *name); |
|---|
| 631 |
void swish_free_metaname( swish_MetaName *m ); |
|---|
| 632 |
void swish_debug_metaname( swish_MetaName *m ); |
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 |
|
|---|
| 636 |
|
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 |
boolean swish_validate_header(char *filename); |
|---|
| 641 |
boolean swish_merge_config_with_header(char *filename, swish_Config *c); |
|---|
| 642 |
swish_Config * swish_read_header(char *filename); |
|---|
| 643 |
void swish_write_header(char* filename, swish_Config* config); |
|---|
| 644 |
void swish_config_test_alias_fors(swish_Config *config); |
|---|
| 645 |
void swish_config_test_unique_ids(swish_Config *config); |
|---|
| 646 |
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 |
|
|---|
| 650 |
|
|---|
| 651 |
#ifdef __cplusplus |
|---|
| 652 |
} |
|---|
| 653 |
#endif |
|---|
| 654 |
#endif |
|---|