Skip to content

File uca_support.c

FileList > base > uca_support.c

Go to the source code of this file

  • #include <assert.h>
  • #include <errno.h>
  • #include "utility.h"
  • #include "environment_variable.h"
  • #include "locale_support.h"
  • #include "error_manager.h"
  • #include "porting.h"
  • #include "intl_support.h"
  • #include "uca_support.h"
  • #include "unicode_support.h"
  • #include "memory_wrapper.hpp"

Classes

Type Name
struct uca_chr_seq
struct uca_coll_ce
struct uca_coll_ce_list
struct uca_coll_contr_id
struct uca_coll_key
struct uca_storage
struct uca_weight_key_list

Public Types

Type Name
typedef struct uca_chr_seq UCA_CHR_SEQ
typedef struct uca_coll_ce UCA_COLL_CE
typedef struct uca_coll_ce_list UCA_COLL_CE_LIST
typedef struct uca_coll_contr_id UCA_COLL_CONTR_ID
typedef struct uca_coll_key UCA_COLL_KEY
enum UCA_COLL_KEY_TYPE
typedef UCA_CHR_SEQ UCA_CONTRACTION
typedef UCA_CHR_SEQ UCA_EXPANSION
typedef struct uca_storage UCA_STORAGE
typedef struct uca_weight_key_list UCA_WEIGHT_KEY_LIST

Public Static Attributes

