YAZ
5.34.0
|
Header with public definitions for CCL. More...
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... | |
Typedefs | |
typedef struct ccl_qualifiers * | CCL_bibset |
CCL bibset, AKA profile. More... | |
typedef struct ccl_parser * | CCL_parser |
CCL parser. More... | |
typedef struct ccl_stop_words * | ccl_stop_words_t |
stop words handle (pimpl) More... | |
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_node * | ccl_find_str (CCL_bibset bibset, const char *str, int *error, int *pos) |
parse CCL find string using CCL profile return RPN tree More... | |
struct ccl_rpn_node * | ccl_parser_find_str (CCL_parser cclp, const char *str) |
parse CCL find string with parser and return RPN tree More... | |
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 More... | |
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 More... | |
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) |
int | ccl_qual_fitem2 (CCL_bibset bibset, const char *value, const char *qual_name, const char **addinfo) |
CCL_bibset | ccl_qual_mk (void) |
creates Bibset More... | |
CCL_bibset | ccl_qual_dup (CCL_bibset b) |
void | ccl_qual_rm (CCL_bibset *b) |
destroys Bibset More... | |
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_node * | ccl_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 More... | |
void | ccl_stop_words_destroy (ccl_stop_words_t csw) |
destroys stop words handle More... | |
int | ccl_stop_words_tree (ccl_stop_words_t csw, CCL_bibset bibset, struct ccl_rpn_node **t) |
removes stop words from RPN tree More... | |
int | ccl_stop_words_info (ccl_stop_words_t csw, int idx, const char **qualname, const char **term) |
returns information about removed "stop" words More... | |
struct ccl_rpn_attr * | ccl_parser_qual_search (CCL_parser cclp, const char *name, size_t name_len) |
Variables | |
int(* | ccl_toupper )(int c) |
Header with public definitions for CCL.
Definition in file ccl.h.
#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)
typedef struct ccl_qualifiers* CCL_bibset |
typedef struct ccl_parser* CCL_parser |
typedef struct ccl_stop_words* ccl_stop_words_t |
enum ccl_rpn_kind |
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 213 of file cclfind.c.
References add_attr_node(), CCL_RPN_ATTR_NUMERIC, ccl_rpn_attr::kind, ccl_rpn_attr::numeric, ccl_rpn_attr::set, type, and ccl_rpn_attr::value.
Referenced by ccl_set_attr_numeric(), and ccl_term_one_use().
void ccl_add_attr_string | ( | struct ccl_rpn_node * | p, |
const char * | set, | ||
int | type, | ||
char * | value | ||
) |
Definition at line 239 of file cclfind.c.
References add_attr_node(), CCL_RPN_ATTR_STRING, ccl_rpn_attr::kind, ccl_rpn_attr::set, ccl_rpn_attr::str, type, ccl_rpn_attr::value, and xstrdup.
Referenced by ccl_term_one_use().
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.
References err_msg_array.
Referenced by ccl2pqf(), and ZOOM_query_ccl2rpn().
struct ccl_rpn_node* ccl_find_str | ( | CCL_bibset | bibset, |
const char * | str, | ||
int * | error, | ||
int * | pos | ||
) |
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 1310 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, ccl_parser::error_pos, and ccl_rpn_node::p.
Referenced by ccl2pqf(), and ZOOM_query_ccl2rpn().
int ccl_memicmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | n | ||
) |
CCL version of ccl_memicmp
Definition at line 45 of file cclstr.c.
References ccl_toupper, and ccli_toupper().
Referenced by ccl_qual_search(), ccl_search_stop(), and token_cmp().
CCL_parser ccl_parser_create | ( | CCL_bibset | bibset | ) |
Create CCL parser
Definition at line 246 of file ccltoken.c.
References ccl_parser::bibset, ccl_parser::ccl_case_sensitive, ccl_parser::ccl_token_and, ccl_parser::ccl_token_not, ccl_parser::ccl_token_or, ccl_parser::ccl_token_set, create_ar(), ccl_parser::error_code, ccl_parser::error_pos, ccl_parser::look_token, and xmalloc.
Referenced by ccl_find_str().
void ccl_parser_destroy | ( | CCL_parser | p | ) |
Destroy CCL parser
Definition at line 265 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, destroy_ar(), and xfree.
Referenced by ccl_find_str().
struct ccl_rpn_node* ccl_parser_find_str | ( | CCL_parser | cclp, |
const char * | str | ||
) |
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 1271 of file cclfind.c.
References ccl_parser_find_token(), ccl_parser_tokenize(), ccl_token_del(), and ccl_rpn_node::p.
int ccl_parser_get_error | ( | CCL_parser | cclp, |
int * | pos | ||
) |
Definition at line 282 of file ccltoken.c.
References ccl_parser::error_code, ccl_parser::error_pos, and ccl_parser::start_pos.
struct ccl_rpn_attr* ccl_parser_qual_search | ( | CCL_parser | cclp, |
const char * | name, | ||
size_t | name_len | ||
) |
Definition at line 387 of file cclqual.c.
References ccl_qualifier::attr_list, ccl_qual_search(), and name.
void ccl_parser_set_case | ( | CCL_parser | p, |
int | case_sensitivity_flag | ||
) |
Set case sensitivity for parser
Definition at line 276 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 135 of file cclptree.c.
References ccl_pquery_indent().
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 140 of file cclptree.c.
References ccl_pquery_indent(), 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
b | bibset |
n | qualifier name |
names | list of qualifier aliases |
Definition at line 127 of file cclqual.c.
References ccl_qualifier::attr_list, ccl_qual_lookup(), ccl_qual_new(), 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
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 165 of file cclqual.c.
References ccl_qualifier::attr_list, ccl_assert, ccl_qual_new(), CCL_RPN_ATTR_NUMERIC, CCL_RPN_ATTR_STRING, ccl_rpn_attr::kind, ccl_qualifiers::list, ccl_qualifier::name, name, ccl_qualifier::next, ccl_rpn_attr::next, ccl_rpn_attr::numeric, ccl_rpn_attr::set, ccl_rpn_attr::str, ccl_rpn_attr::type, ccl_rpn_attr::value, and xmalloc.
Referenced by ccl_qual_field2().
void ccl_qual_add_special | ( | CCL_bibset | bibset, |
const char * | n, | ||
const char * | cp | ||
) |
Add special qualifier
Definition at line 81 of file cclqual.c.
References ccl_qual_add_special_ar(), xmalloc, xrealloc, xstrdup, yaz_tok_cfg_create(), yaz_tok_cfg_destroy(), yaz_tok_move(), yaz_tok_parse_buf(), yaz_tok_parse_destroy(), yaz_tok_parse_string(), and YAZ_TOK_STRING.
Referenced by ccl_qual_fitem2(), and ccl_xml_config_directive().
void ccl_qual_buf | ( | CCL_bibset | bibset, |
const char * | buf | ||
) |
Add CCL qualifier as buf spec(multiple lines).
Definition at line 261 of file cclqfile.c.
References ccl_qual_line().
Referenced by ZOOM_query_ccl2rpn().
CCL_bibset ccl_qual_dup | ( | CCL_bibset | b | ) |
Make CCL qualifier set from an existing one (duplicate it)
Definition at line 267 of file cclqual.c.
References ccl_qualifier::attr_list, ccl_qual_mk(), CCL_RPN_ATTR_NUMERIC, CCL_RPN_ATTR_STRING, ccl_rpn_attr::kind, ccl_qualifiers::list, ccl_qualifier::name, ccl_qualifier_special::name, ccl_qualifier::next, ccl_qualifier_special::next, ccl_rpn_attr::next, ccl_qualifier::no_sub, ccl_rpn_attr::numeric, ccl_rpn_attr::set, ccl_qualifiers::special, ccl_rpn_attr::str, ccl_qualifier::sub, ccl_rpn_attr::type, ccl_rpn_attr::value, ccl_qualifier_special::values, xmalloc, and xstrdup.
void ccl_qual_file | ( | CCL_bibset | bibset, |
FILE * | inf | ||
) |
Read CCL qualifier list spec from file inf
Definition at line 316 of file cclqfile.c.
References ccl_qual_line().
Referenced by ccl_qual_fname(), and xml_config_read().
void ccl_qual_fitem | ( | CCL_bibset | bibset, |
const char * | value, | ||
const char * | qual_name | ||
) |
Definition at line 255 of file cclqfile.c.
References ccl_qual_fitem2().
Referenced by ccl_qual_line().
int ccl_qual_fitem2 | ( | CCL_bibset | bibset, |
const char * | value, | ||
const char * | qual_name, | ||
const char ** | addinfo | ||
) |
Definition at line 241 of file cclqfile.c.
References ccl_qual_add_special(), and ccl_qual_field2().
Referenced by ccl_qual_fitem().
int ccl_qual_fname | ( | CCL_bibset | bibset, |
const char * | fname | ||
) |
Read CCL qualifier list spec from file inf
Definition at line 324 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 286 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
Definition at line 210 of file cclqual.c.
References ccl_assert, ccl_qualifiers::list, ccl_qualifiers::special, and xmalloc.
Referenced by ccl_qual_dup(), xml_config_read(), and ZOOM_query_ccl2rpn().
void ccl_qual_rm | ( | CCL_bibset * | b | ) |
destroys Bibset
Delete CCL qualifier set
b | pointer to Bibset |
b will be set to NULL.
Definition at line 224 of file cclqual.c.
References ccl_qualifier::attr_list, CCL_RPN_ATTR_STRING, ccl_rpn_attr::kind, ccl_qualifier::name, ccl_qualifier_special::name, ccl_qualifier::next, ccl_qualifier_special::next, ccl_rpn_attr::next, ccl_rpn_attr::set, ccl_rpn_attr::str, ccl_qualifier::sub, ccl_rpn_attr::value, ccl_qualifier_special::values, and xfree.
Referenced by ZOOM_query_ccl2rpn().
const char** ccl_qual_search_special | ( | CCL_bibset | b, |
const char * | name | ||
) |
Search for special qualifier
Definition at line 401 of file cclqual.c.
References ccl_qualifier_special::name, name, ccl_qualifier_special::next, ccl_qualifiers::special, and ccl_qualifier_special::values.
Referenced by ccl_parser_tokenize(), ccl_qual_search(), ccl_search_stop(), ccl_term_one_use(), qualifier_list(), and token_cmp().
void ccl_rpn_delete | ( | struct ccl_rpn_node * | rpn | ) |
Delete RPN tree returned by ccl_find
ccl_rpn_delete: Delete RPN tree. rpn: Pointer to tree.
Definition at line 141 of file cclfind.c.
References CCL_RPN_AND, CCL_RPN_ATTR_STRING, CCL_RPN_NOT, CCL_RPN_OR, CCL_RPN_PROX, CCL_RPN_SET, CCL_RPN_TERM, ccl_rpn_attr::kind, ccl_rpn_node::kind, ccl_rpn_attr::next, ccl_rpn_node::p, ccl_rpn_attr::set, ccl_rpn_node::setname, ccl_rpn_attr::str, ccl_rpn_node::t, ccl_rpn_node::u, ccl_rpn_attr::value, and xfree.
Referenced by ccl_parser_find_token(), ccl_remove_stop_r(), ccl_term_multi_use(), ccl_term_one_use(), find_spec(), qualifier_list(), qualifiers_order(), search_elements(), search_terms(), search_terms2(), split_recur(), and ZOOM_query_ccl2rpn().
struct ccl_rpn_node* ccl_rpn_node_create | ( | enum ccl_rpn_kind | kind | ) |
mk_node: Create RPN node. kind: Type of node. return: pointer to allocated node.
Definition at line 100 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.
Referenced by ccl_rpn_node_mkbool(), ccl_term_one_use(), qualifiers_order(), search_elements(), and search_terms().
int ccl_search_stop | ( | CCL_bibset | bibset, |
const char * | qname, | ||
const char * | src_str, | ||
size_t | src_len | ||
) |
Definition at line 413 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 53 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 63 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 178 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 162 of file ccl_stop_words.c.
References ccl_remove_stop_r(), ccl_stop_words::nmem, nmem_reset(), ccl_stop_words::removed_items, and ccl_rpn_node::t.
int ccl_stricmp | ( | const char * | s1, |
const char * | s2 | ||
) |
CCL version of ccl_stricmp
Definition at line 28 of file cclstr.c.
References ccl_toupper, and ccli_toupper().
Referenced by ccl_qual_field2().
|
extern |
Char-to-upper function
Definition at line 26 of file cclstr.c.
Referenced by ccl_memicmp(), and ccl_stricmp().