aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-10 15:05:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-10 15:05:32 +0000
commit5fc7312d1b6da1acccc8cf7dfff2bed79b48a33c (patch)
treee19635f6ea6ed468c2e9c0f9eb08d0eac6b98bf5
parent79a202433ca81eda26450c19d5ffd5b638202c5f (diff)
downloadruby-5fc7312d1b6da1acccc8cf7dfff2bed79b48a33c.tar.gz
* include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
parameter to every function members. * include/ruby/oniguruma.h (OnigEncodingTypeST): add auxiliary data member to provide user defined data for an encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ascii.c2
-rw-r--r--euc_jp.c24
-rw-r--r--include/ruby/oniguruma.h49
-rw-r--r--regenc.c32
-rw-r--r--regenc.h28
-rw-r--r--sjis.c24
-rw-r--r--unicode.c5
-rw-r--r--utf8.c19
-rw-r--r--version.h6
10 files changed, 109 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index f874cd414c..21cdcbedf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Oct 11 00:04:37 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
+ parameter to every function members.
+
+ * include/ruby/oniguruma.h (OnigEncodingTypeST): add auxiliary
+ data member to provide user defined data for an encoding.
+
Wed Oct 10 23:32:15 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (rb_reg_s_quote): no longer takes optional second argument
diff --git a/ascii.c b/ascii.c
index abf784b165..894cea4bc2 100644
--- a/ascii.c
+++ b/ascii.c
@@ -30,7 +30,7 @@
#include "regenc.h"
static int
-ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype)
+ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
diff --git a/euc_jp.c b/euc_jp.c
index cebd2afe9a..f48c904945 100644
--- a/euc_jp.c
+++ b/euc_jp.c
@@ -51,13 +51,13 @@ static const int EncLen_EUCJP[] = {
};
static int
-mbc_enc_len(const UChar* p, const UChar* e)
+mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
return EncLen_EUCJP[*p];
}
static OnigCodePoint
-mbc_to_code(const UChar* p, const UChar* end)
+mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
int c, i, len;
OnigCodePoint n;
@@ -75,7 +75,7 @@ mbc_to_code(const UChar* p, const UChar* end)
}
static int
-code_to_mbclen(OnigCodePoint code)
+code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
if (ONIGENC_IS_CODE_ASCII(code)) return 1;
else if (code > 0xffffff) return 0;
@@ -104,7 +104,7 @@ code_to_mbc_first(OnigCodePoint code)
#endif
static int
-code_to_mbc(OnigCodePoint code, UChar *buf)
+code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
UChar *p = buf;
@@ -121,7 +121,8 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
static int
mbc_case_fold(OnigCaseFoldType flag,
- const UChar** pp, const UChar* end, UChar* lower)
+ const UChar** pp, const UChar* end, UChar* lower,
+ OnigEncoding enc)
{
int len;
const UChar* p = *pp;
@@ -144,7 +145,7 @@ mbc_case_fold(OnigCaseFoldType flag,
}
static UChar*
-left_adjust_char_head(const UChar* start, const UChar* s)
+left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
{
/* In this encoding
mb-trail bytes doesn't mix with single bytes.
@@ -163,7 +164,7 @@ left_adjust_char_head(const UChar* start, const UChar* s)
}
static int
-is_allowed_reverse_match(const UChar* s, const UChar* end)
+is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc)
{
const UChar c = *s;
if (c <= 0x7e || c == 0x8e || c == 0x8f)
@@ -219,14 +220,14 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
}
static int
-is_code_ctype(OnigCodePoint code, unsigned int ctype)
+is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
else {
if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
- return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
+ return (code_to_mbclen(code, enc) > 1 ? TRUE : FALSE);
}
}
}
@@ -245,7 +246,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
static int
get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
- const OnigCodePoint* ranges[])
+ const OnigCodePoint* ranges[], OnigEncoding enc)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
return ONIG_NO_SUPPORT_CONFIG;
@@ -281,5 +282,6 @@ OnigEncodingType OnigEncodingEUC_JP = {
is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
- is_allowed_reverse_match
+ is_allowed_reverse_match,
+ 0
};
diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h
index a75f811ff8..0a1f614bdb 100644
--- a/include/ruby/oniguruma.h
+++ b/include/ruby/oniguruma.h
@@ -144,22 +144,23 @@ typedef struct {
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
typedef struct OnigEncodingTypeST {
- int (*mbc_enc_len)(const OnigUChar* p,const OnigUChar* e);
+ int (*mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc);
const char* name;
int max_enc_len;
int min_enc_len;
- int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
- OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
- int (*code_to_mbclen)(OnigCodePoint code);
- int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
- int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
- int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
- int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
+ int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ int (*code_to_mbclen)(OnigCodePoint code, struct OnigEncodingTypeST* enc);
+ int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, struct OnigEncodingTypeST* enc);
+ int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, struct OnigEncodingTypeST* enc);
+ int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, struct OnigEncodingTypeST* enc);
+ int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], struct OnigEncodingTypeST* enc);
int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
- int (*is_code_ctype)(OnigCodePoint code, unsigned int ctype);
- int (*get_ctype_code_range)(int ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
- OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
- int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
+ int (*is_code_ctype)(OnigCodePoint code, unsigned int ctype, struct OnigEncodingTypeST* enc);
+ int (*get_ctype_code_range)(int ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], struct OnigEncodingTypeST* enc);
+ OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, struct OnigEncodingTypeST* enc);
+ int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
+ void *auxiliary_data;
} OnigEncodingType;
typedef OnigEncodingType* OnigEncoding;
@@ -269,30 +270,30 @@ ONIG_EXTERN OnigEncodingType OnigEncodingGB18030;
#define ONIGENC_NAME(enc) ((enc)->name)
#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
- (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
+ (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf,enc)
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
- (enc)->is_allowed_reverse_match(s,end)
+ (enc)->is_allowed_reverse_match(s,end,enc)
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
- (enc)->left_adjust_char_head(start, s)
+ (enc)->left_adjust_char_head(start, s, enc)
#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
- (enc)->apply_all_case_fold(case_fold_flag,f,arg)
+ (enc)->apply_all_case_fold(case_fold_flag,f,arg,enc)
#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
- (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
+ (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs,enc)
#define ONIGENC_STEP_BACK(enc,start,s,n) \
onigenc_step_back((enc),(start),(s),(n))
-#define ONIGENC_MBC_ENC_LEN(enc,p,e) (enc)->mbc_enc_len(p,e)
+#define ONIGENC_MBC_ENC_LEN(enc,p,e) (enc)->mbc_enc_len(p,e,enc)
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
#define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc)
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
-#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end))
-#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end))
-#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code)
-#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf)
+#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end),enc)
+#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end),enc)
+#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code,enc)
+#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf,enc)
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
(enc)->property_name_to_ctype(enc,p,end)
-#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype)
+#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype,enc)
#define ONIGENC_IS_CODE_NEWLINE(enc,code) \
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
@@ -324,7 +325,7 @@ ONIG_EXTERN OnigEncodingType OnigEncodingGB18030;
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
- (enc)->get_ctype_code_range(ctype,sbout,ranges)
+ (enc)->get_ctype_code_range(ctype,sbout,ranges,enc)
ONIG_EXTERN
OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n));
diff --git a/regenc.c b/regenc.c
index 20994bb11f..e7234921db 100644
--- a/regenc.c
+++ b/regenc.c
@@ -394,7 +394,8 @@ const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = {
extern int
onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag,
- OnigApplyAllCaseFoldFunc f, void* arg)
+ OnigApplyAllCaseFoldFunc f, void* arg,
+ OnigEncoding enc)
{
OnigCodePoint code;
int i, r;
@@ -415,7 +416,8 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag,
extern int
onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag,
- const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
+ const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[],
+ OnigEncoding enc)
{
if (0x41 <= *p && *p <= 0x5a) {
items[0].byte_len = 1;
@@ -451,7 +453,7 @@ onigenc_apply_all_case_fold_with_map(int map_size,
OnigCodePoint code;
int i, r;
- r = onigenc_ascii_apply_all_case_fold(flag, f, arg);
+ r = onigenc_ascii_apply_all_case_fold(flag, f, arg, 0);
if (r != 0) return r;
for (i = 0; i < map_size; i++) {
@@ -554,13 +556,14 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int
onigenc_not_support_get_ctype_code_range(int ctype,
- OnigCodePoint* sb_out, const OnigCodePoint* ranges[])
+ OnigCodePoint* sb_out, const OnigCodePoint* ranges[],
+ OnigEncoding enc)
{
return ONIG_NO_SUPPORT_CONFIG;
}
extern int
-onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end)
+onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end, OnigEncoding enc)
{
if (p < end) {
if (*p == 0x0a) return 1;
@@ -571,7 +574,7 @@ onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end)
/* for single byte encodings */
extern int
onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag, const UChar** p,
- const UChar*end, UChar* lower)
+ const UChar*end, UChar* lower, OnigEncoding enc)
{
*lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
@@ -592,44 +595,47 @@ onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag,
#endif
extern int
-onigenc_single_byte_mbc_enc_len(const UChar* p, const UChar* e)
+onigenc_single_byte_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
return 1;
}
extern OnigCodePoint
-onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end)
+onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
return (OnigCodePoint )(*p);
}
extern int
-onigenc_single_byte_code_to_mbclen(OnigCodePoint code)
+onigenc_single_byte_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
return 1;
}
extern int
-onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf)
+onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
*buf = (UChar )(code & 0xff);
return 1;
}
extern UChar*
-onigenc_single_byte_left_adjust_char_head(const UChar* start, const UChar* s)
+onigenc_single_byte_left_adjust_char_head(const UChar* start, const UChar* s,
+ OnigEncoding enc)
{
return (UChar* )s;
}
extern int
-onigenc_always_true_is_allowed_reverse_match(const UChar* s, const UChar* end)
+onigenc_always_true_is_allowed_reverse_match(const UChar* s, const UChar* end,
+ OnigEncoding enc)
{
return TRUE;
}
extern int
-onigenc_always_false_is_allowed_reverse_match(const UChar* s, const UChar* end)
+onigenc_always_false_is_allowed_reverse_match(const UChar* s, const UChar* end,
+ OnigEncoding enc)
{
return FALSE;
}
diff --git a/regenc.h b/regenc.h
index 47653fd94a..b9d96a6949 100644
--- a/regenc.h
+++ b/regenc.h
@@ -107,23 +107,23 @@ typedef struct {
#define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
/* for encoding system implementation (internal) */
-ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
-ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
+ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
+ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc));
ONIG_EXTERN int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
ONIG_EXTERN int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
-ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((int ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]));
-ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end));
+ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((int ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
+ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end, OnigEncoding enc));
/* methods for single byte encoding */
-ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
-ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e));
-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 P_((OnigCodePoint code, UChar *buf));
-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));
+ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower, OnigEncoding enc));
+ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e, OnigEncoding enc));
+ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end, OnigEncoding enc));
+ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
+ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf, OnigEncoding enc));
+ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, OnigEncoding enc));
+ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
+ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
/* methods for multi byte encoding */
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
@@ -139,12 +139,12 @@ ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint co
/* in enc/unicode.c */
-ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));
+ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((int ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]));
ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((int ctype, const OnigCodePoint* ranges[]));
ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
-ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
+ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
#define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
diff --git a/sjis.c b/sjis.c
index f14139e561..fbfddcc612 100644
--- a/sjis.c
+++ b/sjis.c
@@ -71,13 +71,13 @@ static const char SJIS_CAN_BE_TRAIL_TABLE[256] = {
#define SJIS_ISMB_TRAIL(byte) SJIS_CAN_BE_TRAIL_TABLE[(byte)]
static int
-mbc_enc_len(const UChar* p, const UChar* e)
+mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
return EncLen_SJIS[*p];
}
static int
-code_to_mbclen(OnigCodePoint code)
+code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
if (code < 256) {
if (EncLen_SJIS[(int )code] == 1)
@@ -93,7 +93,7 @@ code_to_mbclen(OnigCodePoint code)
}
static OnigCodePoint
-mbc_to_code(const UChar* p, const UChar* end)
+mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
int c, i, len;
OnigCodePoint n;
@@ -112,7 +112,7 @@ mbc_to_code(const UChar* p, const UChar* end)
}
static int
-code_to_mbc(OnigCodePoint code, UChar *buf)
+code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
UChar *p = buf;
@@ -128,7 +128,8 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
static int
mbc_case_fold(OnigCaseFoldType flag,
- const UChar** pp, const UChar* end, UChar* lower)
+ const UChar** pp, const UChar* end, UChar* lower,
+ OnigEncoding enc)
{
const UChar* p = *pp;
@@ -176,7 +177,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
#endif
static UChar*
-left_adjust_char_head(const UChar* start, const UChar* s)
+left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
{
const UChar *p;
int len;
@@ -199,7 +200,7 @@ left_adjust_char_head(const UChar* start, const UChar* s)
}
static int
-is_allowed_reverse_match(const UChar* s, const UChar* end)
+is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc)
{
const UChar c = *s;
return (SJIS_ISMB_TRAIL(c) ? FALSE : TRUE);
@@ -253,14 +254,14 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
}
static int
-is_code_ctype(OnigCodePoint code, unsigned int ctype)
+is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
else {
if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
- return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
+ return (code_to_mbclen(code, enc) > 1 ? TRUE : FALSE);
}
}
}
@@ -279,7 +280,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
static int
get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
- const OnigCodePoint* ranges[])
+ const OnigCodePoint* ranges[], OnigEncoding enc)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
return ONIG_NO_SUPPORT_CONFIG;
@@ -314,5 +315,6 @@ OnigEncodingType OnigEncodingSJIS = {
is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
- is_allowed_reverse_match
+ is_allowed_reverse_match,
+ 0
};
diff --git a/unicode.c b/unicode.c
index daac1c46ec..8b1a1308dc 100644
--- a/unicode.c
+++ b/unicode.c
@@ -10745,7 +10745,7 @@ static void init_code_range_array() {
}
extern int
-onigenc_unicode_is_code_ctype(OnigCodePoint code, unsigned int ctype)
+onigenc_unicode_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
if (
#ifdef USE_UNICODE_PROPERTIES
@@ -11005,7 +11005,8 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
extern int
onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
- OnigApplyAllCaseFoldFunc f, void* arg)
+ OnigApplyAllCaseFoldFunc f, void* arg,
+ OnigEncoding enc)
{
const CaseUnfold_11_Type* p11;
OnigCodePoint code;
diff --git a/utf8.c b/utf8.c
index 6b6f41e62b..3add59f475 100644
--- a/utf8.c
+++ b/utf8.c
@@ -60,13 +60,13 @@ static const int EncLen_UTF8[] = {
};
static int
-utf8_mbc_enc_len(const UChar* p, const UChar* e)
+utf8_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
return EncLen_UTF8[*p];
}
static int
-utf8_is_mbc_newline(const UChar* p, const UChar* end)
+utf8_is_mbc_newline(const UChar* p, const UChar* end, OnigEncoding enc)
{
if (p < end) {
if (*p == 0x0a) return 1;
@@ -91,7 +91,7 @@ utf8_is_mbc_newline(const UChar* p, const UChar* end)
}
static OnigCodePoint
-utf8_mbc_to_code(const UChar* p, const UChar* end)
+utf8_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
{
int c, len;
OnigCodePoint n;
@@ -118,7 +118,7 @@ utf8_mbc_to_code(const UChar* p, const UChar* end)
}
static int
-utf8_code_to_mbclen(OnigCodePoint code)
+utf8_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
if ((code & 0xffffff80) == 0) return 1;
else if ((code & 0xfffff800) == 0) {
@@ -163,7 +163,7 @@ utf8_code_to_mbc_first(OnigCodePoint code)
#endif
static int
-utf8_code_to_mbc(OnigCodePoint code, UChar *buf)
+utf8_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
#define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80)
#define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80)
@@ -221,7 +221,7 @@ utf8_code_to_mbc(OnigCodePoint code, UChar *buf)
static int
utf8_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
- const UChar* end, UChar* fold)
+ const UChar* end, UChar* fold, OnigEncoding enc)
{
const UChar* p = *pp;
@@ -286,7 +286,7 @@ utf8_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
static int
utf8_get_ctype_code_range(int ctype, OnigCodePoint *sb_out,
- const OnigCodePoint* ranges[])
+ const OnigCodePoint* ranges[], OnigEncoding enc)
{
*sb_out = 0x80;
return onigenc_unicode_ctype_code_range(ctype, ranges);
@@ -294,7 +294,7 @@ utf8_get_ctype_code_range(int ctype, OnigCodePoint *sb_out,
static UChar*
-utf8_left_adjust_char_head(const UChar* start, const UChar* s)
+utf8_left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
{
const UChar *p;
@@ -307,7 +307,8 @@ utf8_left_adjust_char_head(const UChar* start, const UChar* s)
static int
utf8_get_case_fold_codes_by_str(OnigCaseFoldType flag,
- const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
+ const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[],
+ OnigEncoding enc)
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF8,
flag, p, end, items);
diff --git a/version.h b/version.h
index 1f6cf069f9..99cc6dc343 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-10-10"
+#define RUBY_RELEASE_DATE "2007-10-11"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20071010
+#define RUBY_RELEASE_CODE 20071011
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 10
+#define RUBY_RELEASE_DAY 11
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];