IDZEBRA 2.2.11
zebramap.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
#include <charmap.h>
#include <attrfind.h>
#include <yaz/yaz-util.h>
#include <yaz/snprintf.h>
#include <zebramap.h>

Go to the source code of this file.

Data Structures

struct  zebra_map
struct  zebra_maps_s

Macros

#define ZEBRA_MAP_TYPE_SORT   1
#define ZEBRA_MAP_TYPE_INDEX   2
#define ZEBRA_MAP_TYPE_STATICRANK   3
#define ZEBRA_REPLACE_ANY   300
#define SE_CHARS   ";,.()-/?<> \r\n\t"

Functions

void zebra_maps_close (zebra_maps_t zms)
zebra_map_t zebra_add_map (zebra_maps_t zms, const char *index_type, int map_type)
static int parse_command (zebra_maps_t zms, int argc, char **argv, const char *fname, int lineno)
ZEBRA_RES zebra_maps_read_file (zebra_maps_t zms, const char *fname)
zebra_maps_t zebra_maps_open (Res res, const char *base_path, const char *profile_path)
void zebra_maps_define_default_sort (zebra_maps_t zms)
zebra_map_t zebra_map_get (zebra_maps_t zms, const char *id)
zebra_map_t zebra_map_get_or_add (zebra_maps_t zms, const char *id)
chrmaptab zebra_charmap_get (zebra_map_t zm)
const char ** zebra_maps_input (zebra_map_t zm, const char **from, int len, int first)
const char ** zebra_maps_search (zebra_map_t zm, const char **from, int len, int *q_map_match)
const char * zebra_maps_output (zebra_map_t zm, const char **from)
int zebra_maps_is_complete (zebra_map_t zm)
int zebra_maps_is_positioned (zebra_map_t zm)
int zebra_maps_is_index (zebra_map_t zm)
int zebra_maps_is_staticrank (zebra_map_t zm)
int zebra_maps_is_sort (zebra_map_t zm)
int zebra_maps_is_alwaysmatches (zebra_map_t zm)
int zebra_maps_is_first_in_field (zebra_map_t zm)
int zebra_maps_sort (zebra_maps_t zms, Z_SortAttributes *sortAttributes, int *numerical)
int zebra_maps_attr (zebra_maps_t zms, Z_AttributesPlusTerm *zapt, const char **index_type, char **search_type, char *rank_type, int *complete_flag, int *sort_flag)
WRBUF zebra_replace (zebra_map_t zm, const char *ex_list, const char *input_str, int input_len)
static int tokenize_simple (zebra_map_t zm, const char **result_buf, size_t *result_len)
int zebra_map_tokenize_next (zebra_map_t zm, const char **result_buf, size_t *result_len, const char **display_buf, size_t *display_len)
int zebra_map_tokenize_start (zebra_map_t zm, const char *buf, size_t len)
int zebra_maps_is_icu (zebra_map_t zm)

Macro Definition Documentation

◆ SE_CHARS

#define SE_CHARS   ";,.()-/?<> \r\n\t"

Definition at line 627 of file zebramap.c.

Referenced by tokenize_simple().

◆ ZEBRA_MAP_TYPE_INDEX

#define ZEBRA_MAP_TYPE_INDEX   2

Definition at line 38 of file zebramap.c.

Referenced by parse_command(), zebra_map_get_or_add(), and zebra_maps_is_index().

◆ ZEBRA_MAP_TYPE_SORT

#define ZEBRA_MAP_TYPE_SORT   1

Definition at line 37 of file zebramap.c.

Referenced by parse_command(), zebra_maps_define_default_sort(), and zebra_maps_is_sort().

◆ ZEBRA_MAP_TYPE_STATICRANK

#define ZEBRA_MAP_TYPE_STATICRANK   3

Definition at line 39 of file zebramap.c.

Referenced by parse_command(), and zebra_maps_is_staticrank().

◆ ZEBRA_REPLACE_ANY

#define ZEBRA_REPLACE_ANY   300

Definition at line 41 of file zebramap.c.

Function Documentation

◆ parse_command()

◆ tokenize_simple()

