зеркало из https://github.com/github/ruby.git
This commit was generated by cvs2svn to compensate for changes in r8021,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c36a0f0ec0
Коммит
f052429aa5
28
euc_jp.c
28
euc_jp.c
|
@ -2,7 +2,7 @@
|
|||
euc_jp.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -51,13 +51,13 @@ static int EncLen_EUCJP[] = {
|
|||
};
|
||||
|
||||
static int
|
||||
eucjp_mbc_enc_len(UChar* p)
|
||||
eucjp_mbc_enc_len(const UChar* p)
|
||||
{
|
||||
return EncLen_EUCJP[*p];
|
||||
}
|
||||
|
||||
static OnigCodePoint
|
||||
eucjp_mbc_to_code(UChar* p, UChar* end)
|
||||
eucjp_mbc_to_code(const UChar* p, const UChar* end)
|
||||
{
|
||||
int c, i, len;
|
||||
OnigCodePoint n;
|
||||
|
@ -119,11 +119,11 @@ eucjp_code_to_mbc(OnigCodePoint code, UChar *buf)
|
|||
}
|
||||
|
||||
static int
|
||||
eucjp_mbc_to_normalize(OnigAmbigType flag, UChar** pp, UChar* end,
|
||||
UChar* lower)
|
||||
eucjp_mbc_to_normalize(OnigAmbigType flag,
|
||||
const UChar** pp, const UChar* end, UChar* lower)
|
||||
{
|
||||
int len;
|
||||
UChar* p = *pp;
|
||||
const UChar* p = *pp;
|
||||
|
||||
if (ONIGENC_IS_MBC_ASCII(p)) {
|
||||
if ((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0) {
|
||||
|
@ -150,7 +150,7 @@ eucjp_mbc_to_normalize(OnigAmbigType flag, UChar** pp, UChar* end,
|
|||
}
|
||||
|
||||
static int
|
||||
eucjp_is_mbc_ambiguous(OnigAmbigType flag, UChar** pp, UChar* end)
|
||||
eucjp_is_mbc_ambiguous(OnigAmbigType flag, const UChar** pp, const UChar* end)
|
||||
{
|
||||
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_EUC_JP, flag, pp, end);
|
||||
}
|
||||
|
@ -175,28 +175,28 @@ eucjp_is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
|||
}
|
||||
|
||||
static UChar*
|
||||
eucjp_left_adjust_char_head(UChar* start, UChar* s)
|
||||
eucjp_left_adjust_char_head(const UChar* start, const UChar* s)
|
||||
{
|
||||
/* In this encoding
|
||||
mb-trail bytes doesn't mix with single bytes.
|
||||
*/
|
||||
UChar *p;
|
||||
const UChar *p;
|
||||
int len;
|
||||
|
||||
if (s <= start) return s;
|
||||
if (s <= start) return (UChar* )s;
|
||||
p = s;
|
||||
|
||||
while (!eucjp_islead(*p) && p > start) p--;
|
||||
len = enc_len(ONIG_ENCODING_EUC_JP, p);
|
||||
if (p + len > s) return p;
|
||||
if (p + len > s) return (UChar* )p;
|
||||
p += len;
|
||||
return p + ((s - p) & ~1);
|
||||
return (UChar* )(p + ((s - p) & ~1));
|
||||
}
|
||||
|
||||
static int
|
||||
eucjp_is_allowed_reverse_match(UChar* s, UChar* end)
|
||||
eucjp_is_allowed_reverse_match(const UChar* s, const UChar* end)
|
||||
{
|
||||
UChar c = *s;
|
||||
const UChar c = *s;
|
||||
if (c <= 0x7e || c == 0x8e || c == 0x8f)
|
||||
return TRUE;
|
||||
else
|
||||
|
|
19
oniggnu.h
19
oniggnu.h
|
@ -4,7 +4,7 @@
|
|||
oniggnu.h - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,12 +44,17 @@ extern "C" {
|
|||
#ifndef RE_NREGS
|
||||
#define RE_NREGS ONIG_NREGION
|
||||
#endif
|
||||
#define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE
|
||||
#define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND
|
||||
#define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE
|
||||
#define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE
|
||||
#define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST
|
||||
#define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE)
|
||||
|
||||
#define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE
|
||||
#define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND
|
||||
#define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE
|
||||
#define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE
|
||||
#define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST
|
||||
#define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE)
|
||||
#define RE_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY
|
||||
#define RE_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE
|
||||
#define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP
|
||||
#define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP
|
||||
|
||||
#ifdef RUBY_PLATFORM
|
||||
|
||||
|
|
90
regenc.c
90
regenc.c
|
@ -2,7 +2,7 @@
|
|||
regenc.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -51,7 +51,7 @@ onigenc_set_default_encoding(OnigEncoding enc)
|
|||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_get_right_adjust_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
||||
onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
|
||||
{
|
||||
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s);
|
||||
if (p < s) {
|
||||
|
@ -62,22 +62,22 @@ onigenc_get_right_adjust_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
|||
|
||||
extern UChar*
|
||||
onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
|
||||
UChar* start, UChar* s, UChar** prev)
|
||||
const UChar* start, const UChar* s, const UChar** prev)
|
||||
{
|
||||
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s);
|
||||
|
||||
if (p < s) {
|
||||
if (prev) *prev = p;
|
||||
if (prev) *prev = (const UChar* )p;
|
||||
p += enc_len(enc, p);
|
||||
}
|
||||
else {
|
||||
if (prev) *prev = (UChar* )NULL; /* Sorry */
|
||||
if (prev) *prev = (const UChar* )NULL; /* Sorry */
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_get_prev_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
||||
onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
|
||||
{
|
||||
if (s <= start)
|
||||
return (UChar* )NULL;
|
||||
|
@ -86,7 +86,7 @@ onigenc_get_prev_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
|||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_step_back(OnigEncoding enc, UChar* start, UChar* s, int n)
|
||||
onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, int n)
|
||||
{
|
||||
while (ONIG_IS_NOT_NULL(s) && n-- > 0) {
|
||||
if (s <= start)
|
||||
|
@ -94,35 +94,38 @@ onigenc_step_back(OnigEncoding enc, UChar* start, UChar* s, int n)
|
|||
|
||||
s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s - 1);
|
||||
}
|
||||
return s;
|
||||
return (UChar* )s;
|
||||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_step(OnigEncoding enc, UChar* p, UChar* end, int n)
|
||||
onigenc_step(OnigEncoding enc, const UChar* p, const UChar* end, int n)
|
||||
{
|
||||
UChar* q = (UChar* )p;
|
||||
while (n-- > 0) {
|
||||
p += ONIGENC_MBC_ENC_LEN(enc, p);
|
||||
q += ONIGENC_MBC_ENC_LEN(enc, q);
|
||||
}
|
||||
return (p <= end ? p : (UChar* )NULL);
|
||||
return (q <= end ? q : NULL);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_strlen(OnigEncoding enc, UChar* p, UChar* end)
|
||||
onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
while (p < end) {
|
||||
p += ONIGENC_MBC_ENC_LEN(enc, p);
|
||||
UChar* q = (UChar* )p;
|
||||
|
||||
while (q < end) {
|
||||
q += ONIGENC_MBC_ENC_LEN(enc, q);
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_strlen_null(OnigEncoding enc, UChar* p)
|
||||
onigenc_strlen_null(OnigEncoding enc, const UChar* s)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
UChar* p = (UChar* )s;
|
||||
|
||||
while (1) {
|
||||
if (*p == '\0') {
|
||||
UChar* q;
|
||||
|
@ -143,9 +146,10 @@ onigenc_strlen_null(OnigEncoding enc, UChar* p)
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_str_bytelen_null(OnigEncoding enc, UChar* p)
|
||||
onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
|
||||
{
|
||||
UChar* start = p;
|
||||
UChar* start = (UChar* )s;
|
||||
UChar* p = (UChar* )s;
|
||||
|
||||
while (1) {
|
||||
if (*p == '\0') {
|
||||
|
@ -207,10 +211,10 @@ unsigned short OnigEnc_Unicode_ISO_8859_1_CtypeTable[256] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
UChar* OnigEncAsciiToLowerCaseTable = (UChar* )0;
|
||||
const UChar* OnigEncAsciiToLowerCaseTable = (const UChar* )0;
|
||||
|
||||
#ifndef USE_APPLICATION_TO_LOWER_CASE_TABLE
|
||||
static UChar BuiltInAsciiToLowerCaseTable[] = {
|
||||
static const UChar BuiltInAsciiToLowerCaseTable[] = {
|
||||
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
|
||||
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
|
||||
'\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
|
||||
|
@ -392,9 +396,9 @@ UChar OnigEncISO_8859_1_ToUpperCaseTable[256] = {
|
|||
#endif
|
||||
|
||||
extern void
|
||||
onigenc_set_default_caseconv_table(UChar* table)
|
||||
onigenc_set_default_caseconv_table(const UChar* table)
|
||||
{
|
||||
if (table == (UChar* )0) {
|
||||
if (table == (const UChar* )0) {
|
||||
#ifndef USE_APPLICATION_TO_LOWER_CASE_TABLE
|
||||
table = BuiltInAsciiToLowerCaseTable;
|
||||
#else
|
||||
|
@ -408,7 +412,7 @@ onigenc_set_default_caseconv_table(UChar* table)
|
|||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_get_left_adjust_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
||||
onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
|
||||
{
|
||||
return ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s);
|
||||
}
|
||||
|
@ -595,7 +599,7 @@ onigenc_not_support_get_ctype_code_range(int ctype,
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_mbc_newline_0x0a(UChar* p, UChar* end)
|
||||
onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end)
|
||||
{
|
||||
if (p < end) {
|
||||
if (*p == 0x0a) return 1;
|
||||
|
@ -605,7 +609,7 @@ onigenc_is_mbc_newline_0x0a(UChar* p, UChar* end)
|
|||
|
||||
/* for single byte encodings */
|
||||
extern int
|
||||
onigenc_ascii_mbc_to_normalize(OnigAmbigType flag, UChar** p, UChar*end,
|
||||
onigenc_ascii_mbc_to_normalize(OnigAmbigType flag, const UChar** p, const UChar*end,
|
||||
UChar* lower)
|
||||
{
|
||||
if ((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0) {
|
||||
|
@ -620,9 +624,10 @@ onigenc_ascii_mbc_to_normalize(OnigAmbigType flag, UChar** p, UChar*end,
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_ascii_is_mbc_ambiguous(OnigAmbigType flag, UChar** pp, UChar* end)
|
||||
onigenc_ascii_is_mbc_ambiguous(OnigAmbigType flag,
|
||||
const UChar** pp, const UChar* end)
|
||||
{
|
||||
UChar* p = *pp;
|
||||
const UChar* p = *pp;
|
||||
|
||||
(*pp)++;
|
||||
if ((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0) {
|
||||
|
@ -634,13 +639,13 @@ onigenc_ascii_is_mbc_ambiguous(OnigAmbigType flag, UChar** pp, UChar* end)
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_single_byte_mbc_enc_len(UChar* p)
|
||||
onigenc_single_byte_mbc_enc_len(const UChar* p)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern OnigCodePoint
|
||||
onigenc_single_byte_mbc_to_code(UChar* p, UChar* end)
|
||||
onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end)
|
||||
{
|
||||
return (OnigCodePoint )(*p);
|
||||
}
|
||||
|
@ -665,25 +670,25 @@ onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf)
|
|||
}
|
||||
|
||||
extern UChar*
|
||||
onigenc_single_byte_left_adjust_char_head(UChar* start, UChar* s)
|
||||
onigenc_single_byte_left_adjust_char_head(const UChar* start, const UChar* s)
|
||||
{
|
||||
return s;
|
||||
return (UChar* )s;
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_always_true_is_allowed_reverse_match(UChar* s, UChar* end)
|
||||
onigenc_always_true_is_allowed_reverse_match(const UChar* s, const UChar* end)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_always_false_is_allowed_reverse_match(UChar* s, UChar* end)
|
||||
onigenc_always_false_is_allowed_reverse_match(const UChar* s, const UChar* end)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern OnigCodePoint
|
||||
onigenc_mbn_mbc_to_code(OnigEncoding enc, UChar* p, UChar* end)
|
||||
onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
|
||||
{
|
||||
int c, i, len;
|
||||
OnigCodePoint n;
|
||||
|
@ -702,10 +707,10 @@ onigenc_mbn_mbc_to_code(OnigEncoding enc, UChar* p, UChar* end)
|
|||
|
||||
extern int
|
||||
onigenc_mbn_mbc_to_normalize(OnigEncoding enc, OnigAmbigType flag,
|
||||
UChar** pp, UChar* end, UChar* lower)
|
||||
const UChar** pp, const UChar* end, UChar* lower)
|
||||
{
|
||||
int len;
|
||||
UChar *p = *pp;
|
||||
const UChar *p = *pp;
|
||||
|
||||
if (ONIGENC_IS_MBC_ASCII(p)) {
|
||||
if ((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0) {
|
||||
|
@ -732,9 +737,9 @@ onigenc_mbn_mbc_to_normalize(OnigEncoding enc, OnigAmbigType flag,
|
|||
|
||||
extern int
|
||||
onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigAmbigType flag,
|
||||
UChar** pp, UChar* end)
|
||||
const UChar** pp, const UChar* end)
|
||||
{
|
||||
UChar* p = *pp;
|
||||
const UChar* p = *pp;
|
||||
|
||||
if (ONIGENC_IS_MBC_ASCII(p)) {
|
||||
(*pp)++;
|
||||
|
@ -881,8 +886,8 @@ onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_with_ascii_strncmp(OnigEncoding enc, UChar* p, UChar* end,
|
||||
UChar* sascii /* ascii */, int n)
|
||||
onigenc_with_ascii_strncmp(OnigEncoding enc, const UChar* p, const UChar* end,
|
||||
const UChar* sascii /* ascii */, int n)
|
||||
{
|
||||
int x, c;
|
||||
|
||||
|
@ -1019,7 +1024,8 @@ onigenc_get_left_adjust_char_head(OnigEncoding enc, UChar* start, UChar* s)
|
|||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_allowed_reverse_match(OnigEncoding enc, UChar* s, UChar* end)
|
||||
onigenc_is_allowed_reverse_match(OnigEncoding enc,
|
||||
const UChar* s, const UChar* end)
|
||||
{
|
||||
return ONIGENC_IS_SINGLEBYTE(enc);
|
||||
}
|
||||
|
|
34
regenc.h
34
regenc.h
|
@ -4,7 +4,7 @@
|
|||
regenc.h - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -74,24 +74,24 @@ ONIG_EXTERN int onigenc_nothing_get_all_comp_ambig_codes P_((OnigAmbigType flag,
|
|||
ONIG_EXTERN int onigenc_iso_8859_1_get_all_pair_ambig_codes P_((OnigAmbigType flag, OnigPairAmbigCodes** acs));
|
||||
ONIG_EXTERN int onigenc_ess_tsett_get_all_comp_ambig_codes P_((OnigAmbigType flag, OnigCompAmbigCodes** acs));
|
||||
ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((int ctype, OnigCodePoint* sbr[], OnigCodePoint* mbr[]));
|
||||
ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((UChar* p, UChar* end));
|
||||
ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end));
|
||||
|
||||
/* methods for single byte encoding */
|
||||
ONIG_EXTERN int onigenc_ascii_mbc_to_normalize P_((OnigAmbigType flag, UChar** p, UChar* end, UChar* lower));
|
||||
ONIG_EXTERN int onigenc_ascii_is_mbc_ambiguous P_((OnigAmbigType flag, UChar** p, UChar* end));
|
||||
ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((UChar* p));
|
||||
ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((UChar* p, UChar* end));
|
||||
ONIG_EXTERN int onigenc_ascii_mbc_to_normalize P_((OnigAmbigType flag, const UChar** p, const UChar* end, UChar* lower));
|
||||
ONIG_EXTERN int onigenc_ascii_is_mbc_ambiguous P_((OnigAmbigType flag, const UChar** p, const UChar* end));
|
||||
ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p));
|
||||
ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end));
|
||||
ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code));
|
||||
ONIG_EXTERN int onigenc_single_byte_code_to_mbc_first P_((OnigCodePoint code));
|
||||
ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf));
|
||||
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((UChar* start, UChar* s));
|
||||
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((UChar* s, UChar* end));
|
||||
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((UChar* s, UChar* end));
|
||||
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s));
|
||||
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end));
|
||||
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end));
|
||||
|
||||
/* methods for multi byte encoding */
|
||||
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, UChar* p, UChar* end));
|
||||
ONIG_EXTERN int onigenc_mbn_mbc_to_normalize P_((OnigEncoding enc, OnigAmbigType flag, UChar** p, UChar* end, UChar* lower));
|
||||
ONIG_EXTERN int onigenc_mbn_is_mbc_ambiguous P_((OnigEncoding enc, OnigAmbigType flag, UChar** p, UChar* end));
|
||||
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
|
||||
ONIG_EXTERN int onigenc_mbn_mbc_to_normalize P_((OnigEncoding enc, OnigAmbigType flag, const UChar** p, const UChar* end, UChar* lower));
|
||||
ONIG_EXTERN int onigenc_mbn_is_mbc_ambiguous P_((OnigEncoding enc, OnigAmbigType flag, const UChar** p, const UChar* end));
|
||||
ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code));
|
||||
ONIG_EXTERN int onigenc_mb2_code_to_mbc_first P_((OnigCodePoint code));
|
||||
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
|
||||
|
@ -123,16 +123,16 @@ ONIG_EXTERN OnigPairAmbigCodes OnigAsciiPairAmbigCodes[];
|
|||
#endif /* is not ONIG_RUBY_M17N */
|
||||
|
||||
ONIG_EXTERN int
|
||||
onigenc_with_ascii_strncmp P_((OnigEncoding enc, UChar* p, UChar* end, UChar* sascii /* ascii */, int n));
|
||||
onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
|
||||
ONIG_EXTERN UChar*
|
||||
onigenc_step P_((OnigEncoding enc, UChar* p, UChar* end, int n));
|
||||
onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));
|
||||
|
||||
/* defined in regexec.c, but used in enc/xxx.c */
|
||||
extern int onig_is_in_code_range P_((UChar* p, OnigCodePoint code));
|
||||
extern int onig_is_in_code_range P_((const UChar* p, OnigCodePoint code));
|
||||
|
||||
ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding;
|
||||
ONIG_EXTERN UChar* OnigEncAsciiToLowerCaseTable;
|
||||
ONIG_EXTERN UChar OnigEncAsciiToUpperCaseTable[];
|
||||
ONIG_EXTERN const UChar* OnigEncAsciiToLowerCaseTable;
|
||||
ONIG_EXTERN const UChar OnigEncAsciiToUpperCaseTable[];
|
||||
ONIG_EXTERN unsigned short OnigEncAsciiCtypeTable[];
|
||||
|
||||
#define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
regerror.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
27
sjis.c
27
sjis.c
|
@ -2,7 +2,7 @@
|
|||
sjis.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -71,7 +71,7 @@ static const char SJIS_CAN_BE_TRAIL_TABLE[256] = {
|
|||
#define SJIS_ISMB_TRAIL(byte) SJIS_CAN_BE_TRAIL_TABLE[(byte)]
|
||||
|
||||
static int
|
||||
sjis_mbc_enc_len(UChar* p)
|
||||
sjis_mbc_enc_len(const UChar* p)
|
||||
{
|
||||
return EncLen_SJIS[*p];
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ sjis_code_to_mbclen(OnigCodePoint code)
|
|||
}
|
||||
|
||||
static OnigCodePoint
|
||||
sjis_mbc_to_code(UChar* p, UChar* end)
|
||||
sjis_mbc_to_code(const UChar* p, const UChar* end)
|
||||
{
|
||||
int c, i, len;
|
||||
OnigCodePoint n;
|
||||
|
@ -127,9 +127,10 @@ sjis_code_to_mbc(OnigCodePoint code, UChar *buf)
|
|||
}
|
||||
|
||||
static int
|
||||
sjis_mbc_to_normalize(OnigAmbigType flag, UChar** pp, UChar* end, UChar* lower)
|
||||
sjis_mbc_to_normalize(OnigAmbigType flag,
|
||||
const UChar** pp, const UChar* end, UChar* lower)
|
||||
{
|
||||
UChar* p = *pp;
|
||||
const UChar* p = *pp;
|
||||
|
||||
if (ONIGENC_IS_MBC_ASCII(p)) {
|
||||
if ((flag & ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE) != 0) {
|
||||
|
@ -157,7 +158,7 @@ sjis_mbc_to_normalize(OnigAmbigType flag, UChar** pp, UChar* end, UChar* lower)
|
|||
}
|
||||
|
||||
static int
|
||||
sjis_is_mbc_ambiguous(OnigAmbigType flag, UChar** pp, UChar* end)
|
||||
sjis_is_mbc_ambiguous(OnigAmbigType flag, const UChar** pp, const UChar* end)
|
||||
{
|
||||
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_SJIS, flag, pp, end);
|
||||
|
||||
|
@ -184,12 +185,12 @@ sjis_is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
|||
}
|
||||
|
||||
static UChar*
|
||||
sjis_left_adjust_char_head(UChar* start, UChar* s)
|
||||
sjis_left_adjust_char_head(const UChar* start, const UChar* s)
|
||||
{
|
||||
UChar *p;
|
||||
const UChar *p;
|
||||
int len;
|
||||
|
||||
if (s <= start) return s;
|
||||
if (s <= start) return (UChar* )s;
|
||||
p = s;
|
||||
|
||||
if (SJIS_ISMB_TRAIL(*p)) {
|
||||
|
@ -201,15 +202,15 @@ sjis_left_adjust_char_head(UChar* start, UChar* s)
|
|||
}
|
||||
}
|
||||
len = enc_len(ONIG_ENCODING_SJIS, p);
|
||||
if (p + len > s) return p;
|
||||
if (p + len > s) return (UChar* )p;
|
||||
p += len;
|
||||
return p + ((s - p) & ~1);
|
||||
return (UChar* )(p + ((s - p) & ~1));
|
||||
}
|
||||
|
||||
static int
|
||||
sjis_is_allowed_reverse_match(UChar* s, UChar* end)
|
||||
sjis_is_allowed_reverse_match(const UChar* s, const UChar* end)
|
||||
{
|
||||
UChar c = *s;
|
||||
const UChar c = *s;
|
||||
return (SJIS_ISMB_TRAIL(c) ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче