ruby-changes:43614
From: nobu <ko1@a...>
Date: Fri, 15 Jul 2016 09:53:56 +0900 (JST)
Subject: [ruby-changes:43614] nobu:r55687 (trunk): enc/unicode: check Unicode versions
nobu 2016-07-15 09:53:50 +0900 (Fri, 15 Jul 2016) New Revision: 55687 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55687 Log: enc/unicode: check Unicode versions * enc/unicode/case-folding.rb, tool/enc-unicode.rb: check if Unicode versions are consistent with each other. Modified files: trunk/ChangeLog trunk/enc/unicode/case-folding.rb trunk/enc/unicode/casefold.h trunk/enc/unicode/name2ctype.h trunk/tool/enc-unicode.rb Index: tool/enc-unicode.rb =================================================================== --- tool/enc-unicode.rb (revision 55686) +++ tool/enc-unicode.rb (revision 55687) @@ -454,6 +454,18 @@ uniname2ctype(const UChar *name, unsigne https://github.com/ruby/ruby/blob/trunk/tool/enc-unicode.rb#L454 return -1; } __HEREDOC +versions = $unicode_version.scan(/\d+/) +print("#if defined ONIG_UNICODE_VERSION_STRING && !( \\\n") +%w[MAJOR MINOR TEENY].zip(versions) do |n, v| + print(" ONIG_UNICODE_VERSION_#{n} == #{v} && \\\n") +end +print(" 1)\n") +print("# error ONIG_UNICODE_VERSION_STRING mismatch\n") +print("#endif\n") +print("#define ONIG_UNICODE_VERSION_STRING #{$unicode_version.dump}\n") +%w[MAJOR MINOR TEENY].zip(versions) do |n, v| + print("#define ONIG_UNICODE_VERSION_#{n} #{v}\n") +end output.restore Index: ChangeLog =================================================================== --- ChangeLog (revision 55686) +++ ChangeLog (revision 55687) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 15 09:53:48 2016 Nobuyoshi Nakada <nobu@r...> + + * enc/unicode/case-folding.rb, tool/enc-unicode.rb: check if + Unicode versions are consistent with each other. + Fri Jul 15 08:25:15 2016 Jeremy Evans <code@j...> * string.c (STR_BUF_MIN_SIZE): reduce from 128 to 127 Index: enc/unicode/case-folding.rb =================================================================== --- enc/unicode/case-folding.rb (revision 55686) +++ enc/unicode/case-folding.rb (revision 55687) @@ -155,8 +155,16 @@ class CaseFolding https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L155 dest.print("/* DO NOT EDIT THIS FILE. */\n") dest.print("/* Generated by enc/unicode/case-folding.rb */\n\n") + versions = version.scan(/\d+/) + dest.print("#if defined ONIG_UNICODE_VERSION_STRING && !( \\\n") + %w[MAJOR MINOR TEENY].zip(versions) do |n, v| + dest.print(" ONIG_UNICODE_VERSION_#{n} == #{v} && \\\n") + end + dest.print(" 1)\n") + dest.print("# error ONIG_UNICODE_VERSION_STRING mismatch\n") + dest.print("#endif\n") dest.print("#define ONIG_UNICODE_VERSION_STRING #{version.dump}\n") - %w[MAJOR MINOR TEENY].zip(version.scan(/\d+/)) do |n, v| + %w[MAJOR MINOR TEENY].zip(versions) do |n, v| dest.print("#define ONIG_UNICODE_VERSION_#{n} #{v}\n") end dest.print("\n") Index: enc/unicode/name2ctype.h =================================================================== --- enc/unicode/name2ctype.h (revision 55686) +++ enc/unicode/name2ctype.h (revision 55687) @@ -28605,8 +28605,8 @@ static const OnigCodePoint CR_Age_8_0[] https://github.com/ruby/ruby/blob/trunk/enc/unicode/name2ctype.h#L28605 0xe0100, 0xe01ef, 0xefffe, 0x10ffff, }; /* CR_Age_8_0 */ -#endif /* USE_UNICODE_AGE_PROPERTIES */ +#endif /* USE_UNICODE_AGE_PROPERTIES */ /* 'In_Basic_Latin': Block */ #define CR_In_Basic_Latin CR_ASCII @@ -30195,8 +30195,8 @@ static const OnigCodePoint CR_In_No_Bloc https://github.com/ruby/ruby/blob/trunk/enc/unicode/name2ctype.h#L30195 0xe0080, 0xe00ff, 0xe01f0, 0xeffff, }; /* CR_In_No_Block */ -#endif /* USE_UNICODE_PROPERTIES */ +#endif /* USE_UNICODE_PROPERTIES */ static const OnigCodePoint* const CodeRanges[] = { CR_NEWLINE, CR_Alpha, @@ -30747,12 +30747,10 @@ static const struct uniname2ctype_struct https://github.com/ruby/ruby/blob/trunk/enc/unicode/name2ctype.h#L30747 /* maximum key range = 5324, duplicates = 0 */ #endif /* USE_UNICODE_PROPERTIES */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif static unsigned int uniname2ctype_hash (str, len) @@ -34025,3 +34023,14 @@ uniname2ctype(const UChar *name, unsigne https://github.com/ruby/ruby/blob/trunk/enc/unicode/name2ctype.h#L34023 if (p) return p->ctype; return -1; } +#if defined ONIG_UNICODE_VERSION_STRING && !( \ + ONIG_UNICODE_VERSION_MAJOR == 8 && \ + ONIG_UNICODE_VERSION_MINOR == 0 && \ + ONIG_UNICODE_VERSION_TEENY == 0 && \ + 1) +# error ONIG_UNICODE_VERSION_STRING mismatch +#endif +#define ONIG_UNICODE_VERSION_STRING "8.0.0" +#define ONIG_UNICODE_VERSION_MAJOR 8 +#define ONIG_UNICODE_VERSION_MINOR 0 +#define ONIG_UNICODE_VERSION_TEENY 0 Index: enc/unicode/casefold.h =================================================================== --- enc/unicode/casefold.h (revision 55686) +++ enc/unicode/casefold.h (revision 55687) @@ -1,6 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L1 /* DO NOT EDIT THIS FILE. */ /* Generated by enc/unicode/case-folding.rb */ +#if defined ONIG_UNICODE_VERSION_STRING && !( \ + ONIG_UNICODE_VERSION_MAJOR == 8 && \ + ONIG_UNICODE_VERSION_MINOR == 0 && \ + ONIG_UNICODE_VERSION_TEENY == 0 && \ + 1) +# error ONIG_UNICODE_VERSION_STRING mismatch +#endif #define ONIG_UNICODE_VERSION_STRING "8.0.0" #define ONIG_UNICODE_VERSION_MAJOR 8 #define ONIG_UNICODE_VERSION_MINOR 0 @@ -1337,12 +1344,10 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L1344 /* maximum key range = 2294, duplicates = 0 */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif /*ARGSUSED*/ static unsigned int @@ -4369,12 +4374,10 @@ static const CaseUnfold_11_Type CaseUnfo https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L4374 /* maximum key range = 1827, duplicates = 0 */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif /*ARGSUSED*/ static unsigned int @@ -6004,12 +6007,10 @@ static const CaseUnfold_12_Type CaseUnfo https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L6007 /* maximum key range = 71, duplicates = 0 */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif /*ARGSUSED*/ static unsigned int @@ -6160,12 +6161,10 @@ static const CaseUnfold_13_Type CaseUnfo https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L6161 /* maximum key range = 20, duplicates = 0 */ -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__) inline -#endif +#elif defined(__GNUC__) +__inline #endif /*ARGSUSED*/ static unsigned int -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/