ccl.h File Reference

Header with public definitions for CCL. More...

#include <yaz/yconfig.h>
#include <stdio.h>
#include <yaz/xmalloc.h>
#include <yaz/wrbuf.h>

Go to the source code of this file.

Data Structures

struct  ccl_rpn_attr
 attribute node (type, value) pair as used in RPN More...
struct  ccl_rpn_node
 RPN tree structure node. More...

Defines

#define CCL_ERR_OK   0
#define CCL_ERR_TERM_EXPECTED   1
#define CCL_ERR_RP_EXPECTED   2
#define CCL_ERR_SETNAME_EXPECTED   3
#define CCL_ERR_OP_EXPECTED   4
#define CCL_ERR_BAD_RP   5
#define CCL_ERR_UNKNOWN_QUAL   6
#define CCL_ERR_DOUBLE_QUAL   7
#define CCL_ERR_EQ_EXPECTED   8
#define CCL_ERR_BAD_RELATION   9
#define CCL_ERR_TRUNC_NOT_LEFT   10
#define CCL_ERR_TRUNC_NOT_BOTH   11
#define CCL_ERR_TRUNC_NOT_RIGHT   12
#define CCL_RPN_ATTR_NUMERIC   1
#define CCL_RPN_ATTR_STRING   2
#define ccl_assert(x)   ;
#define CCL_BIB1_USE   1
 common attributes
#define CCL_BIB1_REL   2
#define CCL_BIB1_POS   3
#define CCL_BIB1_STR   4
#define CCL_BIB1_TRU   5
#define CCL_BIB1_COM   6
#define CCL_BIB1_STR_WP   (-1)
#define CCL_BIB1_STR_AND_LIST   (-2)
#define CCL_BIB1_STR_OR_LIST   (-3)
#define CCL_BIB1_REL_ORDER   (-1)
#define CCL_BIB1_REL_PORDER   (-2)
#define CCL_BIB1_TRU_CAN_LEFT   (-1)
#define CCL_BIB1_TRU_CAN_RIGHT   (-2)
#define CCL_BIB1_TRU_CAN_BOTH   (-3)
#define CCL_BIB1_TRU_CAN_NONE   (-4)

Typedefs

typedef struct ccl_qualifiersCCL_bibset
 CCL bibset, AKA profile.
typedef struct ccl_parserCCL_parser
 CCL parser.
typedef struct ccl_stop_wordsccl_stop_words_t
 stop words handle (pimpl)

Enumerations

enum  ccl_rpn_kind {
  CCL_RPN_AND, CCL_RPN_OR, CCL_RPN_NOT, CCL_RPN_TERM,
  CCL_RPN_SET, CCL_RPN_PROX
}
 node type or RPN tree generated by the CCL parser More...

Functions

struct ccl_rpn_nodeccl_find_str (CCL_bibset bibset, const char *str, int *error, int *pos)
 parse CCL find string using CCL profile return RPN tree
struct ccl_rpn_nodeccl_parser_find_str (CCL_parser cclp, const char *str)
 parse CCL find string with parser and return RPN tree
void ccl_parser_set_case (CCL_parser p, int case_sensitivity_flag)
const char * ccl_err_msg (int ccl_errno)
void ccl_rpn_delete (struct ccl_rpn_node *rpn)
void ccl_pr_tree (struct ccl_rpn_node *rpn, FILE *fd_out)
void ccl_qual_add (CCL_bibset b, const char *name, int no, int *attr)
void ccl_qual_add_set (CCL_bibset b, const char *name, int no, int *type, int *value, char **svalue, char **attsets)
 adds specifies attributes for qualifier
void ccl_qual_add_special (CCL_bibset bibset, const char *n, const char *cp)
void ccl_qual_add_combi (CCL_bibset b, const char *n, const char **names)
 adds specifies qualifier aliases
