summaryrefslogtreecommitdiff
path: root/enc/jis
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-08 05:51:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-08 05:51:19 +0000
commita4804fbdf503a9c2b550b877120ca4029c65cdb3 (patch)
tree2a354e79dbe773294347b7123701720a9b1bbb60 /enc/jis
parentf8659dfd94d3f05f365996c68f2f1a78b1e7cbe3 (diff)
support gperf 3.1
* tool/gperf.sed: extracted sed commands to a script. ANSI-C code produced by gperf 3.1 declares length arguments as `size_t`. it causes conflict with existing declarations, and needs casts for a local variable and return statements. [Feature #13883] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/jis')
-rw-r--r--enc/jis/props.h.blt56
-rw-r--r--enc/jis/props.kwd6
-rw-r--r--enc/jis/props.src6
3 files changed, 29 insertions, 39 deletions
diff --git a/enc/jis/props.h.blt b/enc/jis/props.h.blt
index 4ae2e1fd23..df4850133c 100644
--- a/enc/jis/props.h.blt
+++ b/enc/jis/props.h.blt
@@ -1,4 +1,4 @@
-/* C code produced by gperf version 3.0.4 */
+/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: gperf -k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property enc/jis/props.kwd */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -25,20 +25,21 @@
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
-error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
#endif
+#define gperf_offsetof(s, n) (short)offsetof(struct s##_t, s##_str##n)
#line 1 "enc/jis/props.kwd"
/* -*- c -*- */
#define GPERF_DOWNCASE 1
#define GPERF_CASE_STRNCMP 1
static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
+gperf_case_strncmp(const char *s1, const char *s2, size_t n)
{
const UChar *str = (const UChar *)s1;
const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
+ return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, (int)n);
}
enum onigenc_jis_ctype {
@@ -68,7 +69,7 @@ struct enc_property {
unsigned char ctype;
};
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
+/*static const struct enc_property *onig_jis_property(const char *str, unsigned int len);*/
#line 43 "enc/jis/props.kwd"
struct enc_property;
@@ -107,10 +108,7 @@ static unsigned char gperf_downcase[256] =
#ifndef GPERF_CASE_STRNCMP
#define GPERF_CASE_STRNCMP 1
static int
-gperf_case_strncmp (s1, s2, n)
- register const char *s1;
- register const char *s2;
- register unsigned int n;
+gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
{
for (; n > 0;)
{
@@ -127,15 +125,15 @@ gperf_case_strncmp (s1, s2, n)
}
#endif
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)
-inline
-#elif defined(__GNUC__)
+#ifdef __GNUC__
__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
#endif
static unsigned int
-onig_jis_property_hash (str, len)
- register const char *str;
- register unsigned int len;
+onig_jis_property_hash (register const char *str, register size_t len)
{
static const unsigned char asso_values[] =
{
@@ -153,7 +151,7 @@ onig_jis_property_hash (str, len)
1, 13, 13, 13, 1, 13, 1, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13
};
- return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
+ return (unsigned int)len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
}
struct onig_jis_property_pool_t
@@ -175,41 +173,33 @@ static const struct onig_jis_property_pool_t onig_jis_property_pool_contents =
"cyrillic"
};
#define onig_jis_property_pool ((const char *) &onig_jis_property_pool_contents)
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
const struct enc_property *
-onig_jis_property (str, len)
- register const char *str;
- register unsigned int len;
+onig_jis_property (register const char *str, register size_t len)
{
static const struct enc_property wordlist[] =
{
{-1}, {-1}, {-1}, {-1}, {-1},
#line 48 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str5), onigenc_jis_han},
+ {gperf_offsetof(onig_jis_property_pool, 5), onigenc_jis_han},
{-1},
#line 49 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str7), onigenc_jis_latin},
+ {gperf_offsetof(onig_jis_property_pool, 7), onigenc_jis_latin},
#line 50 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str8), onigenc_jis_greek},
+ {gperf_offsetof(onig_jis_property_pool, 8), onigenc_jis_greek},
{-1},
#line 46 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str10), onigenc_jis_hiragana},
+ {gperf_offsetof(onig_jis_property_pool, 10), onigenc_jis_hiragana},
#line 47 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str11), onigenc_jis_katakana},
+ {gperf_offsetof(onig_jis_property_pool, 11), onigenc_jis_katakana},
#line 51 "enc/jis/props.kwd"
- {(char)offsetof(struct onig_jis_property_pool_t, onig_jis_property_pool_str12), onigenc_jis_cyrillic}
+ {gperf_offsetof(onig_jis_property_pool, 12), onigenc_jis_cyrillic}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
- register int key = onig_jis_property_hash (str, len);
+ register unsigned int key = onig_jis_property_hash (str, len);
- if (key <= MAX_HASH_VALUE && key >= 0)
+ if (key <= MAX_HASH_VALUE)
{
register int o = wordlist[key].name;
if (o >= 0)
diff --git a/enc/jis/props.kwd b/enc/jis/props.kwd
index f3235c0100..eaeeccda37 100644
--- a/enc/jis/props.kwd
+++ b/enc/jis/props.kwd
@@ -3,11 +3,11 @@
#define GPERF_CASE_STRNCMP 1
static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
+gperf_case_strncmp(const char *s1, const char *s2, size_t n)
{
const UChar *str = (const UChar *)s1;
const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
+ return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, (int)n);
}
enum onigenc_jis_ctype {
@@ -37,7 +37,7 @@ struct enc_property {
unsigned char ctype;
};
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
+/*!ANSI*/static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
%}
struct enc_property;
diff --git a/enc/jis/props.src b/enc/jis/props.src
index f3235c0100..eaeeccda37 100644
--- a/enc/jis/props.src
+++ b/enc/jis/props.src
@@ -3,11 +3,11 @@
#define GPERF_CASE_STRNCMP 1
static inline int
-gperf_case_strncmp(const char *s1, const char *s2, unsigned int n)
+gperf_case_strncmp(const char *s1, const char *s2, size_t n)
{
const UChar *str = (const UChar *)s1;
const UChar *s = (const UChar *)s2;
- return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, n);
+ return onigenc_with_ascii_strnicmp(ONIG_ENCODING_ASCII, str, str + n, s, (int)n);
}
enum onigenc_jis_ctype {
@@ -37,7 +37,7 @@ struct enc_property {
unsigned char ctype;
};
-static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
+/*!ANSI*/static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
%}
struct enc_property;