diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-05-10 05:15:59 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-05-10 05:15:59 +0200 |
commit | e706cbe5496e1829d1ddbe4d5bb0a6728204e510 (patch) | |
tree | c72d1848ac6aef07703848d0ffbe80f1336a81cd /sample/encode.c | |
parent | 69ab3addbc2dbbc90c311b2845cd25a2159435cd (diff) | |
parent | 5e01a4852b31d537307994248869caf38b4023cc (diff) |
new upstream release
Diffstat (limited to 'sample/encode.c')
-rw-r--r-- | sample/encode.c | 10 |
1 files changed, 10 insertions, 0 deletions
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"); |