void ccl_qual_file (CCL_bibset bibset, FILE *inf)
int ccl_qual_fname (CCL_bibset bibset, const char *fname)
void ccl_qual_buf (CCL_bibset bibset, const char *buf)
void ccl_qual_line (CCL_bibset bibset, char *line)
void ccl_qual_fitem (CCL_bibset bibset, const char *value, const char *qual_name)
CCL_bibset ccl_qual_mk (void)
 creates Bibset
void ccl_qual_rm (CCL_bibset *b)
 destroys Bibset
int ccl_stricmp (const char *s1, const char *s2)
int ccl_memicmp (const char *s1, const char *s2, size_t n)
CCL_parser ccl_parser_create (CCL_bibset bibset)
void ccl_parser_destroy (CCL_parser p)
const char ** ccl_qual_search_special (CCL_bibset b, const char *name)
void ccl_pquery (WRBUF w, struct ccl_rpn_node *p)
int ccl_parser_get_error (CCL_parser cclp, int *pos)
struct ccl_rpn_nodeccl_rpn_node_create (enum ccl_rpn_kind kind)
void ccl_add_attr_numeric (struct ccl_rpn_node *p, const char *set, int type, int value)
void ccl_add_attr_string (struct ccl_rpn_node *p, const char *set, int type, char *value)
int ccl_search_stop (CCL_bibset bibset, const char *qname, const char *src_str, size_t src_len)
ccl_stop_words_t ccl_stop_words_create (void)
 creates stop words handle
void ccl_stop_words_destroy (ccl_stop_words_t csw)
 destroys stop words handle
int ccl_stop_words_tree (ccl_stop_words_t csw, CCL_bibset bibset, struct ccl_rpn_node **t)
 removes stop words from RPN tree
int ccl_stop_words_info (ccl_stop_words_t csw, int idx, const char **qualname, const char **term)
 returns information about removed "stop" words

Variables

int(* ccl_toupper )(int c)


Detailed Description

Header with public definitions for CCL.

Definition in file ccl.h.


Define Documentation

#define ccl_assert (  )     ;

#define CCL_BIB1_COM   6

Definition at line 339 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_POS   3

Definition at line 336 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_REL   2

Definition at line 335 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_REL_ORDER   (-1)

Definition at line 344 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_REL_PORDER   (-2)

Definition at line 345 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_STR   4

Definition at line 337 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_STR_AND_LIST   (-2)

Definition at line 342 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_STR_OR_LIST   (-3)

Definition at line 343 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_STR_WP   (-1)

Definition at line 341 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_TRU   5

Definition at line 338 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_TRU_CAN_BOTH   (-3)

Definition at line 349 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_TRU_CAN_LEFT   (-1)

Definition at line 347 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_TRU_CAN_NONE   (-4)

Definition at line 350 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_TRU_CAN_RIGHT   (-2)

Definition at line 348 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_BIB1_USE   1

common attributes

use (1)

relation (2) -1 none 0 ordered 1-6 relation (<, <=, =, >=, >, <>)

position (3) -1 none 1 first in field 2 first in sub field 3 any position in field structure (4) -1 none 0 word/phrase auto select 1 phrase 2 word 3 key 4 year 5 date (normalized) 6 word list 100 date (un-normalized) 101 name (normalized) 102 name (un-normalized) truncation (5) completeness (6)

Definition at line 334 of file ccl.h.

Referenced by ccl_qual_field2().

#define CCL_ERR_BAD_RELATION   9

Definition at line 90 of file ccl.h.

#define CCL_ERR_BAD_RP   5

Definition at line 86 of file ccl.h.

Referenced by ccl_parser_find_token().

#define CCL_ERR_DOUBLE_QUAL   7

Definition at line 88 of file ccl.h.

#define CCL_ERR_EQ_EXPECTED   8

Definition at line 89 of file ccl.h.

#define CCL_ERR_OK   0

Definition at line 81 of file ccl.h.

Referenced by ccl_parser_find_token().

#define CCL_ERR_OP_EXPECTED   4

Definition at line 85 of file ccl.h.

Referenced by ccl_parser_find_token().

#define CCL_ERR_RP_EXPECTED   2

Definition at line 83 of file ccl.h.

