зеркало из https://github.com/github/ruby.git
* re.c (rb_char_to_option_kcode): use rb_enc_find_index() instead
of using fixed index value. * enc/Makefile.in (encsrcdir): make US-ASCII built-in. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
45432a6d2b
Коммит
d9ff499bf3
|
@ -1,3 +1,10 @@
|
|||
Mon Jan 14 22:48:16 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* re.c (rb_char_to_option_kcode): use rb_enc_find_index() instead
|
||||
of using fixed index value.
|
||||
|
||||
* enc/Makefile.in (encsrcdir): make US-ASCII built-in.
|
||||
|
||||
Mon Jan 14 22:25:02 2008 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* golf_prelude.rb: Shorter method name completion. Same method
|
||||
|
|
|
@ -14,7 +14,7 @@ TRANSSODIR = $(ENCSODIR)/trans
|
|||
DLEXT = @DLEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
|
||||
BUILTIN_ENCS = ascii.c \
|
||||
BUILTIN_ENCS = ascii.c us_ascii.c\
|
||||
unicode.c utf8.c
|
||||
|
||||
RUBY_SO_NAME = @RUBY_SO_NAME@
|
||||
|
|
|
@ -304,9 +304,12 @@ rb_enc_alias(const char *alias, const char *orig)
|
|||
enum {
|
||||
ENCINDEX_ASCII,
|
||||
ENCINDEX_UTF8,
|
||||
ENCINDEX_US_ASCII,
|
||||
ENCINDEX_BUILTIN_MAX
|
||||
};
|
||||
|
||||
extern rb_encoding OnigEncodingUS_ASCII;
|
||||
|
||||
void
|
||||
rb_enc_init(void)
|
||||
{
|
||||
|
@ -314,6 +317,7 @@ rb_enc_init(void)
|
|||
#define ENC_REGISTER(enc) enc_register_at(ENCINDEX_##enc, rb_enc_name(ONIG_ENCODING_##enc), ONIG_ENCODING_##enc)
|
||||
ENC_REGISTER(ASCII);
|
||||
ENC_REGISTER(UTF8);
|
||||
enc_register_at(ENCINDEX_US_ASCII, rb_enc_name(&OnigEncodingUS_ASCII), &OnigEncodingUS_ASCII);
|
||||
#undef ENC_REGISTER
|
||||
}
|
||||
|
||||
|
|
12
re.c
12
re.c
|
@ -142,12 +142,6 @@ rb_memsearch(const void *x0, long m, const void *y0, long n)
|
|||
#define ARG_ENCODING_FIXED 16
|
||||
#define ARG_ENCODING_NONE 32
|
||||
|
||||
#define ARG_KCODE_NONE 0
|
||||
#define ARG_KCODE_EUC 1
|
||||
#define ARG_KCODE_SJIS 2
|
||||
#define ARG_KCODE_UTF8 3
|
||||
#define ARG_KCODE_MASK 3
|
||||
|
||||
static int
|
||||
char_to_option(int c)
|
||||
{
|
||||
|
@ -191,13 +185,13 @@ rb_char_to_option_kcode(int c, int *option, int *kcode)
|
|||
*kcode = -1;
|
||||
return (*option = ARG_ENCODING_NONE);
|
||||
case 'e':
|
||||
*kcode = ARG_KCODE_EUC;
|
||||
*kcode = rb_enc_find_index("EUC-JP");
|
||||
break;
|
||||
case 's':
|
||||
*kcode = ARG_KCODE_SJIS;
|
||||
*kcode = rb_enc_find_index("Shitf_JIS");
|
||||
break;
|
||||
case 'u':
|
||||
*kcode = ARG_KCODE_UTF8;
|
||||
*kcode = rb_enc_find_index("UTF-8");
|
||||
break;
|
||||
default:
|
||||
*kcode = -1;
|
||||
|
|
|
@ -37,7 +37,7 @@ $stderr.reopen($stdout)
|
|||
error = ''
|
||||
|
||||
srcdir = File.dirname(__FILE__)
|
||||
`#{ruby} -I#{srcdir} -I#{srcdir}/lib #{srcdir}/sample/test.rb`.each_line do |line|
|
||||
`#{ruby} -I.ext/#{RUBY_PLATFORM} -I#{srcdir}/lib #{srcdir}/sample/test.rb`.each_line do |line|
|
||||
if line =~ /^end of test/
|
||||
print "\ntest succeeded\n"
|
||||
exit true
|
||||
|
|
Загрузка…
Ссылка в новой задаче