utf_8.c File Reference
`#include "regenc.h"`

Go to the source code of this file.

## Macros

#define | USE_INVALID_CODE_SCHEME
#define | INVALID_CODE_FE 0xfffffffe
#define | INVALID_CODE_FF 0xffffffff
#define | VALID_CODE_LIMIT 0x7fffffff
#define | utf8_islead(c) ((UChar )((c) & 0xc0) != 0x80)
#define | A ACCEPT
#define | F FAILURE
#define | UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80)
#define | UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80)

## Enumerations

enum

state_t {
FAILURE = -2, ACCEPT = -1, S0 = 0, S1,
FAILURE = -2, ACCEPT = -1, S0 = 0, S1,
FAILURE = -2, ACCEPT = -1, S0 = 0, S1,
S2, S3, S4, S5,
S6, FAILURE = -2, ACCEPT = -1, S0 = 0,
S1, S2, FAILURE = -2, ACCEPT = -1,
S0 = 0, S1, FAILURE = -2, ACCEPT = -1,
S0 = 0, S1, S2, S3,
FAILURE = -2, ACCEPT = -1, S0 = 0, S1,
S2, S3, FAILURE = -2, ACCEPT = -1,
S0 = 0, S1, FAILURE = -2, ACCEPT = -1,
S0 = 0, S1, FAILURE = -2, ACCEPT,
S0, S1, S2, S3,
S4, S5, S6, S7
}

## Functions

static int | mbc_enc_len (const UChar *p, const UChar *e, OnigEncoding enc ARG_UNUSED)
static int | is_mbc_newline (const UChar *p, const UChar *end, OnigEncoding enc)
static OnigCodePoint | mbc_to_code (const UChar *p, const UChar *end, OnigEncoding enc)
static int | code_to_mbclen (OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
static int | code_to_mbc (OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
static int | mbc_case_fold (OnigCaseFoldType flag, const UChar **pp, const UChar *end, UChar *fold, OnigEncoding enc)
static int | get_ctype_code_range (OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint *ranges[], OnigEncoding enc ARG_UNUSED)
static UChar * | left_adjust_char_head (const UChar *start, const UChar *s, const UChar *end, OnigEncoding enc ARG_UNUSED)
static int | get_case_fold_codes_by_str (OnigCaseFoldType flag, const OnigUChar *p, const OnigUChar *end, OnigCaseFoldCodeItem items[], OnigEncoding enc)
| OnigEncodingDefine (utf_8, UTF_8)

## Variables

static const int | EncLen_UTF8 []
static const signed char | trans [][0x100]

## Macro Definition Documentation

#define A ACCEPT

Definition at line 68 of file utf_8.c.

#define F FAILURE

Definition at line 69 of file utf_8.c.

#define INVALID_CODE_FE 0xfffffffe

Definition at line 36 of file utf_8.c.

Referenced by code_to_mbc(), code_to_mbclen(), and mbc_to_code().

#define INVALID_CODE_FF 0xffffffff

Definition at line 37 of file utf_8.c.

Referenced by code_to_mbc(), code_to_mbclen(), and mbc_to_code().

#define USE_INVALID_CODE_SCHEME

Definition at line 32 of file utf_8.c.

#define utf8_islead | ( |  | c | ) | ((UChar )((c) & 0xc0) != 0x80)

Definition at line 41 of file utf_8.c.

Referenced by left_adjust_char_head().

#define UTF8_TRAIL0 | ( |  | code | ) | (UChar )(((code) & 0x3f) | 0x80)

Referenced by code_to_mbc().

#define UTF8_TRAILS | ( |  | code,
|  |  | shift
| ) |  | (UChar )((((code) >> (shift)) & 0x3f) | 0x80)

Referenced by code_to_mbc().

#define VALID_CODE_LIMIT 0x7fffffff

Definition at line 38 of file utf_8.c.

## Enumeration Type Documentation

enum state_t

Enumerator
FAILURE |
ACCEPT |
S0 |
S1 |
FAILURE |
ACCEPT |
S0 |
S1 |
FAILURE |
ACCEPT |
S0 |
S1 |
S2 |
S3 |
S4 |
S5 |
S6 |
FAILURE |
ACCEPT |
S0 |
S1 |
S2 |
FAILURE |
ACCEPT |
S0 |
S1 |
FAILURE |
ACCEPT |
S0 |
S1 |
S2 |
S3 |
FAILURE |
ACCEPT |
S0 |
S1 |
S2 |
S3 |
FAILURE |
ACCEPT |
S0 |
S1 |
FAILURE |
ACCEPT |
S0 |
S1 |
FAILURE |
ACCEPT |
S0 |
S1 |
S2 |
S3 |
S4 |
S5 |
S6 |
S7 |

Definition at line 62 of file utf_8.c.

## Function Documentation

static int code_to_mbc | ( | OnigCodePoint | code,
|  | UChar * | buf,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 314 of file utf_8.c.

References buf, INVALID_CODE_FE, INVALID_CODE_FF, ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, p, UChar, UTF8_TRAIL0, and UTF8_TRAILS.

static int code_to_mbclen | ( | OnigCodePoint | code,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 297 of file utf_8.c.

References INVALID_CODE_FE, INVALID_CODE_FF, and ONIGERR_TOO_BIG_WIDE_CHAR_VALUE.

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

static

Definition at line 420 of file utf_8.c.

References onigenc_unicode_get_case_fold_codes_by_str().

static int get_ctype_code_range | ( | OnigCtype | ctype,
|  | OnigCodePoint * | sb_out,
|  | const OnigCodePoint * | ranges[],
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 399 of file utf_8.c.

References onigenc_unicode_ctype_code_range().

static int is_mbc_newline | ( | const UChar * | p,
|  | const UChar * | end,
|  | OnigEncoding | enc
| ) |  |

static

Definition at line 245 of file utf_8.c.

static UChar* left_adjust_char_head | ( | const UChar * | start,
|  | const UChar * | s,
|  | const UChar * | end,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 408 of file utf_8.c.

References p, UChar, and utf8_islead.

static int mbc_case_fold | ( | OnigCaseFoldType | flag,
|  | const UChar ** | pp,
|  | const UChar * | end,
|  | UChar * | fold,
|  | OnigEncoding | enc
| ) |  |

static

Definition at line 371 of file utf_8.c.

References ONIGENC_ASCII_CODE_TO_LOWER_CASE, ONIGENC_CASE_FOLD_TURKISH_AZERI, ONIGENC_IS_MBC_ASCII, onigenc_unicode_mbc_case_fold(), p, and UChar.

static int mbc_enc_len | ( | const UChar * | p,
|  | const UChar * | e,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 220 of file utf_8.c.

References ACCEPT, EncLen_UTF8, ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND, ONIGENC_CONSTRUCT_MBCLEN_INVALID, ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE, and trans.

static OnigCodePoint mbc_to_code | ( | const UChar * | p,
|  | const UChar * | end,
|  | OnigEncoding | enc
| ) |  |

static

Definition at line 270 of file utf_8.c.

References enclen, INVALID_CODE_FE, INVALID_CODE_FF, and len.

OnigEncodingDefine | ( | utf_8 | ,
|  | UTF_8 |
| ) |  |

## Variable Documentation

const int EncLen_UTF8[]

static

Initial value:
= {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}

Definition at line 43 of file utf_8.c.

Referenced by mbc_enc_len().

const signed char trans[][0x100]

static

Definition at line 70 of file utf_8.c.

Referenced by mbc_enc_len().