* encoding.c: move `ruby_encoding_index` stuff from
include/ruby/encoding.h to hide the extra field.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_default_internal): fix rdoc. `__FILE__` is
in filesystem encoding but not `default_internal`.
[ruby-core:61894] [Bug #9713]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (rb_str_dynamic_intern): associate proper encoding with
the result symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_get_index): the encoding of dynamic symbol
comes from fstr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (enc_capable): Symbol is now encoding capable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (get_actual_encoding): get actual encoding according to
the BOM if exists.
* string.c (rb_str_inspect): use according encoding, instead of
pseudo encodings, UTF-{16,32}. [ruby-core:59757] [Bug #8940]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (load_encoding): should preserve outer errinfo, so that
expected exception may not be lost. [ruby-core:57949] [Bug #9038]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (is_obj_encoding): new macro to check if obj is an
Encoding. obj can be any type while is_data_encoding expects T_DATA
only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_code_to_mbclen): add new function which returns
mbclen from codepoint like as rb_enc_codelen() but 0 for invalid
char.
* include/ruby/encoding.h (rb_enc_code_to_mbclen): declaration and
shortcut macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (enc_set_index): since r41967, old terminator is dealt
with in str_fill_term(). should not consider it here because this
function is called before any encoding is set.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (enc_inspect): use PRIsVALUE to preserve the result
encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (enc_set_index): deal with terminator so that
rb_enc_set_index also works.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_associate_index): fill new terminator length, not
old one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_associate_index): refill the terminator if it
becomes longer than before. [ruby-dev:47500] [Bug #8624]
* string.c (str_null_char, str_fill_term): get rid of out of bound
access.
* string.c (rb_str_fill_terminator): add a parameter for the length of
new terminator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RBASIC_CLASS(obj) macro which returns a class of `obj'.
This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
This function reveal interal (hidden) object by rb_obj_hide().
Note that do not change class before and after hiding.
Only permitted example is:
klass = RBASIC_CLASS(obj);
rb_obj_hide(obj);
....
rb_obj_reveal(obj, klass);
TODO: API design. rb_obj_reveal() should be replaced with others.
TODO: modify constified variables using cast may be harmful for
compiler's analysis and optimizaton.
Any idea to prohibt inserting RBasic::klass directly?
If rename RBasic::klass and force to use RBASIC_CLASS(obj),
then all codes such as `RBASIC(obj)->klass' will be
compilation error. Is it acceptable? (We have similar
experience at Ruby 1.9,
for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
UTF-16 and UTF-32 are also treated as unicode since r37101.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts
* encoding.c (rb_enc_unicode_p): oniguruma provides Unicode flag.
because UTF-16 and UTF-32 is also treated as unicode in this context.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (load_encoding): explicit cast to suppress warning.
Though the cast truncates some bits, from heuristic analysis I
believe it is OK to do so here.
* bignum.c (rb_cstr_to_inum): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (enc_alias_internal): use strdup defined as macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e