Show
Ignore:
Timestamp:
02/03/08 23:29:35 (10 months ago)
Author:
karpet
Message:

rename some vars for clarity

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libswish3/trunk/src/libswish3/libswish3.h

    r1955 r2009  
    5050 
    5151/* default config hash key names */ 
    52 #define SWISH_INCLUDE_FILE   "IncludeConfigFile" 
    53 #define SWISH_PROP           "PropertyNames" 
    54 #define SWISH_PROP_ASIS      "nostripchars" 
    55 #define SWISH_PROP_MAX       "PropertyNamesMaxLength" 
    56 #define SWISH_PROP_SORT      "PropertyNamesSortKeyLength" 
    57 #define SWISH_META           "MetaNames" 
    58 #define SWISH_MIME           "MIME" 
    59 #define SWISH_PARSERS        "Parsers" 
    60 #define SWISH_INDEX          "Index" 
    61 #define SWISH_ALIAS          "TagAlias" 
    62 #define SWISH_WORDS          "Words" 
    63 #define SWISH_DEFAULT_PARSER "default" 
    64 #define SWISH_PARSER_TXT     "TXT" 
    65 #define SWISH_PARSER_XML     "XML" 
    66 #define SWISH_PARSER_HTML    "HTML" 
    67 #define SWISH_DEFAULT_PARSER_TYPE      "HTML" 
    68 #define SWISH_INDEX_FORMAT   "Format" 
    69 #define SWISH_INDEX_NAME     "Name" 
    70 #define SWISH_INDEX_LOCALE   "Locale" 
    71 #define SWISH_DEFAULT_VALUE  "1" 
    72 #define SWISH_PARSE_WORDS    "Tokenize" 
     52#define SWISH_INCLUDE_FILE          "IncludeConfigFile" 
     53#define SWISH_PROP                  "PropertyNames" 
     54#define SWISH_PROP_ASIS             "nostripchars" 
     55#define SWISH_PROP_MAX              "PropertyNamesMaxLength" 
     56#define SWISH_PROP_SORT             "PropertyNamesSortKeyLength" 
     57#define SWISH_META                  "MetaNames" 
     58#define SWISH_MIME                  "MIME" 
     59#define SWISH_PARSERS               "Parsers" 
     60#define SWISH_INDEX                 "Index" 
     61#define SWISH_ALIAS                 "TagAlias" 
     62#define SWISH_WORDS                 "Words" 
     63#define SWISH_DEFAULT_PARSER        "default" 
     64#define SWISH_PARSER_TXT            "TXT" 
     65#define SWISH_PARSER_XML            "XML" 
     66#define SWISH_PARSER_HTML           "HTML" 
     67#define SWISH_DEFAULT_PARSER_TYPE   "HTML" 
     68#define SWISH_INDEX_FORMAT          "Format" 
     69#define SWISH_INDEX_NAME            "Name" 
     70#define SWISH_INDEX_LOCALE          "Locale" 
     71#define SWISH_DEFAULT_VALUE         "1" 
     72#define SWISH_PARSE_WORDS           "Tokenize" 
    7373 
    7474/* tags */ 
     
    154154typedef struct swish_MetaStackElement  *swish_MetaStackElementPtr; 
    155155typedef struct swish_MetaStack          swish_MetaStack; 
     156typedef struct swish_MetaName           swish_MetaName; 
     157typedef struct swish_Property           swish_Property; 
    156158typedef struct swish_Word               swish_Word; 
    157159typedef struct swish_WordList           swish_WordList; 
     
    176178struct swish_Config 
    177179{ 
    178     int                          ref_cnt;    /* for scripting languages */ 
    179     void                        *stash;      /* for scripting languages */ 
     180    int                          ref_cnt;    /* for bindings */ 
     181    void                        *stash;      /* for bindings */ 
    180182    xmlHashTablePtr              conf;       /* the meat */ 
    181183    struct swish_ConfigFlags    *flags;      /* shortcuts for parsing */ 
     
    200202struct swish_NamedBuffer 
    201203{ 
    202     int             ref_cnt;    /* for scripting languages */ 
    203     void           *stash;      /* for scripting languages */ 
     204    int             ref_cnt;    /* for bindings */ 
     205    void           *stash;      /* for bindings */ 
    204206    xmlHashTablePtr hash;       /* the meat */ 
    205207}; 
     
    218220}; 
    219221 
     222struct swish_MetaName 
     223{ 
     224    unsigned int        id; 
     225    xmlChar            *name; 
     226    int                 bias; 
     227}; 
     228 
     229struct swish_Property 
     230{ 
     231    unsigned int        id; 
     232    xmlChar            *name; 
     233}; 
    220234 
    221235struct swish_Word 
    222236{ 
    223     unsigned int        position;      // word position in doc 
    224     xmlChar            *metaname;      // immediate metaname 
    225     xmlChar            *context;       // metaname ancestry 
    226     xmlChar            *word;          // the word itself (NOTE stored as multibyte not wchar) 
    227     unsigned int        start_offset;  // start byte 
    228     unsigned int        end_offset;    // end byte    
     237    unsigned int        position;      // word position in doc 
     238    xmlChar            *metaname;      // immediate metaname 
     239    xmlChar            *context;       // metaname ancestry 
     240    xmlChar            *word;          // the word itself (NOTE stored as multibyte not wchar) 
     241    unsigned int        start_offset;  // start byte 
     242    unsigned int        end_offset;    // end byte    
    229243    struct swish_Word  *next;          // pointer to next swish_Word 
    230244    struct swish_Word  *prev;          // pointer to prev swish_Word 
     
    233247struct swish_WordList 
    234248{ 
    235     swish_Word    *head; 
    236     swish_Word    *tail; 
    237     swish_Word    *current;        // for iterating 
    238     unsigned int   nwords; 
    239     unsigned int   ref_cnt;        // for scripting language
     249    swish_Word         *head; 
     250    swish_Word         *tail; 
     251    swish_Word         *current;        // for iterating 
     252    unsigned int        nwords; 
     253    unsigned int        ref_cnt;        // for binding
    240254}; 
    241255 
     
    281295struct swish_ParseData 
    282296{ 
    283     xmlBufferPtr           buf_ptr;            // tmp text (MetaName) buffer 
     297    xmlBufferPtr           meta_buf;           // tmp MetaName buffer 
    284298    xmlBufferPtr           prop_buf;           // tmp Property buffer 
    285299    xmlChar               *tag;                // current tag name 
  • libswish3/trunk/src/libswish3/parser.c

    r1952 r2009  
    316316    if (SWISH_DEBUG == SWISH_DEBUG_PARSER) 
    317317        SWISH_DEBUG_MSG("buffer is >>%s<< before flush, word_pos = %d",  
    318             xmlBufferContent(parse_data->buf_ptr), parse_data->word_pos); 
     318            xmlBufferContent(parse_data->meta_buf), parse_data->word_pos); 
    319319 
    320320    /* since we only flush the buffer when metaname changes, and 
     
    325325        parse_data->word_pos++; 
    326326         
    327     /* add buf_ptr as-is to metanames buffer under current tag. 
     327    /* add meta_buf as-is to metanames buffer under current tag. 
    328328       this gives us both tokens and raw text de-tagged but organized by metaname. 
    329329    */ 
    330330    swish_add_buf_to_nb( parse_data->metanames, 
    331331                         metaname, 
    332                          parse_data->buf_ptr, (xmlChar*)SWISH_META_CONNECTOR, 0, 1); 
     332                         parse_data->meta_buf,  
     333                         (xmlChar*)SWISH_META_CONNECTOR,  
     334                         0,  
     335                         1); 
    333336                          
    334337    if (parse_data->context_as_meta) 
     
    341344            swish_add_buf_to_nb(parse_data->metanames, 
    342345                                s->temp->name,  
    343                                 parse_data->buf_ptr, (xmlChar*)SWISH_META_CONNECTOR, 0, 1); 
     346                                parse_data->meta_buf,  
     347                                (xmlChar*)SWISH_META_CONNECTOR,  
     348                                0,  
     349                                1); 
    344350        } 
    345351    }                     
     
    349355 
    350356        tokenize(   parse_data,  
    351                     (xmlChar *)xmlBufferContent(parse_data->buf_ptr),  
    352                     xmlBufferLength(parse_data->buf_ptr), 
     357                    (xmlChar *)xmlBufferContent(parse_data->meta_buf),  
     358                    xmlBufferLength(parse_data->meta_buf), 
    353359                    metaname, 
    354360                    context 
     
    356362    } 
    357363 
    358     xmlBufferEmpty(parse_data->buf_ptr); 
     364    xmlBufferEmpty(parse_data->meta_buf); 
    359365 
    360366} 
     
    517523    int             i; 
    518524    xmlChar         output[len]; 
    519     xmlBufferPtr    buf = parse_data->buf_ptr
     525    xmlBufferPtr    buf = parse_data->meta_buf
    520526    /* 
    521527     * why not wchar_t ? len is number of bytes, not number of 
     
    740746    ptr->stash = stash; 
    741747     
    742     ptr->buf_ptr = xmlBufferCreateSize(SWISH_BUFFER_CHUNK_SIZE); 
     748    ptr->meta_buf = xmlBufferCreateSize(SWISH_BUFFER_CHUNK_SIZE); 
    743749    ptr->prop_buf = xmlBufferCreateSize(SWISH_BUFFER_CHUNK_SIZE); 
    744750     
     
    849855        SWISH_DEBUG_MSG("freeing swish_ParseData xmlBuffer"); 
    850856 
    851     xmlBufferFree( ptr->buf_ptr ); 
     857    xmlBufferFree( ptr->meta_buf ); 
    852858 
    853859 
     
    12711277                swish_debug_docinfo(parse_data->docinfo); 
    12721278                SWISH_DEBUG_MSG("  word buffer length: %d bytes",  
    1273                                     xmlBufferLength(parse_data->buf_ptr)); 
     1279                                    xmlBufferLength(parse_data->meta_buf)); 
    12741280                SWISH_DEBUG_MSG(" (%d words)", parse_data->docinfo->nwords); 
    12751281            } 
     
    14021408        swish_debug_docinfo(parse_data->docinfo); 
    14031409        SWISH_DEBUG_MSG("  word buffer length: %d bytes",  
    1404                         xmlBufferLength(parse_data->buf_ptr)); 
     1410                        xmlBufferLength(parse_data->meta_buf)); 
    14051411        SWISH_DEBUG_MSG(" (%d words)", parse_data->docinfo->nwords); 
    14061412    } 
     
    14541460        swish_debug_docinfo(parse_data->docinfo); 
    14551461        SWISH_DEBUG_MSG("  word buffer length: %d bytes",  
    1456                             xmlBufferLength(parse_data->buf_ptr)); 
     1462                            xmlBufferLength(parse_data->meta_buf)); 
    14571463        SWISH_DEBUG_MSG(" (%d words)", parse_data->docinfo->nwords); 
    14581464    }