ruby-changes:7812
From: akr <ko1@a...>
Date: Sun, 14 Sep 2008 03:45:21 +0900 (JST)
Subject: [ruby-changes:7812] Ruby:r19333 (trunk): * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument.
akr 2008-09-14 03:44:53 +0900 (Sun, 14 Sep 2008) New Revision: 19333 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19333 Log: * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument. (onigenc_step_back): ditto. * regenc.c (onigenc_step_back): add end argument. * regexec.c: follow the interface change. Modified files: trunk/ChangeLog trunk/include/ruby/oniguruma.h trunk/regenc.c trunk/regexec.c Index: include/ruby/oniguruma.h =================================================================== --- include/ruby/oniguruma.h (revision 19332) +++ include/ruby/oniguruma.h (revision 19333) @@ -225,8 +225,8 @@ (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) -#define ONIGENC_STEP_BACK(enc,start,s,n) \ - onigenc_step_back((enc),(start),(s),(n)) +#define ONIGENC_STEP_BACK(enc,start,s,end,n) \ + onigenc_step_back((enc),(start),(s),(end),(n)) #define ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) (n) #define ONIGENC_MBCLEN_CHARFOUND_P(r) (0 < (r)) @@ -290,7 +290,7 @@ (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)); +OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, int n)); /* encoding API */ Index: regenc.c =================================================================== --- regenc.c (revision 19332) +++ regenc.c (revision 19333) @@ -97,7 +97,7 @@ } extern UChar* -onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, int n) +onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end, int n) { while (ONIG_IS_NOT_NULL(s) && n-- > 0) { if (s <= start) Index: ChangeLog =================================================================== --- ChangeLog (revision 19332) +++ ChangeLog (revision 19333) @@ -1,3 +1,12 @@ +Sun Sep 14 03:43:27 2008 Tanaka Akira <akr@f...> + + * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument. + (onigenc_step_back): ditto. + + * regenc.c (onigenc_step_back): add end argument. + + * regexec.c: follow the interface change. + Sun Sep 14 03:20:03 2008 Tanaka Akira <akr@f...> * include/ruby/oniguruma.h (onigenc_get_prev_char_head): add end Index: regexec.c =================================================================== --- regexec.c (revision 19332) +++ regexec.c (revision 19333) @@ -2647,7 +2647,7 @@ case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND); GET_LENGTH_INC(tlen, p); - s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen); + s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(s)) goto fail; sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end); MOP_OUT; @@ -2657,7 +2657,7 @@ case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT); GET_RELADDR_INC(addr, p); GET_LENGTH_INC(tlen, p); - q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen); + q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(q)) { /* too short case -> success. ex. /(?<!XXX)a/.match("a") If you want to change to fail, replace following line. */ @@ -3529,14 +3529,14 @@ } } else if (reg->anchor & ANCHOR_SEMI_END_BUF) { - UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, 1); + UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, end, 1); max_semi_end = (UChar* )end; if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) { min_semi_end = pre_end; #ifdef USE_CRNL_AS_LINE_TERMINATOR - pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, 1); + pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, end, 1); if (IS_NOT_NULL(pre_end) && ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) { min_semi_end = pre_end; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/