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

Go to the source code of this file.

## Macros

#define | A ACCEPT
#define | F FAILURE
#define | RETURN(n)
#define | BIG5_HKSCS_P(enc) ((enc)->precise_mbc_enc_len == big5_hkscs_mbc_enc_len)
#define | BIG5_UAO_P(enc) ((enc)->precise_mbc_enc_len == big5_uao_mbc_enc_len)
#define | BIG5_ISMB_FIRST(byte)
#define | BIG5_ISMB_TRAIL(byte) BIG5_CAN_BE_TRAIL_TABLE[(byte)]

## 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 | big5_mbc_enc_len0 (const UChar *p, const UChar *e, int tridx, const int tbl[])
static int | big5_mbc_enc_len (const UChar *p, const UChar *e, OnigEncoding enc ARG_UNUSED)
static int | big5_hkscs_mbc_enc_len (const UChar *p, const UChar *e, OnigEncoding enc ARG_UNUSED)
static int | big5_uao_mbc_enc_len (const UChar *p, const UChar *e, OnigEncoding enc ARG_UNUSED)
static OnigCodePoint | big5_mbc_to_code (const UChar *p, const UChar *end, OnigEncoding enc)
static int | big5_code_to_mbc (OnigCodePoint code, UChar *buf, OnigEncoding enc)
static int | big5_mbc_case_fold (OnigCaseFoldType flag, const UChar **pp, const UChar *end, UChar *lower, OnigEncoding enc)
static int | big5_is_code_ctype (OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
static UChar * | big5_left_adjust_char_head (const UChar *start, const UChar *s, const UChar *end, OnigEncoding enc)
static int | big5_is_allowed_reverse_match (const UChar *s, const UChar *end ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
| OnigEncodingDefine (big5, BIG5)
| OnigEncodingDefine (big5_hkscs, BIG5_HKSCS)
| OnigEncodingDefine (big5_uao, BIG5_UAO)

## Variables

static const int | EncLen_BIG5 []
static const int | EncLen_BIG5_HKSCS []
static const int | EncLen_BIG5_UAO []
static const signed char | trans [][0x100]
static const char | BIG5_CAN_BE_TRAIL_TABLE [256]

## Macro Definition Documentation

#define A ACCEPT

Definition at line 91 of file big5.c.

#define BIG5_HKSCS_P | ( |  | enc | ) | ((enc)->precise_mbc_enc_len == big5_hkscs_mbc_enc_len)

Definition at line 239 of file big5.c.

#define BIG5_ISMB_FIRST | ( |  | byte | ) |

Value:
( \
BIG5_HKSCS_P(enc) ? EncLen_BIG5_HKSCS[byte] > 1 : \
EncLen_BIG5[byte] > 1 \
)

Definition at line 242 of file big5.c.

Referenced by big5_left_adjust_char_head().

#define BIG5_ISMB_TRAIL | ( |  | byte | ) | BIG5_CAN_BE_TRAIL_TABLE[(byte)]

Definition at line 246 of file big5.c.

Referenced by big5_is_allowed_reverse_match(), and big5_left_adjust_char_head().

#define BIG5_UAO_P | ( |  | enc | ) | ((enc)->precise_mbc_enc_len == big5_uao_mbc_enc_len)

Definition at line 240 of file big5.c.

#define F FAILURE

Definition at line 92 of file big5.c.

#define RETURN | ( |  | n | ) |

Value:
return s == ACCEPT ? ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) : \
ONIGENC_CONSTRUCT_MBCLEN_INVALID()

## 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 90 of file big5.c.

## Function Documentation

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

static

Definition at line 192 of file big5.c.

References onigenc_mb2_code_to_mbc().

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

static

Definition at line 174 of file big5.c.

References big5_mbc_enc_len0(), and EncLen_BIG5_HKSCS.

static int big5_is_allowed_reverse_match | ( | const UChar * | s,
|  | const UChar *end | ARG_UNUSED,
|  | OnigEncoding enc | ARG_UNUSED
| ) |  |

static

Definition at line 272 of file big5.c.

References BIG5_ISMB_TRAIL, FALSE, TRUE, and UChar.

static int big5_is_code_ctype | ( | OnigCodePoint | code,
|  | unsigned int | ctype,
|  | OnigEncoding | enc
| ) |  |

static

Definition at line 215 of file big5.c.

References onigenc_mb2_is_code_ctype().

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

static

Definition at line 249 of file big5.c.

References BIG5_ISMB_FIRST, BIG5_ISMB_TRAIL, enclen, len, p, and UChar.

static int big5_mbc_case_fold | ( | OnigCaseFoldType | flag,
|  | const UChar ** | pp,
|  | const UChar * | end,
|  | UChar * | lower,
|  | OnigEncoding | enc
| ) |  |

static

Definition at line 198 of file big5.c.

References onigenc_mbn_mbc_case_fold().

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

static

Definition at line 168 of file big5.c.

References big5_mbc_enc_len0(), and EncLen_BIG5.

static int big5_mbc_enc_len0 | ( | const UChar * | p,
|  | const UChar * | e,
|  | int | tridx,
|  | const int | tbl[]
| ) |  |

static

Definition at line 153 of file big5.c.

References ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE, RETURN, and trans.

Referenced by big5_hkscs_mbc_enc_len(), big5_mbc_enc_len(), and big5_uao_mbc_enc_len().

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

static

Definition at line 186 of file big5.c.

References onigenc_mbn_mbc_to_code().

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

static

Definition at line 180 of file big5.c.

References big5_mbc_enc_len0(), and EncLen_BIG5_UAO.

OnigEncodingDefine | ( | big5 | ,
|  | BIG5 |
| ) |  |

OnigEncodingDefine | ( | big5_hkscs | ,
|  | BIG5_HKSCS |
| ) |  |

OnigEncodingDefine | ( | big5_uao | ,
|  | BIG5_UAO |
| ) |  |

## Variable Documentation

const char BIG5_CAN_BE_TRAIL_TABLE[256]

static

Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1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 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, 2, 2, 2, 2, 2, 1
}

Definition at line 32 of file big5.c.

Referenced by big5_mbc_enc_len().

const int EncLen_BIG5_HKSCS[]

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, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
}

Definition at line 50 of file big5.c.

Referenced by big5_hkscs_mbc_enc_len().

const int EncLen_BIG5_UAO[]

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, 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, 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, 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, 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, 1,
}

Definition at line 70 of file big5.c.

Referenced by big5_uao_mbc_enc_len().

const signed char trans[][0x100]

static

Definition at line 93 of file big5.c.

Referenced by big5_mbc_enc_len0(), encodes(), and tr_trans().