return (UChar* )s;
}
+extern int
+onigenc_mbc_enc_len_end(OnigEncoding enc, const UChar* p, const UChar* end)
+{
+ int len;
+ int n;
+
+ len = ONIGENC_MBC_ENC_LEN(enc, p);
+ n = (int )(end - p);
+
+ return (n < len ? n : len);
+}
+
extern UChar*
onigenc_step(OnigEncoding enc, const UChar* p, const UChar* end, int n)
{
#define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
/* for encoding system implementation (internal) */
+ONIG_EXTERN int onigenc_mbc_enc_len_end(OnigEncoding enc, const UChar* p, const UChar* end);
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_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 const UChar OnigEncAsciiToUpperCaseTable[];
ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
+#define ONIGENC_MBC_ENC_LEN_END(enc,p,end) onigenc_mbc_enc_len_end(enc, p, end)
+
#define ONIGENC_IS_ASCII_CODE(code) ((code) < 0x80)
#define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c]
#define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
#include "regparse.h"
#include "st.h"
#define PFETCH(c) do { \
c = ONIGENC_MBC_TO_CODE(enc, p, end); \
pfetch_prev = p; \
- p += ONIGENC_MBC_ENC_LEN(enc, p); \
+ p += ONIGENC_MBC_ENC_LEN_END(enc, p, end); \
} while (0)
#define PINC_S do { \
} while (0)
#define PFETCH_S(c) do { \
c = ONIGENC_MBC_TO_CODE(enc, p, end); \
- p += ONIGENC_MBC_ENC_LEN(enc, p); \
+ p += ONIGENC_MBC_ENC_LEN_END(enc, p, end); \
} while (0)
#define PPEEK (p < end ? ONIGENC_MBC_TO_CODE(enc, p, end) : PEND_VALUE)
env->pattern_end = (UChar* )end;
env->reg = reg;
+#ifdef DEBUG_OOB
+ fprintf(stderr, "onig_parse_make_tree: %p - %p, %d\n", pattern, end,
+ (int )(end - pattern));
+#endif
+
*root = NULL;
p = (UChar* )pattern;
r = parse_regexp(root, &p, (UChar* )end, env);