Skip to content

Commit

Permalink
* include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jan 3, 2008
1 parent 1aaf8b1 commit 52ed8c4
Show file tree
Hide file tree
Showing 23 changed files with 872 additions and 652 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fri Jan 4 00:54:43 2008 Yukihiro Matsumoto <[email protected]>

* include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.

Fri Jan 4 00:20:47 2008 Tanaka Akira <[email protected]>

* io.c (io_ungetc): move data in buffer if it is required to store the
Expand Down
21 changes: 11 additions & 10 deletions enc/euc_jp.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ eucjp_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, i, len;
OnigCodePoint n;

len = enc_len(ONIG_ENCODING_EUC_JP, p, end);
len = enclen(ONIG_ENCODING_EUC_JP, p, end);
n = (OnigCodePoint )*p++;
if (len == 1) return n;

Expand All @@ -156,7 +156,8 @@ eucjp_code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
else if (code > 0xffffff) return 0;
else if ((code & 0xff0000) >= 0x800000) return 3;
else if ((code & 0xff00) >= 0x8000) return 2;
else return 0;
else
return ONIGERR_INVALID_CODE_POINT_VALUE;
}

#if 0
Expand Down Expand Up @@ -188,8 +189,8 @@ eucjp_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
*p++ = (UChar )(code & 0xff);

#if 1
if (enc_len(ONIG_ENCODING_EUC_JP, buf, p) != (p - buf))
return ONIGENC_ERR_INVALID_WIDE_CHAR_VALUE;
if (enclen(ONIG_ENCODING_EUC_JP, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
return p - buf;
}
Expand All @@ -210,7 +211,7 @@ eucjp_mbc_case_fold(OnigCaseFoldType flag,
else {
int i;

len = enc_len(ONIG_ENCODING_EUC_JP, p, end);
len = enclen(ONIG_ENCODING_EUC_JP, p, end);
for (i = 0; i < len; i++) {
*lower++ = *p++;
}
Expand All @@ -232,7 +233,7 @@ eucjp_left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc
p = s;

while (!eucjp_islead(*p) && p > start) p--;
len = enc_len(ONIG_ENCODING_EUC_JP, p, s);
len = enclen(ONIG_ENCODING_EUC_JP, p, s);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));
Expand Down Expand Up @@ -311,7 +312,7 @@ eucjp_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)

ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (unsigned int )PropertyListNum)
return ONIGENC_ERR_TYPE_BUG;
return ONIGERR_TYPE_BUG;

return onig_is_in_code_range((UChar* )PropertyList[ctype], code);
}
Expand All @@ -320,7 +321,7 @@ eucjp_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
}

static int
eucjp_get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
eucjp_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[], OnigEncoding enc)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
Expand All @@ -332,8 +333,8 @@ eucjp_get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
PROPERTY_LIST_INIT_CHECK;

ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= PropertyListNum)
return ONIGENC_ERR_TYPE_BUG;
if (ctype >= (OnigCtype )PropertyListNum)
return ONIGERR_TYPE_BUG;

*ranges = PropertyList[ctype];
return 0;
Expand Down
97 changes: 48 additions & 49 deletions enc/iso_8859_10.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
iso8859_10.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -124,8 +124,7 @@ iso_8859_10_mbc_case_fold(OnigCaseFoldType flag,

#if 0
static int
iso_8859_10_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
Expand Down Expand Up @@ -155,52 +154,52 @@ iso_8859_10_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding e
}