#define CCL_ERR_SETNAME_EXPECTED   3

Definition at line 84 of file ccl.h.

#define CCL_ERR_TERM_EXPECTED   1

Definition at line 82 of file ccl.h.

#define CCL_ERR_TRUNC_NOT_BOTH   11

Definition at line 92 of file ccl.h.

#define CCL_ERR_TRUNC_NOT_LEFT   10

Definition at line 91 of file ccl.h.

#define CCL_ERR_TRUNC_NOT_RIGHT   12

Definition at line 93 of file ccl.h.

#define CCL_ERR_UNKNOWN_QUAL   6

Definition at line 87 of file ccl.h.

#define CCL_RPN_ATTR_NUMERIC   1

Definition at line 105 of file ccl.h.

Referenced by ccl_add_attr_numeric(), and ccl_qual_add_set().

#define CCL_RPN_ATTR_STRING   2

Definition at line 106 of file ccl.h.

Referenced by ccl_add_attr_string(), ccl_qual_add_set(), ccl_qual_rm(), and ccl_rpn_delete().


Typedef Documentation

typedef struct ccl_qualifiers* CCL_bibset

CCL bibset, AKA profile.

Definition at line 144 of file ccl.h.

typedef struct ccl_parser* CCL_parser

CCL parser.

Definition at line 147 of file ccl.h.

stop words handle (pimpl)

Definition at line 279 of file ccl.h.


Enumeration Type Documentation

node type or RPN tree generated by the CCL parser

Enumerator:
CCL_RPN_AND 
CCL_RPN_OR 
CCL_RPN_NOT 
CCL_RPN_TERM 
CCL_RPN_SET 
CCL_RPN_PROX 

Definition at line 116 of file ccl.h.


Function Documentation

void ccl_add_attr_numeric ( struct ccl_rpn_node p,
const char *  set,
int  type,
int  value 
)

add_attr_numeric: Add attribute (type/value) to RPN term node. p: RPN node of type term. type: Type of attribute value: Value of attribute set: Attribute set name

Definition at line 191 of file cclfind.c.

References CCL_RPN_ATTR_NUMERIC, ccl_rpn_attr::kind, ccl_rpn_attr::numeric, and ccl_rpn_attr::value.

void ccl_add_attr_string ( struct ccl_rpn_node p,
const char *  set,
int  type,
char *  value 
)

const char* ccl_err_msg ( int  ccl_errno  ) 

Return english-readable error message for CCL parser error number

Definition at line 36 of file cclerrms.c.

Referenced by ZOOM_query_ccl2rpn().

struct ccl_rpn_node* ccl_find_str ( CCL_bibset  bibset,
const char *  str,
int *  error,
int *  pos 
) [read]

parse CCL find string using CCL profile return RPN tree

Parses a CCL Find command in a simple C string. Returns CCL parse tree node describing RPN if parsing is successful. If parsing is unsuccesful, NULL is returned and error and pos is set accordingly.

ccl_find_str: Parse CCL find - string representation bibset: Bibset to be used for the parsing str: String to be parsed error: Pointer to integer. Holds error no. on completion. pos: Pointer to char position. Holds approximate error position. return: RPN tree on successful completion; NULL otherwise.

Definition at line 1087 of file cclfind.c.

References ccl_parser_create(), ccl_parser_destroy(), ccl_parser_find_token(), ccl_parser_tokenize(), ccl_token_del(), ccl_parser::error_code, and ccl_parser::error_pos.

Referenced by ZOOM_query_ccl2rpn().

int ccl_memicmp ( const char *  s1,
const char *  s2,
size_t  n 
)

CCL version of ccl_memicmp

Definition at line 39 of file cclstr.c.

References ccl_toupper.

Referenced by ccl_qual_search(), and ccl_search_stop().

CCL_parser ccl_parser_create ( CCL_bibset  bibset  ) 

void ccl_parser_destroy ( CCL_parser  p  ) 

Destroy CCL parser

Definition at line 253 of file ccltoken.c.