int tokenize_simple ( zebra_map_t zm,
const char ** result_buf,
size_t * result_len )
static

Definition at line 629 of file zebramap.c.

References zebra_map::input_str, SE_CHARS, and zebra_map::simple_off.

Referenced by zebra_map_tokenize_next().

◆ zebra_add_map()

◆ zebra_charmap_get()

◆ zebra_map_get()

zebra_map_t zebra_map_get ( zebra_maps_t zms,
const char * id )

◆ zebra_map_get_or_add()

◆ zebra_map_tokenize_next()

int zebra_map_tokenize_next ( zebra_map_t zm,
const char ** result_buf,
size_t * result_len,
const char ** display_buf,
size_t * display_len )

◆ zebra_map_tokenize_start()

int zebra_map_tokenize_start ( zebra_map_t zm,
const char * buf,
size_t len )

◆ zebra_maps_attr()

int zebra_maps_attr ( zebra_maps_t zms,
Z_AttributesPlusTerm * zapt,
const char ** index_type,
char ** search_type,
char * rank_type,
int * complete_flag,
int * sort_flag )

Definition at line 515 of file zebramap.c.

References attr_find(), attr_find_ex(), attr_init_APT(), and zebra_map::completeness.

Referenced by rpn_scan(), and rpn_search_database().

◆ zebra_maps_close()

◆ zebra_maps_define_default_sort()

void zebra_maps_define_default_sort ( zebra_maps_t zms)

◆ zebra_maps_input()

◆ zebra_maps_is_alwaysmatches()

int zebra_maps_is_alwaysmatches ( zebra_map_t zm)

Definition at line 485 of file zebramap.c.

References zebra_map::alwaysmatches.

Referenced by extract_add_string().

◆ zebra_maps_is_complete()

int zebra_maps_is_complete ( zebra_map_t zm)

Definition at line 450 of file zebramap.c.

References zebra_map::completeness.

Referenced by extract_token_add(), and snippet_token_add().

◆ zebra_maps_is_first_in_field()

int zebra_maps_is_first_in_field ( zebra_map_t zm)

◆ zebra_maps_is_icu()

int zebra_maps_is_icu ( zebra_map_t zm)

◆ zebra_maps_is_index()

int zebra_maps_is_index ( zebra_map_t zm)

◆ zebra_maps_is_positioned()

int zebra_maps_is_positioned ( zebra_map_t zm)

Definition at line 457 of file zebramap.c.

References zebra_map::positioned.

◆ zebra_maps_is_sort()

int zebra_maps_is_sort ( zebra_map_t zm)

Definition at line 478 of file zebramap.c.

References zebra_map::type, and ZEBRA_MAP_TYPE_SORT.

Referenced by extract_add_string().

◆ zebra_maps_is_staticrank()

int zebra_maps_is_staticrank ( zebra_map_t zm)

Definition at line 471 of file zebramap.c.

References zebra_map::type, and ZEBRA_MAP_TYPE_STATICRANK.

Referenced by extract_add_string().

◆ zebra_maps_open()

◆ zebra_maps_output()

const char * zebra_maps_output ( zebra_map_t zm,
const char ** from )

Definition at line 438 of file zebramap.c.

References chr_map_output(), zebra_map::maptab, and zebra_charmap_get().

Referenced by zebra_term_untrans().

◆ zebra_maps_read_file()

ZEBRA_RES zebra_maps_read_file ( zebra_maps_t zms,
const char * fname )

◆ zebra_maps_search()

const char ** zebra_maps_search ( zebra_map_t zm,
const char ** from,
int len,
int * q_map_match )

◆ zebra_maps_sort()

int zebra_maps_sort ( zebra_maps_t zms,
Z_SortAttributes * sortAttributes,
int * numerical )

Definition at line 499 of file zebramap.c.

References attr_find(), and attr_init_AttrList().

◆ zebra_replace()

WRBUF zebra_replace ( zebra_map_t zm,
const char * ex_list,
const char * input_str,
int input_len )

Definition at line 619 of file zebramap.c.

References zebra_map::input_str, zebra_maps_s::wrbuf_1, and zebra_map::zebra_maps.

Referenced by zebra_string_norm().