static const OnigPairCaseFoldCodes CaseFoldMap[] = {
{ 0xa1, 0xb1 },
{ 0xa2, 0xb2 },
{ 0xa3, 0xb3 },
{ 0xa4, 0xb4 },
{ 0xa5, 0xb5 },
{ 0xa6, 0xb6 },
{ 0xa8, 0xb8 },
{ 0xa9, 0xb9 },
{ 0xaa, 0xba },
{ 0xab, 0xbb },
{ 0xac, 0xbc },
{ 0xae, 0xbe },
{ 0xaf, 0xbf },

{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
{ 0xc2, 0xe2 },
{ 0xc3, 0xe3 },
{ 0xc4, 0xe4 },
{ 0xc5, 0xe5 },
{ 0xc6, 0xe6 },
{ 0xc7, 0xe7 },
{ 0xc8, 0xe8 },
{ 0xc9, 0xe9 },
{ 0xca, 0xea },
{ 0xcb, 0xeb },
{ 0xcc, 0xec },
{ 0xcd, 0xed },
{ 0xce, 0xee },
{ 0xcf, 0xef },

{ 0xd0, 0xf0 },
{ 0xd1, 0xf1 },
{ 0xd2, 0xf2 },
{ 0xd3, 0xf3 },
{ 0xd4, 0xf4 },
{ 0xd5, 0xf5 },
{ 0xd6, 0xf6 },
{ 0xd7, 0xf7 },
{ 0xd8, 0xf8 },
{ 0xd9, 0xf9 },
{ 0xda, 0xfa },
{ 0xdb, 0xfb },
{ 0xdc, 0xfc },
{ 0xdd, 0xfd },
{ 0xde, 0xfe }
{ 0xa1, 0xb1 },
{ 0xa2, 0xb2 },
{ 0xa3, 0xb3 },
{ 0xa4, 0xb4 },
{ 0xa5, 0xb5 },
{ 0xa6, 0xb6 },
{ 0xa8, 0xb8 },
{ 0xa9, 0xb9 },
{ 0xaa, 0xba },
{ 0xab, 0xbb },
{ 0xac, 0xbc },
{ 0xae, 0xbe },
{ 0xaf, 0xbf },

{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
{ 0xc2, 0xe2 },
{ 0xc3, 0xe3 },
{ 0xc4, 0xe4 },
{ 0xc5, 0xe5 },
{ 0xc6, 0xe6 },
{ 0xc7, 0xe7 },
{ 0xc8, 0xe8 },
{ 0xc9, 0xe9 },
{ 0xca, 0xea },
{ 0xcb, 0xeb },
{ 0xcc, 0xec },
{ 0xcd, 0xed },
{ 0xce, 0xee },
{ 0xcf, 0xef },

{ 0xd0, 0xf0 },
{ 0xd1, 0xf1 },
{ 0xd2, 0xf2 },
{ 0xd3, 0xf3 },
{ 0xd4, 0xf4 },
{ 0xd5, 0xf5 },
{ 0xd6, 0xf6 },
{ 0xd7, 0xf7 },
{ 0xd8, 0xf8 },
{ 0xd9, 0xf9 },
{ 0xda, 0xfa },
{ 0xdb, 0xfb },
{ 0xdc, 0xfc },
{ 0xdd, 0xfd },
{ 0xde, 0xfe }
};

static int
Expand Down
2 changes: 1 addition & 1 deletion enc/iso_8859_11.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
iso8859_11.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
67 changes: 33 additions & 34 deletions enc/iso_8859_13.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
iso8859_13.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -124,8 +124,7 @@ iso_8859_13_mbc_case_fold(OnigCaseFoldType flag,

#if 0
static int
iso_8859_13_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
Expand Down Expand Up @@ -159,37 +158,37 @@ iso_8859_13_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding e
}

static const OnigPairCaseFoldCodes CaseFoldMap[] = {
{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
{ 0xc2, 0xe2 },
{ 0xc3, 0xe3 },
{ 0xc4, 0xe4 },
{ 0xc5, 0xe5 },
{ 0xc6, 0xe6 },
{ 0xc7, 0xe7 },
{ 0xc8, 0xe8 },
{ 0xc9, 0xe9 },
{ 0xca, 0xea },
{ 0xcb, 0xeb },
{ 0xcc, 0xec },
{ 0xcd, 0xed },
{ 0xce, 0xee },
{ 0xcf, 0xef },

{ 0xd0, 0xf0 },
{ 0xd1, 0xf1 },
{ 0xd2, 0xf2 },
{ 0xd3, 0xf3 },
{ 0xd4, 0xf4 },
{ 0xd5, 0xf5 },
{ 0xd6, 0xf6 },
{ 0xd8, 0xf8 },
{ 0xd9, 0xf9 },
{ 0xda, 0xfa },
{ 0xdb, 0xfb },
{ 0xdc, 0xfc },
{ 0xdd, 0xfd },
{ 0xde, 0xfe }
{ 0xc0, 0xe0 },
{ 0xc1, 0xe1 },
{ 0xc2, 0xe2 },
{ 0xc3, 0xe3 },
{ 0xc4, 0xe4 },
{ 0xc5, 0xe5 },
{ 0xc6, 0xe6 },
{ 0xc7, 0xe7 },
{ 0xc8, 0xe8 },
{ 0xc9, 0xe9 },
{ 0xca, 0xea },
{ 0xcb, 0xeb },
{ 0xcc, 0xec },
{ 0xcd, 0xed },
{ 0xce, 0xee },
{ 0xcf, 0xef },

{ 0xd0, 0xf0 },
{ 0xd1, 0xf1 },
{ 0xd2, 0xf2 },
{ 0xd3, 0xf3 },
{ 0xd4, 0xf4 },
{ 0xd5, 0xf5 },
{ 0xd6, 0xf6 },
{ 0xd8, 0xf8 },
{ 0xd9, 0xf9 },
{ 0xda, 0xfa },
{ 0xdb, 0xfb },
{ 0xdc, 0xfc },
{ 0xdd, 0xfd },
{ 0xde, 0xfe }
};

static int
Expand Down
Loading

0 comments on commit 52ed8c4

Please sign in to comment.