From 5e01a4852b31d537307994248869caf38b4023cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 10 May 2016 05:12:17 +0200 Subject: Imported Upstream version 6.0.0 --- sample/encode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sample/encode.c') diff --git a/sample/encode.c b/sample/encode.c index 3fbd03d..1daafa9 100644 --- a/sample/encode.c +++ b/sample/encode.c @@ -52,6 +52,8 @@ exec(OnigEncoding enc, OnigOptionType options, UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; + onig_initialize(&enc, 1); + r = onig_new(®, pattern, pattern + onigenc_str_bytelen_null(enc, pattern), options, enc, ONIG_SYNTAX_DEFAULT, &einfo); @@ -92,6 +94,8 @@ exec_deluxe(OnigEncoding pattern_enc, OnigEncoding str_enc, UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; + onig_initialize(&str_enc, 1); + ci.num_of_elements = 5; ci.pattern_enc = pattern_enc; ci.target_enc = str_enc; @@ -124,6 +128,12 @@ extern int main(int argc, char* argv[]) static unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 }; static unsigned char pattern[] = { 0xe7, 0xf6, 0xde, '\\', 'w', '+', 0x00 }; + r = exec(ONIG_ENCODING_SJIS, ONIG_OPTION_NONE, + "^a\\p{Hiragana}c$", "a\202\274c"); + + r = exec(ONIG_ENCODING_EUC_JP, ONIG_OPTION_NONE, + "^a\\p{Hiragana}c$", "a\244\276c"); + r = exec(ONIG_ENCODING_CP1251, ONIG_OPTION_IGNORECASE, "aBc", " AbC"); -- cgit v1.2.3