Ruby  1.9.3p429(2013-05-15revision40747)
Macros | Enumerations | Functions | Variables
shift_jis.c File Reference
#include "regint.h"

Go to the source code of this file.

Macros

#define SJIS_ISMB_FIRST(byte)   (EncLen_SJIS[byte] > 1)
 
#define SJIS_ISMB_TRAIL(byte)   SJIS_CAN_BE_TRAIL_TABLE[(byte)]
 
#define A   ACCEPT
 
#define F   FAILURE
 

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 code_to_mbclen (OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
 
static OnigCodePoint mbc_to_code (const UChar *p, const UChar *end, OnigEncoding enc)
 
static int code_to_mbc (OnigCodePoint code, UChar *buf, OnigEncoding enc)
 
static int mbc_case_fold (OnigCaseFoldType flag, const UChar **pp, const UChar *end, UChar *lower, OnigEncoding enc)
 
static UCharleft_adjust_char_head (const UChar *start, const UChar *s, const UChar *end, OnigEncoding enc)
 
static int is_allowed_reverse_match (const UChar *s, const UChar *end, OnigEncoding enc ARG_UNUSED)
 
static int init_property_list (void)
 
static int property_name_to_ctype (OnigEncoding enc, UChar *p, UChar *end)
 
static int is_code_ctype (OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
 
static int get_ctype_code_range (OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint *ranges[], OnigEncoding enc ARG_UNUSED)
 
 OnigEncodingDefine (shift_jis, Shift_JIS)
 

Variables

static const int EncLen_SJIS []
 
static const char SJIS_CAN_BE_TRAIL_TABLE [256]
 
static const signed char trans [][0x100]
 
static int PropertyInited = 0
 
static const OnigCodePoint ** PropertyList
 
static int PropertyListNum
 
static int PropertyListSize
 
static hash_table_typePropertyNameTable
 
static const OnigCodePoint CR_Hiragana []
 
static const OnigCodePoint CR_Katakana []
 

Macro Definition Documentation

#define A   ACCEPT

Definition at line 74 of file shift_jis.c.

#define F   FAILURE

Definition at line 75 of file shift_jis.c.

#define SJIS_ISMB_FIRST (   byte)    (EncLen_SJIS[byte] > 1)

Definition at line 70 of file shift_jis.c.

Referenced by left_adjust_char_head().

#define SJIS_ISMB_TRAIL (   byte)    SJIS_CAN_BE_TRAIL_TABLE[(byte)]

Definition at line 71 of file shift_jis.c.

Referenced by is_allowed_reverse_match(), and left_adjust_char_head().

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 73 of file shift_jis.c.

Function Documentation

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

Definition at line 167 of file shift_jis.c.

References buf, enclen, p, and UChar.

static int code_to_mbclen ( OnigCodePoint  code,
OnigEncoding enc  ARG_UNUSED 
)
static
static int get_ctype_code_range ( OnigCtype  ctype,
OnigCodePoint sb_out,
const OnigCodePoint ranges[],
OnigEncoding enc  ARG_UNUSED 
)
static
static int init_property_list ( void  )
static

Definition at line 282 of file shift_jis.c.

References PROPERTY_LIST_ADD_PROP.

static int is_allowed_reverse_match ( const UChar s,
const UChar end,
OnigEncoding enc  ARG_UNUSED 
)
static

Definition at line 255 of file shift_jis.c.

References FALSE, SJIS_ISMB_TRAIL, TRUE, and UChar.

static int is_code_ctype ( OnigCodePoint  code,
unsigned int  ctype,
OnigEncoding enc   
)
static
static UChar* left_adjust_char_head ( const UChar start,
const UChar s,
const UChar end,
OnigEncoding enc   
)
static

Definition at line 232 of file shift_jis.c.

References enclen, len, p, SJIS_ISMB_FIRST, SJIS_ISMB_TRAIL, and UChar.

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

Definition at line 182 of file shift_jis.c.

References enclen, i, len, ONIGENC_ASCII_CODE_TO_LOWER_CASE, ONIGENC_IS_MBC_ASCII, p, and UChar.

static int mbc_enc_len ( const UChar p,
const UChar e,
OnigEncoding enc  ARG_UNUSED 
)
static
static OnigCodePoint mbc_to_code ( const UChar p,
const UChar end,
OnigEncoding  enc 
)
static

Definition at line 148 of file shift_jis.c.

References enclen, i, and len.

OnigEncodingDefine ( shift_jis  ,
Shift_JIS   
)
static int property_name_to_ctype ( OnigEncoding  enc,
UChar p,
UChar end 
)
static

Variable Documentation

const OnigCodePoint CR_Hiragana[]
static
Initial value:
= {
1,
0x829f, 0x82f1
}

Definition at line 268 of file shift_jis.c.

const OnigCodePoint CR_Katakana[]
static
Initial value:
= {
4,
0x00a6, 0x00af,
0x00b1, 0x00dd,
0x8340, 0x837e,
0x8380, 0x8396,
}

Definition at line 273 of file shift_jis.c.

const int EncLen_SJIS[]
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,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1
}

Definition at line 32 of file shift_jis.c.

Referenced by code_to_mbclen(), and mbc_enc_len().

int PropertyInited = 0
static

Definition at line 262 of file shift_jis.c.

const OnigCodePoint** PropertyList
static

Definition at line 263 of file shift_jis.c.

int PropertyListNum
static

Definition at line 264 of file shift_jis.c.

Referenced by get_ctype_code_range(), and is_code_ctype().

int PropertyListSize
static

Definition at line 265 of file shift_jis.c.

hash_table_type* PropertyNameTable
static

Definition at line 266 of file shift_jis.c.

const char SJIS_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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 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, 0, 0
}

Definition at line 51 of file shift_jis.c.

const signed char trans[][0x100]
static

Definition at line 76 of file shift_jis.c.

Referenced by mbc_enc_len().