unicode.c File Reference
`#include "regint.h"`
`#include "enc/unicode/name2ctype.h"`
`#include "ruby/st.h"`

Go to the source code of this file.

## Data Structures

struct | CodePointList3
struct | CaseFold_11_Type
struct | CaseUnfold_11_Type
struct | CodePointList2
struct | CaseUnfold_12_Type
struct | CaseUnfold_13_Type

## Macros

#define | ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code, ctype) ((EncUNICODE_ISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define | CODE_RANGES_NUM numberof(CodeRanges)
#define | PROPERTY_NAME_MAX_SIZE MAX_WORD_LENGTH

## Functions

int | onigenc_unicode_is_code_ctype (OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
int | onigenc_unicode_ctype_code_range (int ctype, const OnigCodePoint *ranges[])
int | onigenc_utf16_32_get_ctype_code_range (OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint *ranges[], struct OnigEncodingTypeST *enc ARG_UNUSED)
int | onigenc_unicode_property_name_to_ctype (OnigEncoding enc, UChar *name, UChar *end)
static int | code2_cmp (OnigCodePoint *x, OnigCodePoint *y)
static st_index_t | code2_hash (OnigCodePoint *x)
static int | code3_cmp (OnigCodePoint *x, OnigCodePoint *y)
static st_index_t | code3_hash (OnigCodePoint *x)
static int | init_case_fold_table (void)
int | onigenc_unicode_mbc_case_fold (OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED, const UChar **pp, const UChar *end, UChar *fold)
int | onigenc_unicode_apply_all_case_fold (OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void *arg, OnigEncoding enc ARG_UNUSED)
int | onigenc_unicode_get_case_fold_codes_by_str (OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar *p, const OnigUChar *end, OnigCaseFoldCodeItem items[])

## Variables

static const unsigned short | EncUNICODE_ISO_8859_1_CtypeTable [256]
static const CaseFold_11_Type | CaseFold []
static const CaseFold_11_Type | CaseFold_Locale []
static const CaseUnfold_11_Type | CaseUnfold_11 []
static const CaseUnfold_11_Type | CaseUnfold_11_Locale []
static const CaseUnfold_12_Type | CaseUnfold_12 []
static const CaseUnfold_12_Type | CaseUnfold_12_Locale []
static const CaseUnfold_13_Type | CaseUnfold_13 []
static struct st_hash_type | type_code2_hash
static struct st_hash_type | type_code3_hash
static st_table * | FoldTable
static st_table * | Unfold1Table
static st_table * | Unfold2Table
static st_table * | Unfold3Table
static int | CaseFoldInited = 0

## Macro Definition Documentation

#define CODE_RANGES_NUM numberof(CodeRanges)

Definition at line 2039 of file unicode.c.

Referenced by onigenc_unicode_ctype_code_range(), and onigenc_unicode_is_code_ctype().

#define numberof | ( |  | array | ) | (int)(sizeof(array) / sizeof((array)[0]))

Definition at line 2038 of file unicode.c.

Referenced by init_case_fold_table(), and onigenc_unicode_apply_all_case_fold().

#define ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE | ( |  | code,
|  |  | ctype
| ) |  | ((EncUNICODE_ISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)

Definition at line 32 of file unicode.c.

Referenced by onigenc_unicode_is_code_ctype().

#define PROPERTY_NAME_MAX_SIZE MAX_WORD_LENGTH

Definition at line 2083 of file unicode.c.

Referenced by onigenc_unicode_property_name_to_ctype().

## Function Documentation

static int code2_cmp | ( | OnigCodePoint * | x,
|  | OnigCodePoint * | y
| ) |  |

static

Definition at line 2118 of file unicode.c.

static st_index_t code2_hash | ( | OnigCodePoint * | x | ) |

static

Definition at line 2125 of file unicode.c.

static int code3_cmp | ( | OnigCodePoint * | x,
|  | OnigCodePoint * | y
| ) |  |

static

Definition at line 2136 of file unicode.c.

static st_index_t code3_hash | ( | OnigCodePoint * | x | ) |

static

Definition at line 2143 of file unicode.c.

static int init_case_fold_table | ( | void |  | ) |

static

Definition at line 2160 of file unicode.c.

References CaseFoldInited, CaseFold_11_Type::from, CaseUnfold_11_Type::from, CaseUnfold_12_Type::from, CaseUnfold_13_Type::from, i, numberof, ONIG_IS_NULL, ONIGERR_MEMORY, p, st_add_direct, st_init_numtable_with_size, st_init_table_with_size, THREAD_ATOMIC_END, THREAD_ATOMIC_START, CaseFold_11_Type::to, CaseUnfold_11_Type::to, CaseUnfold_12_Type::to, and CaseUnfold_13_Type::to.

Referenced by onigenc_unicode_get_case_fold_codes_by_str(), and onigenc_unicode_mbc_case_fold().

int onigenc_unicode_apply_all_case_fold | ( | OnigCaseFoldType | flag,
|  | OnigApplyAllCaseFoldFunc | f,
|  | void * | arg,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

Definition at line 2273 of file unicode.c.

References arg, CodePointList3::code, CodePointList2::code, CaseUnfold_11_Type::from, i, INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR, CodePointList3::n, CodePointList2::n, numberof, ONIGENC_CASE_FOLD_TURKISH_AZERI, CaseUnfold_11_Type::to, CaseUnfold_12_Type::to, and CaseUnfold_13_Type::to.

int onigenc_unicode_ctype_code_range | ( | int | ctype,
|  | const OnigCodePoint * | ranges[]
| ) |  |

Definition at line 2061 of file unicode.c.

References CODE_RANGES_NUM, CodeRanges, and ONIGERR_TYPE_BUG.

Referenced by get_ctype_code_range(), and onigenc_utf16_32_get_ctype_code_range().

int onigenc_unicode_get_case_fold_codes_by_str | ( | OnigEncoding | enc,
|  | OnigCaseFoldType | flag,
|  | const OnigUChar * | p,
|  | const OnigUChar * | end,
|  | OnigCaseFoldCodeItem | items[]
| ) |  |

Definition at line 2409 of file unicode.c.

References OnigCaseFoldCodeItem::byte_len, CaseFoldInited, CodePointList3::code, CodePointList2::code, OnigCaseFoldCodeItem::code, OnigCaseFoldCodeItem::code_len, enclen, i, init_case_fold_table(), INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR, len, CodePointList3::n, CodePointList2::n, ONIGENC_CASE_FOLD_TURKISH_AZERI, and ONIGENC_MBC_TO_CODE.

Referenced by get_case_fold_codes_by_str(), utf16be_get_case_fold_codes_by_str(), utf16le_get_case_fold_codes_by_str(), utf32be_get_case_fold_codes_by_str(), and utf32le_get_case_fold_codes_by_str().

int onigenc_unicode_is_code_ctype | ( | OnigCodePoint | code,
|  | unsigned int | ctype,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

Definition at line 2042 of file unicode.c.

References CODE_RANGES_NUM, CodeRanges, onig_is_in_code_range(), ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE, ONIGENC_MAX_STD_CTYPE, ONIGERR_TYPE_BUG, UChar, and USE_UNICODE_PROPERTIES.

int onigenc_unicode_mbc_case_fold | ( | OnigEncoding | enc,
|  | OnigCaseFoldType flag | ARG_UNUSED,
|  | const UChar ** | pp,
|  | const UChar * | end,
|  | UChar * | fold
| ) |  |

Definition at line 2219 of file unicode.c.

References CaseFoldInited, CodePointList3::code, enclen, i, init_case_fold_table(), INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR, len, CodePointList3::n, ONIGENC_CASE_FOLD_TURKISH_AZERI, ONIGENC_CODE_TO_MBC, ONIGENC_MBC_TO_CODE, p, and UChar.

Referenced by mbc_case_fold(), utf16be_mbc_case_fold(), utf16le_mbc_case_fold(), utf32be_mbc_case_fold(), and utf32le_mbc_case_fold().

int onigenc_unicode_property_name_to_ctype | ( | OnigEncoding | enc,
|  | UChar * | name,
|  | UChar * | end
| ) |  |

Definition at line 2086 of file unicode.c.

References buf, enclen, len, ONIGENC_MBC_TO_CODE, ONIGERR_INVALID_CHAR_PROPERTY_NAME, p, PROPERTY_NAME_MAX_SIZE, TOLOWER, UChar, and uniname2ctype().

int onigenc_utf16_32_get_ctype_code_range | ( | OnigCtype | ctype,
|  | OnigCodePoint * | sb_out,
|  | const OnigCodePoint * | ranges[],
|  | struct OnigEncodingTypeST *enc | ARG_UNUSED
| ) |  |

Definition at line 2073 of file unicode.c.

References onigenc_unicode_ctype_code_range().

## Variable Documentation

const CaseFold_11_Type CaseFold[]

static

Definition at line 106 of file unicode.c.

const CaseFold_11_Type CaseFold_Locale[]

static

Initial value:
= {
{ 0x0049, {1, {0x0069}}},
{ 0x0130, {2, {0x0069, 0x0307}}}
}

Definition at line 1088 of file unicode.c.

int CaseFoldInited = 0

static

Definition at line 2158 of file unicode.c.

Referenced by init_case_fold_table(), onigenc_unicode_get_case_fold_codes_by_str(), and onigenc_unicode_mbc_case_fold().

const CaseUnfold_11_Type CaseUnfold_11[]

static

Definition at line 1093 of file unicode.c.

const CaseUnfold_11_Type CaseUnfold_11_Locale[]

static

Initial value:
= {
{ 0x0069, {1, {0x0049 }}}
}

Definition at line 1952 of file unicode.c.

const CaseUnfold_12_Type CaseUnfold_12[]

static

Definition at line 1956 of file unicode.c.

const CaseUnfold_12_Type CaseUnfold_12_Locale[]

static

Initial value:
= {
{ {0x0069, 0x0307}, {1, {0x0130 }}}
}

Definition at line 2017 of file unicode.c.

const CaseUnfold_13_Type CaseUnfold_13[]

static

Initial value:
= {
{ {0x0066, 0x0066, 0x0069}, {1, {0xfb03 }}},
{ {0x0066, 0x0066, 0x006c}, {1, {0xfb04 }}},
{ {0x03b1, 0x0342, 0x03b9}, {1, {0x1fb7 }}},
{ {0x03b7, 0x0342, 0x03b9}, {1, {0x1fc7 }}},
{ {0x03b9, 0x0308, 0x0300}, {1, {0x1fd2 }}},
{ {0x03b9, 0x0308, 0x0301}, {2, {0x0390, 0x1fd3 }}},
{ {0x03b9, 0x0308, 0x0342}, {1, {0x1fd7 }}},
{ {0x03c5, 0x0308, 0x0300}, {1, {0x1fe2 }}},
{ {0x03c5, 0x0308, 0x0301}, {2, {0x03b0, 0x1fe3 }}},
{ {0x03c5, 0x0308, 0x0342}, {1, {0x1fe7 }}},
{ {0x03c5, 0x0313, 0x0300}, {1, {0x1f52 }}},
{ {0x03c5, 0x0313, 0x0301}, {1, {0x1f54 }}},
{ {0x03c5, 0x0313, 0x0342}, {1, {0x1f56 }}},
{ {0x03c9, 0x0342, 0x03b9}, {1, {0x1ff7 }}}
}

Definition at line 2021 of file unicode.c.

const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256]

static

Definition at line 39 of file unicode.c.

st_table* FoldTable

static

Definition at line 2154 of file unicode.c.

struct st_hash_type type_code2_hash

static

Initial value:
= {
code2_cmp,
code2_hash,
}

Definition at line 2130 of file unicode.c.

struct st_hash_type type_code3_hash

static

Initial value:
= {
code3_cmp,
code3_hash,
}

Definition at line 2148 of file unicode.c.

st_table* Unfold1Table

static

Definition at line 2155 of file unicode.c.

st_table* Unfold2Table

static

Definition at line 2156 of file unicode.c.

st_table* Unfold3Table

static

Definition at line 2157 of file unicode.c.