зеркало из https://github.com/github/ruby.git
encoding.c: preserved encindex
* encoding.c (rb_enc_init): register preserved indexes. * internal.h (ruby_preserved_encindex): move from encoding.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
22d508fc27
Коммит
263ce88f9f
|
@ -1,3 +1,9 @@
|
|||
Tue Jul 2 17:22:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* encoding.c (rb_enc_init): register preserved indexes.
|
||||
|
||||
* internal.h (ruby_preserved_encindex): move from encoding.c.
|
||||
|
||||
Tue Jul 2 11:14:36 2013 Shota Fukumori <sorah@cookpad.com>
|
||||
|
||||
Tue Jul 2 11:14:36 2013 Shota Fukumori <sorah@cookpad.com>
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#define NO_LOCALE_CHARMAP 1
|
||||
#define NO_PRESERVED_ENCODING 1
|
||||
#include "encoding.c"
|
||||
|
|
11
encoding.c
11
encoding.c
|
@ -519,13 +519,6 @@ rb_encdb_set_unicode(int index)
|
|||
rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
|
||||
}
|
||||
|
||||
enum {
|
||||
ENCINDEX_ASCII,
|
||||
ENCINDEX_UTF_8,
|
||||
ENCINDEX_US_ASCII,
|
||||
ENCINDEX_BUILTIN_MAX
|
||||
};
|
||||
|
||||
extern rb_encoding OnigEncodingUTF_8;
|
||||
extern rb_encoding OnigEncodingUS_ASCII;
|
||||
|
||||
|
@ -541,6 +534,10 @@ rb_enc_init(void)
|
|||
ENC_REGISTER(UTF_8);
|
||||
ENC_REGISTER(US_ASCII);
|
||||
#undef ENC_REGISTER
|
||||
#ifndef NO_PRESERVED_ENCODING
|
||||
#define ENCDB_REGISTER(name, enc) enc_register_at(ENCINDEX_##enc, name, NULL)
|
||||
#undef ENCDB_REGISTER
|
||||
#endif
|
||||
enc_table.count = ENCINDEX_BUILTIN_MAX;
|
||||
}
|
||||
|
||||
|
|
15
internal.h
15
internal.h
|
@ -196,9 +196,20 @@ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
|
|||
void Init_ext(void);
|
||||
|
||||
/* encoding.c */
|
||||
ID rb_id_encoding(void);
|
||||
#ifdef RUBY_ENCODING_H
|
||||
enum ruby_preserved_encindex {
|
||||
ENCINDEX_ASCII,
|
||||
ENCINDEX_UTF_8,
|
||||
ENCINDEX_US_ASCII,
|
||||
|
||||
/* encoding.c */
|
||||
#ifndef NO_PRESERVED_ENCODING
|
||||
/* preserved indexes */
|
||||
#endif
|
||||
|
||||
ENCINDEX_BUILTIN_MAX
|
||||
};
|
||||
#endif
|
||||
ID rb_id_encoding(void);
|
||||
void rb_gc_mark_encodings(void);
|
||||
|
||||
/* error.c */
|
||||
|
|
Загрузка…
Ссылка в новой задаче