Type Name
UCA_STORAGE curr_uca = /* multi line expression */
UCA_STORAGE ducet = /* multi line expression */
int logical_pos_cp
UCA_OPTIONS * uca_tailoring_options = [**NULL**](freelistheap_8h.md#define-null)
UCA_W * w_occurences
UCA_WEIGHT_KEY_LIST * weight_key_list

Public Functions

Type Name
void uca_free_data (void)
int uca_process_collation (LOCALE_COLLATION * lc, bool is_verbose)

Public Static Functions

Type Name
int add_key_to_weight_stats_list (const UCA_COLL_KEY * key, UCA_W wv)
int add_opt_coll_contraction (LOCALE_COLLATION * lc, const UCA_COLL_KEY * contr_key, const unsigned int wv, bool use_expansions)
int add_uca_contr_or_exp (LOCALE_COLLATION * lc, UCA_STORAGE * storage, const unsigned int * cp_array, const int cp_count, const UCA_COLL_KEY_TYPE seq_type)
int apply_absolute_tailoring_rules (LOCALE_COLLATION * lc)
int apply_tailoring_rule (TAILOR_DIR dir, UCA_COLL_KEY * anchor_key, UCA_COLL_KEY * key, UCA_COLL_KEY * ref_key, T_LEVEL lvl)
int apply_tailoring_rule_identity (UCA_COLL_KEY * key, UCA_COLL_KEY * ref_key)
int apply_tailoring_rule_w_dir (TAILOR_DIR dir, UCA_COLL_KEY * anchor_key, UCA_COLL_KEY * key, UCA_COLL_KEY * ref_key, T_LEVEL lvl)
int apply_tailoring_rules (LOCALE_COLLATION * lc)
void build_compressed_uca_w_l13 (const UCA_COLL_CE_LIST * ce_list, UCA_L13_W * uca_w_l13)
int build_key_list_groups (LOCALE_COLLATION * lc)
void build_uca_w_l4 (const UCA_COLL_CE_LIST * ce_list, UCA_L4_W * uca_w_l4)
int change_key_weight_list (const UCA_COLL_KEY * key, UCA_W w_from, UCA_W w_to)
int comp_func_coll_contr_bin (const void * arg1, const void * arg2)
int compare_ce_list (UCA_COLL_CE_LIST * ce_list1, UCA_COLL_CE_LIST * ce_list2, UCA_OPTIONS * uca_opt)
int compute_weights_per_level_stats (void)
int create_opt_ce_w_exp (LOCALE_COLLATION * lc)
int create_opt_weights (LOCALE_COLLATION * lc)
int destroy_uca_instance (void)
int find_contr_id (const unsigned int * cp_array, const int cp_count, UCA_STORAGE * st)
int find_exp_id (const unsigned int * cp_array, const int cp_count, UCA_STORAGE * st)
UCA_COLL_CE_LIST * get_ce_list_from_coll_key (const UCA_COLL_KEY * key)
UCA_COLL_KEY * get_key_with_ce_sublist (UCA_COLL_CE_LIST * uca_item, const int lvl)
int init_uca_instance (LOCALE_COLLATION * lc)
int load_ducet (const char * file_path, const int sett_contr_policy)
void make_coll_key (UCA_COLL_KEY * key, UCA_COLL_KEY_TYPE type, const int key_id)
UCA_CONTRACTION * new_contraction (UCA_STORAGE * storage)
UCA_EXPANSION * new_expansion (UCA_STORAGE * storage)
int optimize_coll_contractions (LOCALE_COLLATION * lc)
int read_cp_from_tag (unsigned char * buffer, CP_BUF_TYPE type, UCA_CP * cp)
int remove_key_from_weight_stats_list (const UCA_COLL_KEY * key, UCA_W wv)
int set_next_value_for_coll_key (LOCALE_COLLATION * lc, const UCA_COLL_KEY * coll_key, const UCA_COLL_KEY * next_key)
void sort_coll_key_lists (LOCALE_COLLATION * lc)
void sort_one_coll_key_list (LOCALE_COLLATION * lc, int weight_index)
int string_to_coll_ce_list (char * s, UCA_COLL_CE_LIST * ui)
int uca_comp_func_coll_key (const void * arg1, const void * arg2)
int uca_comp_func_coll_key_fo (const void * arg1, const void * arg2)
int uca_comp_func_coll_list_exp (const void * arg1, const void * arg2)
int uca_comp_func_coll_list_exp_fo (const void * arg1, const void * arg2)

Macros

Type Name
define DUCET_FILE "ducet.txt"
define GET_UCA_WEIGHT (ce_list, i, w) (([**ce\_list**](broker__monitor_8c.md#function-timeout))-&gt;[**ce**](broker__monitor_8c.md#variable-ce)[([**i**](dynamic__load_8c.md#variable-i))].weight[([**w**](broker__monitor_8c.md#function-timeout))])
define MAX_LOGICAL_POS 14
define MAX_UCA_CODEPOINT 0xFFFF
define MAX_UCA_WEIGHT 0xFFFF
define MAX_WEIGHT_LEVELS 4
define SET_UCA_WEIGHT (ce_list, i, w, val) /* multi line expression */
define UCA_CONTR_EXP_CNT_GROW 8
define strlen (s1) (([**int**](broker__monitor_8c.md#function-timeout)) strlen([**s1**](broker__monitor_8c.md#function-timeout)))

Public Types Documentation

typedef UCA_CHR_SEQ

typedef struct uca_chr_seq UCA_CHR_SEQ;

typedef UCA_COLL_CE

typedef struct uca_coll_ce UCA_COLL_CE;

typedef UCA_COLL_CE_LIST

typedef struct uca_coll_ce_list UCA_COLL_CE_LIST;

typedef UCA_COLL_CONTR_ID

typedef struct uca_coll_contr_id UCA_COLL_CONTR_ID;

typedef UCA_COLL_KEY

typedef struct uca_coll_key UCA_COLL_KEY;

enum UCA_COLL_KEY_TYPE

enum UCA_COLL_KEY_TYPE {
    COLL_KEY_TYPE_CP = 0,
    COLL_KEY_TYPE_CONTR,
    COLL_KEY_TYPE_EXP
};

typedef UCA_CONTRACTION

typedef UCA_CHR_SEQ UCA_CONTRACTION;

typedef UCA_EXPANSION

typedef UCA_CHR_SEQ UCA_EXPANSION;

typedef UCA_STORAGE

typedef struct uca_storage UCA_STORAGE;

typedef UCA_WEIGHT_KEY_LIST

typedef struct uca_weight_key_list UCA_WEIGHT_KEY_LIST;

Public Static Attributes Documentation

variable curr_uca

UCA_STORAGE curr_uca;

variable ducet

UCA_STORAGE ducet;

variable logical_pos_cp

int logical_pos_cp[14];

variable uca_tailoring_options

UCA_OPTIONS* uca_tailoring_options;

variable w_occurences

UCA_W* w_occurences[4];

variable weight_key_list

UCA_WEIGHT_KEY_LIST* weight_key_list;

Public Functions Documentation

function uca_free_data

void uca_free_data (
    void
) 

function uca_process_collation

int uca_process_collation (
    LOCALE_COLLATION * lc,
    bool is_verbose
) 

Public Static Functions Documentation

function add_key_to_weight_stats_list

static int add_key_to_weight_stats_list (
    const  UCA_COLL_KEY * key,
    UCA_W wv
) 

function add_opt_coll_contraction

static int add_opt_coll_contraction (
    LOCALE_COLLATION * lc,
    const  UCA_COLL_KEY * contr_key,
    const  unsigned  int wv,
    bool use_expansions
) 

function add_uca_contr_or_exp

static int add_uca_contr_or_exp (
    LOCALE_COLLATION * lc,
    UCA_STORAGE * storage,
    const  unsigned  int * cp_array,
    const  int cp_count,
    const  UCA_COLL_KEY_TYPE seq_type
) 

function apply_absolute_tailoring_rules

static int apply_absolute_tailoring_rules (
    LOCALE_COLLATION * lc
) 

function apply_tailoring_rule

static int apply_tailoring_rule (
    TAILOR_DIR dir,
    UCA_COLL_KEY * anchor_key,
    UCA_COLL_KEY * key,
    UCA_COLL_KEY * ref_key,
    T_LEVEL lvl
) 

function apply_tailoring_rule_identity

static int apply_tailoring_rule_identity (
    UCA_COLL_KEY * key,
    UCA_COLL_KEY * ref_key
) 

function apply_tailoring_rule_w_dir

static int apply_tailoring_rule_w_dir (
    TAILOR_DIR dir,
    UCA_COLL_KEY * anchor_key,
    UCA_COLL_KEY * key,
    UCA_COLL_KEY * ref_key,
    T_LEVEL lvl
) 

function apply_tailoring_rules

static int apply_tailoring_rules (
    LOCALE_COLLATION * lc
) 

function build_compressed_uca_w_l13

static void build_compressed_uca_w_l13 (
    const  UCA_COLL_CE_LIST * ce_list,
    UCA_L13_W * uca_w_l13
) 

function build_key_list_groups

static int build_key_list_groups (
    LOCALE_COLLATION * lc
) 

function build_uca_w_l4

static void build_uca_w_l4 (
    const  UCA_COLL_CE_LIST * ce_list,
    UCA_L4_W * uca_w_l4
) 

function change_key_weight_list

static int change_key_weight_list (
    const  UCA_COLL_KEY * key,
    UCA_W w_from,
    UCA_W w_to
) 

function comp_func_coll_contr_bin

static int comp_func_coll_contr_bin (
    const  void * arg1,
    const  void * arg2
) 

function compare_ce_list

static int compare_ce_list (
    UCA_COLL_CE_LIST * ce_list1,
    UCA_COLL_CE_LIST * ce_list2,
    UCA_OPTIONS * uca_opt
) 

function compute_weights_per_level_stats

static int compute_weights_per_level_stats (
    void
) 

function create_opt_ce_w_exp

static int create_opt_ce_w_exp (
    LOCALE_COLLATION * lc
) 

function create_opt_weights

static int create_opt_weights (
    LOCALE_COLLATION * lc
) 

function destroy_uca_instance

static int destroy_uca_instance (
    void
) 

function find_contr_id

static int find_contr_id (
    const  unsigned  int * cp_array,
    const  int cp_count,
    UCA_STORAGE * st
) 

function find_exp_id

static int find_exp_id (
    const  unsigned  int * cp_array,
    const  int cp_count,
    UCA_STORAGE * st
) 

function get_ce_list_from_coll_key

static UCA_COLL_CE_LIST * get_ce_list_from_coll_key (
    const  UCA_COLL_KEY * key
) 

function get_key_with_ce_sublist

static UCA_COLL_KEY * get_key_with_ce_sublist (
    UCA_COLL_CE_LIST * uca_item,
    const  int lvl
) 

function init_uca_instance

static int init_uca_instance (
    LOCALE_COLLATION * lc
) 

function load_ducet

static int load_ducet (
    const  char * file_path,
    const  int sett_contr_policy
) 

function make_coll_key

static void make_coll_key (
    UCA_COLL_KEY * key,
    UCA_COLL_KEY_TYPE type,
    const  int key_id
) 

function new_contraction

static UCA_CONTRACTION * new_contraction (
    UCA_STORAGE * storage
) 

function new_expansion

static UCA_EXPANSION * new_expansion (
    UCA_STORAGE * storage
) 

function optimize_coll_contractions

static int optimize_coll_contractions (
    LOCALE_COLLATION * lc
) 

function read_cp_from_tag

static int read_cp_from_tag (
    unsigned  char * buffer,
    CP_BUF_TYPE type,
    UCA_CP * cp
) 

function remove_key_from_weight_stats_list

static int remove_key_from_weight_stats_list (
    const  UCA_COLL_KEY * key,
    UCA_W wv
) 

function set_next_value_for_coll_key

static int set_next_value_for_coll_key (
    LOCALE_COLLATION * lc,
    const  UCA_COLL_KEY * coll_key,
    const  UCA_COLL_KEY * next_key
) 

function sort_coll_key_lists

static void sort_coll_key_lists (
    LOCALE_COLLATION * lc
) 

function sort_one_coll_key_list

static void sort_one_coll_key_list (
    LOCALE_COLLATION * lc,
    int weight_index
) 

function string_to_coll_ce_list

static int string_to_coll_ce_list (
    char * s,
    UCA_COLL_CE_LIST * ui
) 

function uca_comp_func_coll_key

static int uca_comp_func_coll_key (
    const  void * arg1,
    const  void * arg2
) 

function uca_comp_func_coll_key_fo

static int uca_comp_func_coll_key_fo (
    const  void * arg1,
    const  void * arg2
) 

function uca_comp_func_coll_list_exp

static int uca_comp_func_coll_list_exp (
    const  void * arg1,
    const  void * arg2
) 

function uca_comp_func_coll_list_exp_fo

static int uca_comp_func_coll_list_exp_fo (
    const  void * arg1,
    const  void * arg2
) 

Macro Definition Documentation

define DUCET_FILE

#define DUCET_FILE `"ducet.txt"`

define GET_UCA_WEIGHT

#define GET_UCA_WEIGHT (
    ce_list,
    i,
    w
) `(( ce_list )-> ce [( i )].weight[( w )])`

define MAX_LOGICAL_POS

#define MAX_LOGICAL_POS `14`

define MAX_UCA_CODEPOINT

#define MAX_UCA_CODEPOINT `0xFFFF`

define MAX_UCA_WEIGHT

#define MAX_UCA_WEIGHT `0xFFFF`

define MAX_WEIGHT_LEVELS

#define MAX_WEIGHT_LEVELS `4`

define SET_UCA_WEIGHT

#define SET_UCA_WEIGHT (
    ce_list,
    i,
    w,
    val
) `/* multi line expression */`

define UCA_CONTR_EXP_CNT_GROW

#define UCA_CONTR_EXP_CNT_GROW `8`

define strlen

#define strlen (
    s1
) `(( int ) strlen( s1 ))`


The documentation for this class was generated from the following file cubrid/src/base/uca_support.c