IDZEBRA  2.1.2
Data Structures | Macros | Typedefs | Functions | Variables
charmap.c File Reference

character conversions (.chr) More...

#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <charmap.h>
#include <yaz/yaz-util.h>

Go to the source code of this file.

Data Structures

struct  chrmaptab_info
 
struct  chr_t_entry
 
struct  chrwork
 
struct  chr_equiv_work
 

Macros

#define CHR_MAXSTR   1024
 
#define CHR_MAXEQUIV   32
 

Typedefs

typedef unsigned ucs4_t
 
typedef struct chrwork chrwork
 

Functions

static chr_t_entryset_map_string (chr_t_entry *root, NMEM nmem, const char *from, int len, char *to, const char *from_0)
 
static chr_t_entryfind_entry_x (chr_t_entry *t, const char **from, int *len, int first)
 
const char ** chr_map_input_x (chrmaptab maptab, const char **from, int *len, int first)
 
const char ** chr_map_input (chrmaptab maptab, const char **from, int len, int first)
 
const char ** chr_map_q_input (chrmaptab maptab, const char **from, int len, int first)
 
const char * chr_map_output (chrmaptab maptab, const char **from, int len)
 
static int zebra_ucs4_strlen (ucs4_t *s)
 
ucs4_t zebra_prim_w (ucs4_t **s)
 
static void fun_addentry (const char *s, void *data, int num)
 
static void fun_addspace (const char *s, void *data, int num)
 
static void fun_addcut (const char *s, void *data, int num)
 
static void fun_mkstring (const char *s, void *data, int num)
 
static void fun_add_equivalent_string (const char *s, void *data, int num)
 
static void fun_add_map (const char *s, void *data, int num)
 
static int scan_to_utf8 (yaz_iconv_t t, ucs4_t *from, size_t inlen, char *outbuf, size_t outbytesleft)
 
static int scan_string (char *s_native, yaz_iconv_t t_unicode, yaz_iconv_t t_utf8, void(*fun)(const char *c, void *data, int num), void *data, int *num)
 
chrmaptab chrmaptab_create (const char *tabpath, const char *name, const char *tabroot)
 
void chrmaptab_destroy (chrmaptab tab)
 

Variables

const unsigned char CHR_FIELD_BEGIN = '^'
 
const char * CHR_UNKNOWN = "\001"
 
const char * CHR_SPACE = "\002"
 
const char * CHR_CUT = "\003"
 
const char * CHR_BASE = "\005"
 

Detailed Description

character conversions (.chr)

Support module to handle character-conversions into and out of the Zebra dictionary.

Definition in file charmap.c.

Macro Definition Documentation

#define CHR_MAXEQUIV   32

Definition at line 44 of file charmap.c.

Referenced by fun_add_equivalent_string().

#define CHR_MAXSTR   1024

Definition at line 43 of file charmap.c.

Referenced by fun_mkstring().

Typedef Documentation

typedef struct chrwork chrwork
typedef unsigned ucs4_t

Definition at line 37 of file charmap.c.

Function Documentation

const char** chr_map_input ( chrmaptab  maptab,
const char **  from,
int  len,
int  first 
)
const char** chr_map_input_x ( chrmaptab  maptab,
const char **  from,
int *  len,
int  first 
)

Definition at line 184 of file charmap.c.

References find_entry_x(), chrmaptab_info::input, and chr_t_entry::target.

const char* chr_map_output ( chrmaptab  maptab,
const char **  from,
int  len 
)

Definition at line 221 of file charmap.c.

References chrmaptab_info::output.

Referenced by zebra_maps_output().

const char** chr_map_q_input ( chrmaptab  maptab,
const char **  from,
int  len,
int  first 
)

Definition at line 207 of file charmap.c.

References find_entry_x(), chrmaptab_info::q_input, and chr_t_entry::target.

Referenced by zebra_maps_search().

chrmaptab chrmaptab_create ( const char *  tabpath,
const char *  name,
const char *  tabroot 
)
void chrmaptab_destroy ( chrmaptab  tab)

Definition at line 748 of file charmap.c.

References chrmaptab_info::nmem.

Referenced by chrmaptab_create(), tst1(), tst2(), tst3(), and zebra_maps_close().

static chr_t_entry* find_entry_x ( chr_t_entry t,
const char **  from,
int *  len,
int  first 
)
static
static void fun_add_equivalent_string ( const char *  s,
void *  data,
int  num 
)
static

Definition at line 369 of file charmap.c.

References CHR_MAXEQUIV, chr_equiv_work::eq, chr_equiv_work::nmem, and chr_equiv_work::no_eq.

Referenced by chrmaptab_create().

static void fun_add_map ( const char *  s,
void *  data,
int  num 
)
static
static void fun_addcut ( const char *  s,
void *  data,
int  num 
)
static

Definition at line 344 of file charmap.c.

References CHR_CUT, chrmaptab_info::input, chrmaptab_info::nmem, and set_map_string().

Referenced by chrmaptab_create().

static void fun_addentry ( const char *  s,
void *  data,
int  num 
)
static
static void fun_addspace ( const char *  s,
void *  data,
int  num 
)
static

Definition at line 333 of file charmap.c.

References CHR_SPACE, chrmaptab_info::input, chrmaptab_info::nmem, and set_map_string().

Referenced by chrmaptab_create().

static void fun_mkstring ( const char *  s,
void *  data,
int  num 
)
static

Definition at line 354 of file charmap.c.

References chr_map_input(), CHR_MAXSTR, CHR_UNKNOWN, chrwork::map, and chrwork::string.

Referenced by chrmaptab_create().

static int scan_string ( char *  s_native,
yaz_iconv_t  t_unicode,
yaz_iconv_t  t_utf8,
void(*)(const char *c, void *data, int num)  fun,
void *  data,
int *  num 
)
static

Definition at line 421 of file charmap.c.

References begin(), end(), scan_to_utf8(), zebra_prim_w(), and zebra_ucs4_strlen().

Referenced by chrmaptab_create().

static int scan_to_utf8 ( yaz_iconv_t  t,
ucs4_t from,
size_t  inlen,
char *  outbuf,
size_t  outbytesleft 
)
static

Definition at line 393 of file charmap.c.

Referenced by scan_string().

static chr_t_entry* set_map_string ( chr_t_entry root,
NMEM  nmem,
const char *  from,
int  len,
char *  to,
const char *  from_0 
)
static
ucs4_t zebra_prim_w ( ucs4_t **  s)

Definition at line 239 of file charmap.c.

References zebra_ucs4_strlen().

Referenced by scan_string().

static int zebra_ucs4_strlen ( ucs4_t s)
static

Definition at line 231 of file charmap.c.

Referenced by scan_string(), and zebra_prim_w().

Variable Documentation

const char* CHR_BASE = "\005"

Definition at line 51 of file charmap.c.

Referenced by chrmaptab_create().

const char* CHR_CUT = "\003"

Definition at line 50 of file charmap.c.

Referenced by fun_addcut(), and parse_complete_field().

const unsigned char CHR_FIELD_BEGIN = '^'

Definition at line 46 of file charmap.c.

Referenced by find_entry_x().

const char* CHR_SPACE = "\002"
const char* CHR_UNKNOWN = "\001"

Definition at line 48 of file charmap.c.

Referenced by chrmaptab_create(), fun_mkstring(), set_map_string(), and zebra_it_key_str_dump().