Changeset 2116
- Timestamp:
- 04/12/08 00:00:40 (1 month ago)
- Files:
-
- libswish3/trunk/src/Makefile.am (modified) (1 diff)
- libswish3/trunk/src/libswish3/docinfo.c (modified) (5 diffs)
- libswish3/trunk/src/libswish3/mime_types.c (modified) (1 diff)
- libswish3/trunk/src/libswish3/namedbuffer.c (modified) (7 diffs)
- libswish3/trunk/src/libswish3/parser.c (modified) (2 diffs)
- libswish3/trunk/src/libswish3/string.c (modified) (5 diffs)
- libswish3/trunk/src/swish_lint.c (modified) (2 diffs)
- libswish3/trunk/src/t (added)
- libswish3/trunk/src/t/001-wordcount.t (added)
- libswish3/trunk/src/t/002-header.t (added)
- libswish3/trunk/src/t/003-properties.t (added)
- libswish3/trunk/src/t/004-metanames.t (added)
- libswish3/trunk/src/t/SwishTestUtils.pm (added)
- libswish3/trunk/src/test.pl (deleted)
- libswish3/trunk/src/test.sh (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libswish3/trunk/src/Makefile.am
r2090 r2116 19 19 utf8test_SOURCES = utf8test.c $(myheaders) 20 20 21 TESTS = $(check_PROGRAMS) test. pl21 TESTS = $(check_PROGRAMS) test.sh 22 22 23 23 test: check libswish3/trunk/src/libswish3/docinfo.c
r2103 r2116 40 40 { 41 41 42 if (SWISH_DEBUG > 9)42 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) 43 43 SWISH_DEBUG_MSG("init'ing docinfo"); 44 44 … … 55 55 docinfo->update = NULL; 56 56 57 if (SWISH_DEBUG > 9) {57 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) { 58 58 SWISH_DEBUG_MSG("docinfo all ready"); 59 59 swish_debug_docinfo(docinfo); … … 212 212 } 213 213 214 if (SWISH_DEBUG > 9)214 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) 215 215 SWISH_DEBUG_MSG("handling url %s", filename); 216 216 … … 222 222 i->size = info.st_size; 223 223 224 if (SWISH_DEBUG > 9)224 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) 225 225 SWISH_DEBUG_MSG("handling mime"); 226 226 … … 230 230 i->mime = swish_get_mime_type(parser_data->s3->config, i->ext); 231 231 232 if (SWISH_DEBUG > 9)232 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) 233 233 SWISH_DEBUG_MSG("handling parser"); 234 234 libswish3/trunk/src/libswish3/mime_types.c
r2103 r2116 238 238 parser = swish_hash_fetch(config->parsers, mime); 239 239 240 if (SWISH_DEBUG > 9)240 if (SWISH_DEBUG & SWISH_DEBUG_DOCINFO) 241 241 SWISH_DEBUG_MSG("using parser '%s' based on MIME '%s'", parser, mime); 242 242 libswish3/trunk/src/libswish3/namedbuffer.c
r2103 r2116 61 61 SWISH_DEBUG_MSG(" adding %s to NamedBuffer\n", name); 62 62 63 swish_hash_add(nbhash, name, 64 xmlBufferCreateSize((size_t) SWISH_BUFFER_CHUNK_SIZE)); 63 swish_hash_add(nbhash, name, xmlBufferCreateSize((size_t) SWISH_BUFFER_CHUNK_SIZE)); 65 64 } 66 65 … … 88 87 89 88 /* init a buffer for each key in confhash */ 90 xmlHashScan(confhash, (xmlHashScanner) add_name_to_hash, nb->hash);89 xmlHashScan(confhash, (xmlHashScanner)add_name_to_hash, nb->hash); 91 90 92 91 return nb; … … 98 97 ) 99 98 { 100 xmlHashFree(nb->hash, (xmlHashDeallocator) free_name_from_hash);99 xmlHashFree(nb->hash, (xmlHashDeallocator)free_name_from_hash); 101 100 102 101 if (nb->ref_cnt != 0) { … … 117 116 ) 118 117 { 119 SWISH_DEBUG_MSG("%s:\n<%s>%s</%s>", label, name, xmlBufferContent(buffer), 120 name); 118 const xmlChar *substr; 119 const xmlChar *buf; 120 int sub_len; 121 122 SWISH_DEBUG_MSG("%d %s:\n<%s>%s</%s>", xmlBufferLength(buffer), 123 label, name, xmlBufferContent(buffer), name); 124 125 buf = xmlBufferContent(buffer); 126 while ((substr = xmlStrstr(buf, (const xmlChar *)SWISH_META_CONNECTOR)) != NULL) { 127 sub_len = substr - buf; 128 SWISH_DEBUG_MSG("%d <%s> substr: %s", sub_len, name, xmlStrsub(buf, 0, sub_len) ); 129 buf = substr + 2; 130 } 131 if (buf != NULL) { 132 SWISH_DEBUG_MSG("%d <%s> substr: %s", xmlStrlen(buf), name, buf ); 133 } 121 134 } 122 135 … … 127 140 ) 128 141 { 129 xmlHashScan(nb->hash, (xmlHashScanner) print_buffer, label);142 xmlHashScan(nb->hash, (xmlHashScanner)print_buffer, label); 130 143 } 131 144 … … 140 153 ) 141 154 { 142 swish_add_str_to_nb(nb, name, (xmlChar *)xmlBufferContent(buf), 143 xmlBufferLength(buf),joiner, cleanwsp, autovivify);155 swish_add_str_to_nb(nb, name, (xmlChar *)xmlBufferContent(buf), xmlBufferLength(buf), 156 joiner, cleanwsp, autovivify); 144 157 } 145 158 … … 208 221 ret = xmlBufferAdd(buf, (const xmlChar *)txt, txtlen); 209 222 if (ret) { 210 SWISH_CROAK("problem adding \n>>%s<<\n length %d to buffer. Err: %d", 211 txt, txtlen, ret); 212 } 213 223 SWISH_CROAK("problem adding \n>>%s<<\n length %d to buffer. Err: %d", txt, txtlen, 224 ret); 225 } 214 226 } 215 227 libswish3/trunk/src/libswish3/parser.c
r2108 r2116 891 891 } 892 892 893 if (SWISH_DEBUG )893 if (SWISH_DEBUG & SWISH_DEBUG_PARSER) 894 894 SWISH_DEBUG_MSG("%s -- using %s parser", parser_data->docinfo->uri, 895 895 parser); … … 1728 1728 free_parser_data(parser_data); 1729 1729 1730 if (SWISH_DEBUG ) {1730 if (SWISH_DEBUG & SWISH_DEBUG_PARSER) { 1731 1731 etime = swish_print_fine_time(swish_time_elapsed() - curTime); 1732 1732 SWISH_DEBUG_MSG("%s elapsed time", etime); libswish3/trunk/src/libswish3/string.c
r2110 r2116 225 225 if (enc != NULL) { 226 226 enc++; 227 if (SWISH_DEBUG )227 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 228 228 SWISH_DEBUG_MSG("encoding = %s", enc); 229 229 } 230 230 else { 231 if (SWISH_DEBUG )231 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 232 232 SWISH_DEBUG_MSG("no encoding in %s, using %s", loc, SWISH_DEFAULT_ENCODING); 233 233 … … 256 256 } 257 257 258 if (SWISH_DEBUG )258 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 259 259 SWISH_DEBUG_MSG("locale set to %s", loc); 260 260 … … 676 676 */ 677 677 678 if (SWISH_DEBUG > 10)678 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 679 679 SWISH_DEBUG_MSG("parsing url %s for extension", url); 680 680 681 681 p = findlast(url, (xmlChar *)SWISH_EXT_SEP); /* look for . or / */ 682 682 683 if (SWISH_DEBUG > 10)683 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 684 684 SWISH_DEBUG_MSG("p = %s", p); 685 685 … … 690 690 return NULL; /* ... if not, ignore / */ 691 691 692 if (SWISH_DEBUG > 10)692 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 693 693 SWISH_DEBUG_MSG("p = %s", p); 694 694 … … 696 696 p++; /* skip to next char after . */ 697 697 698 if (SWISH_DEBUG > 10)698 if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER) 699 699 SWISH_DEBUG_MSG("ext is %s", p); 700 700 libswish3/trunk/src/swish_lint.c
r2105 r2116 99 99 printf("nwords: %d\n", parser_data->docinfo->nwords); 100 100 101 if (SWISH_DEBUG )101 if (SWISH_DEBUG & SWISH_DEBUG_MEMORY) 102 102 swish_mem_debug(); 103 103 … … 195 195 } 196 196 197 if (SWISH_DEBUG == 20) {197 if (SWISH_DEBUG & SWISH_DEBUG_CONFIG) { 198 198 swish_debug_config(s3->config); 199 199 }