References ccl_parser::ccl_token_and, ccl_parser::ccl_token_not, ccl_parser::ccl_token_or, ccl_parser::ccl_token_set, and xfree.

Referenced by ccl_find_str().

struct ccl_rpn_node* ccl_parser_find_str ( CCL_parser  cclp,
const char *  str 
) [read]

parse CCL find string with parser and return RPN tree

Parses a CCL Find command in a simple C string. Returns CCL parse tree node describing RPN if parsing is successful. If parsing is unsuccesful, NULL is returned and error and pos is set accordingly.

Definition at line 1046 of file cclfind.c.

References ccl_parser_find_token(), ccl_parser_tokenize(), and ccl_token_del().

int ccl_parser_get_error ( CCL_parser  cclp,
int *  pos 
)

Definition at line 270 of file ccltoken.c.

References ccl_parser::error_code, ccl_parser::error_pos, and ccl_parser::start_pos.

void ccl_parser_set_case ( CCL_parser  p,
int  case_sensitivity_flag 
)

Set case sensitivity for parser

Definition at line 264 of file ccltoken.c.

References ccl_parser::ccl_case_sensitive.

void ccl_pquery ( WRBUF  w,
struct ccl_rpn_node p 
)

Pretty-print CCL RPN node tree to WRBUF

Definition at line 143 of file cclptree.c.

Referenced by ccl_rpn_query(), ccl_scan_query(), and ZOOM_query_ccl2rpn().

void ccl_pr_tree ( struct ccl_rpn_node rpn,
FILE *  fd_out 
)

Dump RPN tree in readable format to fd_out

Definition at line 148 of file cclptree.c.

References wrbuf_alloc(), wrbuf_cstr(), and wrbuf_destroy().

void ccl_qual_add ( CCL_bibset  b,
const char *  name,
int  no,
int *  attr 
)

Add qualifier and supply attribute pairs for it

void ccl_qual_add_combi ( CCL_bibset  b,
const char *  n,
const char **  names 
)

adds specifies qualifier aliases

Add combo qualifier

Parameters:
b bibset
n qualifier name
names list of qualifier aliases

Definition at line 110 of file cclqual.c.

References ccl_qualifier::attr_list, ccl_qualifiers::list, ccl_qualifier::name, ccl_qualifier::next, ccl_qualifier::no_sub, ccl_qualifier::sub, xmalloc, and xstrdup.

Referenced by ccl_qual_field2().

void ccl_qual_add_set ( CCL_bibset  b,
const char *  name,
int  no,
int *  type_ar,
int *  value_ar,
char **  svalue_ar,
char **  attsets 
)

adds specifies attributes for qualifier

Add qualifier and supply attributes pairs+attribute set for it

Parameters:
b bibset
name qualifier name
no number of attribute type+value pairs
type_ar attributes type of size no
value_ar attribute value of size no
svalue_ar attribute string values ([i] only used if != NULL)
attsets attribute sets of size no

Definition at line 144 of file cclqual.c.

References ccl_qualifier::attr_list, ccl_assert, CCL_RPN_ATTR_NUMERIC, CCL_RPN_ATTR_STRING, ccl_rpn_attr::kind, ccl_qualifiers::list, ccl_qualifier::name, ccl_rpn_attr::next, ccl_qualifier::next, ccl_qualifier::no_sub, ccl_rpn_attr::numeric, ccl_rpn_attr::set, ccl_rpn_attr::str, ccl_qualifier::sub, ccl_rpn_attr::type, ccl_rpn_attr::value, xmalloc, and xstrdup.

Referenced by ccl_qual_field2().

void ccl_qual_add_special ( CCL_bibset  bibset,
const char *  n,
const char *  cp 
)

void ccl_qual_buf ( CCL_bibset  bibset,
const char *  buf 
)

Add CCL qualifier as buf spec(multiple lines).

Definition at line 235 of file cclqfile.c.

References ccl_qual_line().

Referenced by ZOOM_query_ccl2rpn().

void ccl_qual_file ( CCL_bibset  bibset,
FILE *  inf 
)

Read CCL qualifier list spec from file inf

Definition at line 290 of file cclqfile.c.

References ccl_qual_line().

Referenced by ccl_qual_fname().

void ccl_qual_fitem ( CCL_bibset  bibset,
const char *  value,
const char *  qual_name 
)

Definition at line 227 of file cclqfile.c.

References ccl_qual_add_special(), and ccl_qual_field().

Referenced by ccl_qual_line().

int ccl_qual_fname ( CCL_bibset  bibset,
const char *  fname 
)

Read CCL qualifier list spec from file inf

Definition at line 298 of file cclqfile.c.

References ccl_qual_file().

void ccl_qual_line ( CCL_bibset  bibset,
char *  line 
)

Add CCL qualifier as line spec. Note: line is _modified_

Definition at line 260 of file cclqfile.c.

References ccl_qual_fitem().

Referenced by ccl_qual_buf(), and ccl_qual_file().

CCL_bibset ccl_qual_mk ( void   ) 

creates Bibset

Make CCL qualifier set

Returns:
bibset

Definition at line 201 of file cclqual.c.

References ccl_assert, ccl_qualifiers::list, ccl_qualifiers::special, and xmalloc.

Referenced by ZOOM_query_ccl2rpn().

void ccl_qual_rm ( CCL_bibset b  ) 

const char** ccl_qual_search_special ( CCL_bibset  b,
const char *  name 
)

void ccl_rpn_delete ( struct ccl_rpn_node rpn  ) 

struct ccl_rpn_node* ccl_rpn_node_create ( enum ccl_rpn_kind  kind  )  [read]

mk_node: Create RPN node. kind: Type of node. return: pointer to allocated node.

Definition at line 92 of file cclfind.c.

References ccl_assert, CCL_RPN_TERM, ccl_rpn_node::kind, ccl_rpn_node::p, ccl_rpn_node::t, ccl_rpn_node::u, and xmalloc.

int ccl_search_stop ( CCL_bibset  bibset,
const char *  qname,
const char *  src_str,
size_t  src_len 
)

Definition at line 324 of file cclqual.c.

References ccl_memicmp(), ccl_qual_search_special(), and yaz_snprintf().

Referenced by ccl_remove_stop_r().

ccl_stop_words_t ccl_stop_words_create ( void   ) 

creates stop words handle

Definition at line 51 of file ccl_stop_words.c.

References ccl_stop_words::blank_chars, ccl_stop_words::nmem, nmem_create(), ccl_stop_words::removed_items, xmalloc, and xstrdup.

void ccl_stop_words_destroy ( ccl_stop_words_t  csw  ) 

destroys stop words handle

Definition at line 61 of file ccl_stop_words.c.

References ccl_stop_words::blank_chars, ccl_stop_words::nmem, nmem_destroy(), and xfree.

int ccl_stop_words_info ( ccl_stop_words_t  csw,
int  idx,
const char **  qualname,
const char **  term 
)

returns information about removed "stop" words

Definition at line 176 of file ccl_stop_words.c.

References ccl_stop_info::next, ccl_stop_info::qualname, ccl_stop_words::removed_items, and ccl_stop_info::term.

int ccl_stop_words_tree ( ccl_stop_words_t  csw,
CCL_bibset  bibset,
struct ccl_rpn_node **  t 
)

removes stop words from RPN tree

Definition at line 160 of file ccl_stop_words.c.

References ccl_remove_stop_r(), ccl_stop_words::nmem, nmem_reset(), and ccl_stop_words::removed_items.

int ccl_stricmp ( const char *  s1,
const char *  s2 
)

CCL version of ccl_stricmp

Definition at line 22 of file cclstr.c.

References ccl_toupper.

Referenced by ccl_qual_field2().


Variable Documentation

int(* ccl_toupper)(int c)

Char-to-upper function

Referenced by ccl_memicmp(), and ccl_stricmp().


Generated on Wed Jun 18 11:17:01 2008 for YAZ by  doxygen 1.5.6