a_matsuda
02c8545037
* doc/contributing.rdoc: [DOC] curses is no more in the stdlib
...
* doc/contributors.rdoc: Ditto.
* doc/maintainers.rdoc: Ditto.
* doc/contributors.rdoc: Ditto.
* doc/standard_library.rdoc: Ditto.
* doc/syntax/modules_and_classes.rdoc: Ditto.
* encoding.c: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10 11:22:13 +00:00
ko1
c5e08b764e
* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
...
safe functions during garbage collection such as xfree().
On default, T_DATA objects are freed at same points as fianlizers.
This approach protects issues such as reported by [ruby-dev:35578].
However, freeing T_DATA objects immediately helps heap usage.
Most of T_DATA (in other words, most of dfree functions) are safe.
However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
nobu
274e50c189
encoding.c: preserve outer errinfo
...
* 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
2013-10-21 14:57:55 +00:00
nobu
eeb3156eca
encoding.c: defer code page table
...
* encoding.c (rb_locale_encindex): defer initialization of win32 code
page table until encoding db loaded.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19 10:55:39 +00:00
nobu
6531e12e0b
win32/file.c: make mapping at initialization
...
* win32/file.c (code_page_i, rb_w32_init_file): make encoding to code
page mapping at initialization directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07 07:20:59 +00:00
nobu
d8441fcc6e
encdb.c, encoding.c: make BOM-encodings dummy
...
* enc/encdb.c (ENC_DUMMY_UNICODE): make BOM-encodings dummy.
* encoding.c (enc_autoload): keep dummy encodings dummy.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24 08:15:18 +00:00
nobu
6c00e17706
encoding.c: is_obj_encoding
...
* 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
2013-07-25 08:21:23 +00:00
ko1
72293b69f8
* encoding.c (check_encoding): Check T_DATA or not.
...
is_data_encoding(obj) assumes that `obj' is T_DATA.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25 07:19:59 +00:00
nobu
241ad8877d
encoding.c: add rb_enc_code_to_mbclen
...
* 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
2013-07-20 03:13:40 +00:00
nobu
241b1e6324
encoding.c: revert r41964
...
* 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
2013-07-16 04:32:09 +00:00
nobu
5f2080048e
localeinit.c: split
...
* localeinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
move from encoding.c.
* miniinit.c (rb_locale_charmap, Init_enc_set_filesystem_encoding):
define miniruby specific functions only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14 17:47:25 +00:00
nobu
a10591ac8c
encoding.c: NO_PRESERVED_ENCODING
...
* encoding.c (rb_enc_init): no longer needs NO_PRESERVED_ENCODING.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14 17:33:02 +00:00
nobu
0953efabbb
encoding.c: defer autoload
...
* encoding.c (enc_inspect): defer loading autoloaded encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14 17:32:07 +00:00
nobu
599076c45f
encoding.c: encoding check
...
* encoding.c (enc_check_encoding): use is_data_encoding() to check
type consistently.
* encoding.c (must_encoding): return rb_encoding* instead of encoding
index.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14 17:31:14 +00:00
nobu
2dc7d111f8
encoding.c: encoding at inspect
...
* 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
2013-07-14 17:21:36 +00:00
nobu
f2dc5f15ba
encoding.c: terminator in enc_set_index
...
* 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
2013-07-14 17:21:32 +00:00
nobu
1ae7e6b654
encoding.c: new termlen not oldtermlen
...
* 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
2013-07-13 03:27:37 +00:00
nobu
8b8cce322b
encoding.c: refill terminator at associating encoding
...
* 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
2013-07-12 07:28:40 +00:00
nobu
58919a4da9
re.c: use built-in encoding indexes
...
* internal.h: add EUC-JP and Windows-31J.
* re.c (rb_char_to_option_kcode): use built-in encoding indexes in
internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:47 +00:00
nobu
14dfdb5eaf
dir.c: use built-in encoding indexes
...
* internal.h: add UTF8-MAC.
* dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:43 +00:00
nobu
66564ab6b2
string.c: use built-in encoding indexes
...
* internal.h: add UTF-{16,32} dummy encodings.
* string.c (rb_str_inspect, str_scrub0): use built-in encoding indexes
in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:38 +00:00
nobu
42a2f89b39
io.c: use built-in encoding indexes
...
* internal.h: add UTF-{16,32}{BE,LE}.
* io.c (io_strip_bom): use built-in encoding indexes in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:34 +00:00
nobu
ea2b115efd
internal.h: use built-in encoding indexes
...
* internal.h (rb_{ascii8bit,utf8,usascii}_encindex): use built-in
encoding indexes for optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:30 +00:00
nobu
869a1b5876
encoding.c: use built-in encoding indexes
...
* encoding.c (enc_inspect, rb_locale_encindex),
(enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
encoding indexes directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:23 +00:00
nobu
aa1acf1d42
encoding.c: validate index
...
* encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
argument encoding index.
* include/ruby/encoding.h (ENCODING_SET): use rb_enc_set_index()
instead of setting inlined bits directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:19 +00:00
nobu
263ce88f9f
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
2013-07-02 08:22:15 +00:00
charliesome
fff3589899
* compile.c (make_name_for_block): use PRIsVALUE in format string
...
instead of %s and RSTRING_PTR to protect objects from being garbage
collected too soon
* encoding.c (str_to_encindex): ditto
* hash.c (rb_hash_fetch_m): ditto
* io.c (rb_io_reopen): ditto
* parse.y (reg_fragment_check_gen): ditto
* parse.y (reg_compile_gen): ditto
* parse.y (ripper_assert_Qundef): ditto
* re.c (rb_reg_raise): ditto
* ruby.c (set_option_encoding_once): ditto
* vm_eval.c (rb_throw_obj): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 11:31:21 +00:00
shugo
1f828497d1
* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
...
when $SAFE is set to 4. $SAFE=4 is now obsolete.
[ruby-core:55222] [Feature #8468 ]
* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
Kernel#untrusted?, untrust, and trust are now deprecated.
Their behavior is same as tainted?, taint, and untaint,
respectively.
* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
respectively.
* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
ext/socket/socket.c, ext/socket/udpsocket.c,
ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
safe.c, string.c, thread.c, transcode.c, variable.c,
vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
$SAFE=4.
* test/dl/test_dl2.rb, test/erb/test_erb.rb,
test/readline/test_readline.rb,
test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
test/ruby/test_array.rb, test/ruby/test_dir.rb,
test/ruby/test_encoding.rb, test/ruby/test_env.rb,
test/ruby/test_eval.rb, test/ruby/test_exception.rb,
test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
test/ruby/test_io.rb, test/ruby/test_method.rb,
test/ruby/test_module.rb, test/ruby/test_object.rb,
test/ruby/test_pack.rb, test/ruby/test_rand.rb,
test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
test/ruby/test_struct.rb, test/ruby/test_thread.rb,
test/ruby/test_time.rb: remove tests for $SAFE=4.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
ayumin
66795c4774
* encoding.c: document fix, change default script encoding.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 14:15:42 +00:00
ko1
83aba04862
* include/ruby/ruby.h: constify RBasic::klass and add
...
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
2013-05-13 10:49:11 +00:00
zzak
9ef4e13459
* array.c: Document synonymous methods, by windwiny [GH-277]
...
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
zzak
d4d14c1988
* encoding.c: Typo in Encoding overview by Tom Wardrop [GH fixes #255 ]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-04 01:24:40 +00:00
nobu
66fd9d44d8
adjust style.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
nobu
0751c5d16d
reapply r37098
...
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
2012-10-06 14:22:52 +00:00
naruse
a9497d5a84
Revert r37098
...
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
2012-10-06 03:04:55 +00:00
nobu
928d1a5261
encoding.c: unicode_p
...
* enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): endian-less wide
UTF encodings are dummy but Unicode.
* encoding.c (rb_encdb_set_unicode): set Unicode flag.
* template/encdb.h.tmpl: allow ENC_DUMMY variants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-06 00:42:14 +00:00
nobu
d5ac3f71aa
encoding.c: unicode_p
...
* encoding.c (rb_enc_unicode_p): oniguruma provides Unicode flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 15:14:15 +00:00
shyouhei
8c36fc30c2
add casts
...
* 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
2012-07-18 04:46:04 +00:00
nobu
da5ac6f565
encoding.c: strdup macro
...
* 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
2012-06-13 04:39:06 +00:00
nobu
1102fd2f3e
* remove trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 22:44:01 +00:00
nobu
57fb219905
* reduce UNREACHABLE.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15 00:06:13 +00:00
drbrain
da39d32f60
* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control
...
reaches end of non-void function" warnings. [ruby-trunk - Bug #6066 ]
* re.c (name_to_backref_number): ditto.
* object.c (rb_Float): ditto.
* io.c (io_readpartial): ditto.
* io.c (io_read_nonblock): ditto.
* pack.c (rb_uv_to_utf8): ditto.
* proc.c (rb_method_entry_arity): ditto.
* vm_method.c (rb_f_notimplement): ditto.
* struct.c (rb_struct_aset_id): ditto.
* class.c (rb_scan_args): ditto.
* process.c (rlimit_resource_type): ditto.
* process.c (rlimit_resource_value): ditto.
* process.c (p_uid_switch): ditto.
* process.c (p_gid_switch): ditto.
* ext/digest/digest.c (rb_digest_instance_update): ditto.
* ext/digest/digest.c (rb_digest_instance_finish): ditto.
* ext/digest/digest.c (rb_digest_instance_reset): ditto.
* ext/digest/digest.c (rb_digest_instance_block_length): ditto.
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto.
* ext/dl/handle.c (rb_dlhandle_close): ditto.
* ext/tk/tcltklib.c (pending_exception_check0): ditto.
* ext/tk/tcltklib.c (pending_exception_check1): ditto.
* ext/tk/tcltklib.c (ip_cancel_eval_core): ditto.
* ext/tk/tcltklib.c (lib_get_reltype_name): ditto.
* ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto.
* ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto.
* ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto.
* ext/fiddle/conversions.c (generic_to_value): ditto.
* ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto.
* ext/socket/socket.c (sock_s_getnameinfo): ditto.
* ext/ripper/eventids2.c (ripper_token2eventid): ditto.
* cont.c (return_fiber): ditto.
* dmydln.c (dln_load): ditto.
* vm_insnhelper.c (vm_search_normal_superclass): ditto.
* bignum.c (big_fdiv): ditto.
* marshal.c (r_symlink): ditto.
* marshal.c (r_symbol): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 23:45:37 +00:00
nobu
33ceea5cdb
* encoding.c (rb_find_encoding): new function find encoding from
...
arbitrary object as a pointer to rb_encoding, and return NULL if
not found.
* io.c (io_encoding_set): just warn unsupported encodings, but not
exception. [ruby-core:40726] [Bug #5567 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12 10:23:17 +00:00
naruse
a1aeb842d0
Correct documentation of r34608.
...
* correct explanation of ASCII-8BIT.
* "Locale encoding" is the name of the encoding derived from
Encoding.locale_encoding. Its correct name is "Script encoding".
* Add Locale encoding and Filesystem encoding.
* default external is set by locale encoding if -E is not given.
* functional methods normally written as functional style on ruby's doc.
* fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 01:23:00 +00:00
naruse
776197f80d
Temporary fix not to use non ASCII.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 00:53:37 +00:00
drbrain
b14b83ae92
* encoding.c (Init_Encoding): Add IO example of internal and external
...
encoding. Fixed a typo in the force_encoding example. [#5949 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14 23:29:14 +00:00
drbrain
6d76f39fc8
* encoding.c (Init_Encoding): Add Encoding documentation.
...
[ruby-trunk - Bug #5949 ]
* encoding.c (rb_set_default_external): Fix typo in documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14 22:59:15 +00:00
naruse
b346d7a69c
* encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string
...
is ascii only string. [ruby-core:42354] [Bug #5968 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-05 15:17:50 +00:00
naruse
b1428ace6b
* encoding.c (rb_enc_compatible): fix segv on symbols.
...
[ruby-core:42204] [Bug #5921 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-21 12:57:37 +00:00
usa
5a2758ed1e
* encoding.c (rb_locale_charmap): ignore calling nl_langinfo_codeset()
...
on Windows except cygwin. [experimental]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03 15:19:24 +00:00
nobu
fecda0d9f7
* encoding.c (require_enc): reject only loading from untrusted
...
load paths. [ruby-dev:44541] [Bug #5279 ]
* transcode.c (load_transcoder_entry): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-25 07:54:35 +00:00
nobu
3a6c3a672f
* encoding.c (load_encoding): predefined encoding names are safe.
...
[ruby-dev:44469] [Bug #5279 ]
* transcode.c (load_transcoder_entry): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-06 04:15:49 +00:00
nobu
a0b9f48674
* encoding.c (enc_find): mistakenly remained !. [Bug #5150 ]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 22:46:34 +00:00
naruse
7340796338
Revert "* encoding.c (enc_find): simplified with RB_TYPE_P."
...
This reverts commit r32817.
It has less code on the surface, but it needs more condition.
Moreover it doesn't need !.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 22:39:28 +00:00
nobu
048202f446
* encoding.c (enc_find): simplified with RB_TYPE_P.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 14:50:54 +00:00
naruse
48bc63fa7a
Fix r32811: add UNSPECIFIED_ENCODING case.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 14:27:56 +00:00
naruse
faf295f1e1
* encoding.c (str_to_encoding): rename from to_encoding and
...
use str_to_encindex.
* encoding.c (str_to_encindex): split from to_encoding.
* encoding.c (rb_to_encoding): use str_to_encoding.
* encoding.c (rb_obj_encoding): don't bypass rb_encoding*.
If it uses rb_encoding*, it bypass encindex. If it uses encindex,
it doesn't bypass.
* encoding.c (enc_find): add shortcut for encoding object, use
str_to_encindex, and avoid bypass rb_encoding*.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-02 07:35:21 +00:00
nobu
cfa0035962
* encoding.c (rb_enc_set_index, rb_enc_associate_index): should
...
check if frozen.
* parse.y (rb_intern3), ruby.c (process_options, ruby_script):
defer freezing after associating encodings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:44:46 +00:00
akr
e7996eb3cc
* internal.h: declare internal functions here.
...
* node.h: declare NODE dependent internal functions here.
* iseq.h: declare rb_iseq_t dependent internal functions here.
* vm_core.h: declare rb_thread_t dependent internal functions here.
* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
thread.c, time.c, transcode.c, variable.c, vm.c,
tool/compile_prelude.rb: don't declare internal functions declared
in above headers. include above headers if required.
Note that rb_thread_mark() was declared as
void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
void rb_thread_mark(void *ptr) in vm.c. Now it is declared as
the later in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
naruse
c479bde4fe
* encoding.c (rb_locale_charmap): When ruby process is run as Windows
...
Service the console codepage is not set, GetConsoleCP returns 0.
So on such environment, use GetACP().
http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
patched by Rafal Bigaj [ruby-core:36832] [Bug #4854 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-10 07:42:24 +00:00
drbrain
58b14e7892
* encoding.c: Mention that Encoding.compatible? can work with more
...
than just Strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-10 00:52:54 +00:00
nobu
d371e3583e
* lib: revert r31635-r31638 and untabify with expand(1).
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 00:07:25 +00:00
drbrain
40e6facf51
* encoding.c: Improve documentation for Encoding#default_external and
...
Encoding#default_internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 20:58:19 +00:00
nobu
21e6862cd5
* encoding.c (enc_find): accept Encoding objects.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 16:17:01 +00:00
naruse
a8f5a06a68
* encoding.c (rb_enc_compatible): change the rule for empty strings:
...
remove the special treatment of the US-ASCII encoded empty string.
Now Encoding.compatible? usually respect the encoding of the
receiver.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:15 +00:00
akr
864f60b837
* encoding.c: parenthesize macro arguments.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 00:28:25 +00:00
naruse
e59b9e9e43
* encoding.c (enc_alias_internal): use st_insert2 and change return
...
value to int.
* encoding.c (enc_alias): follow enc_alias_internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 19:19:47 +00:00
naruse
c99a895e28
* encoding.c (enc_alias_internal): use xfree instead of free.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 17:40:10 +00:00
naruse
260e8ce637
* encoding.c (enc_alias_internal): free the copied key and
...
return NULL when given key is already regisitered.
* encoding.c (enc_alias): call set_encoding_const only when the
alias is not registered yet.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 12:28:42 +00:00
nobu
0bd71ff354
* configure.in (XCFLAGS): use -fvisibility=hidden if possible.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21 21:38:25 +00:00
nobu
25b9eb5e57
* include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
...
add parent member.
* error.c (rb_typeddata_inherited_p): new function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
akr
abb855513c
update doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-17 23:33:16 +00:00
akr
a4702079b8
update comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 13:37:50 +00:00
naruse
d13e191d25
* encoding.c (rb_enc_unicode_p): check the encoding is Unicode
...
or not by the name; not function's pointer. [ruby-dev:41479]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 05:46:58 +00:00
naruse
2f9d028202
* encoding.c (rb_filesystem_encindex): avoid infinite require
...
loop. [ruby-core:30467]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 03:57:36 +00:00
naruse
f39ad4cab2
* include/ruby/encoding.h (rb_filesystem_encindex): defined.
...
* include/ruby/encoding.h (rb_locale_encindex): ditto.
* encoding.c (rb_filesystem_encindex): remove static.
* encoding.c (rb_locale_encindex): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 14:47:16 +00:00
marcandre
7729de4d91
* array.c: Documentation: change => in call-seq to ->.
...
Harmonize "#=>" in examples. [ruby-core:30206]
* bignum.c: ditto
* class.c: ditto
* compar.c: ditto
* cont.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enum.c: ditto
* enumerator.c: ditto
* error.c: ditto
* eval.c: ditto
* file.c: ditto
* gc.c: ditto
* io.c: ditto
* load.c: ditto
* marshal.c: ditto
* math.c: ditto
* numeric.c: ditto
* object.c: ditto
* pack.c: ditto
* proc.c: ditto
* process.c: ditto
* random.c: ditto
* range.c: ditto
* re.c: ditto
* ruby.c: ditto
* signal.c: ditto
* sprintf.c: ditto
* string.c: ditto
* struct.c: ditto
* thread.c: ditto
* time.c: ditto
* transcode.c: ditto
* variable.c: ditto
* vm_eval.c: ditto
* vm_method.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu
9f9ace81f8
* encoding.c (enc_replicate): new encoding name must be valid
...
c-string. [ruby-dev:40954]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 03:08:51 +00:00
kazu
1edc8d3b9e
fix rdoc
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 02:20:29 +00:00
naruse
8a144fdedc
* encoding.c (enc_set_filesystem_encoding):
...
filesystem encoding on Mac OS X is now
default external encoding. so Mac OS X is now
treated as one of Unix. [ruby-dev:40439]
* file.c (file_path_convert): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 17:11:28 +00:00
naruse
3da3230f0c
* encoding.c (Init_Encoding): undef Encoding.new because
...
a class which is rb_undef_alloc-func-ed can't call new method.
[ruby-dev:39862]
* vm.c (Init_VM): undef RubyVM.new and RubyVM::Env.new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-21 10:12:21 +00:00
naruse
07f81c06ca
Add rdoc and test of Encoding#replicate.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-12 16:35:10 +00:00
naruse
614a8427ce
* encoding.c (enc_replicate): add Encoding#replicate(name).
...
* encoding.c (enc_replicate_with_index): renamed from old
enc_replicate.
* encoding.c (rb_enc_from_encoding_index): split from
rb_enc_from_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 03:59:34 +00:00
nobu
4d786d21e3
* removed spaces just before tabs.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
naruse
a7db2c1efd
* encoding.c (enc_set_default_encoding): reset filesytem
...
encoding because on resetting default_external because
Unix's filesystem encoding depends on default_external.
* encoding.c (enc_set_filesystem_encoding): added.
* ruby.c (process_options): don't call rb_filesystem_encoding
because filesystem encoding is reset when default_external
is reset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 03:38:20 +00:00
akr
1aba3f9d76
* encoding.c (rb_filesystem_encindex): use default external encoding
...
instead of locale encoding in Unix.
* ruby.c (process_options): delay inifilesystem encoding
initialization after default external encoding initialization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-15 16:37:38 +00:00
naruse
0859e7cb87
* encoding.c (rb_filesystem_encindex): add fallback to
...
ASCII-8BIT on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-06 00:33:56 +00:00
akr
b9e0294eda
fix typos.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
naruse
2f2e8455e3
Revert set locale and filesystem encindex in Init_Encoding.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 09:40:25 +00:00
naruse
06346d5849
* encoding.c (Init_Encoding): set locale and filesystem encindex.
...
* ruby.c (process_options): move setting func of filesystem
encoding to Init_Encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 08:14:09 +00:00
nobu
feb34709fe
* encoding.c (enc_find): fixed rdoc formatting.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 08:02:02 +00:00
naruse
7a884fe466
* encoding.c (get_filesystem_encoding): removed.
...
* encoding.c (rb_locale_encindex): added.
* encoding.c (rb_filesystem_encindex): added.
* encoding.c (rb_filesystem_encindex): add an alias 'filesystem'.
[ruby-dev:39574]
* encoding.c (enc_find): add rdoc about special aliases.
* gem_prelude.rb (Gem.set_home): use Encoding.find('filesystem').
* gem_prelude.rb (Gem.set_paths): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 07:34:24 +00:00
naruse
8d9e64fb38
* encoding.c (get_filesystem_encoding):
...
add Encoding.filesystem_encoding [ruby-dev:39546]
also see [ruby-core:25959]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 06:06:10 +00:00
akr
525be7f048
fix a typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-23 13:30:29 +00:00
naruse
f7554133b2
* encoding.c (rb_enc_unicode_p): defined.
...
Returns 1 when the encoding is Unicode series
other than UTF-7 else 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 00:34:00 +00:00
naruse
5f5706c38f
* encoding.c (rb_filesystem_encoding): On Unix systems,
...
filesystem encoding should be locale encoding.
[ruby-dev:39393] and see also [ruby-dev:35617]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 19:24:24 +00:00
nobu
b46cd0e400
* include/ruby/ruby.h (rb_data_type_struct): constified dsize.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:11:35 +00:00
naruse
e666111955
* encoding.c (rb_enc_compatible): If a string is empty and
...
other's encoding is US-ASCII, returns the empty string's encoding.
[ruby-list:46274]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 22:52:39 +00:00
naruse
8b83fc2704
* encoding.c (is_data_encoding): fix condition.
...
* encoding.c (enc_capable): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 22:39:54 +00:00
naruse
e56bf07b16
New API Encoding#ascii_compatible?.
...
* encoding.c (enc_ascii_compatible_p): added. [ruby-core:24793]
(Init_Encoding): New API Encoding#ascii_compatible?.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 23:25:32 +00:00
nobu
a809077956
* encoding.c (rb_enc_associate_index): cannot set encoding on
...
special constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 07:36:29 +00:00
nobu
a2393c3e53
* encoding.c (valid_encoding_name_p): rejects too long encoding
...
names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 07:26:49 +00:00
nobu
30995c6594
* encoding.c (encoding_data_type): typed data.
...
* encoding.c (enc_capable, rb_enc_get_index): Symbol is encoding
capable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 07:25:13 +00:00
nobu
87c1a07d6a
* encoding.c (rb_enc_get_index): fixed indent.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 07:08:42 +00:00
naruse
b3d7273dc1
Add functions and macros for second encoding definitions.
...
* encoding.c (rb_enc_set_base): Add for setting base encoding
with their names. this is internal function.
* template/encdb.h.tmpl: specify ENC_SET_BASE for second
encodings in each encoding files.
* enc/encdb.c (rb_enc_set_base): add a declaration.
(ENC_SET_BASE): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-04 00:50:59 +00:00
nobu
e07cb859cc
* suppressed shorten-64-to-32 warnings.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
akr
98aac1e651
* ruby.c (process_options): don't specify .so for encdb here.
...
"." is replaced by "_" in load_encoding.
* encoding.c (load_encoding): add .so here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 16:21:09 +00:00
matz
cb699fc930
* encoding.c (rb_enc_name_list): update RDoc. [ruby-core:23926]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 11:54:37 +00:00
yugui
a1b5cd1ca2
* rb_enc_get_index: allows an arbitrary RData as the argument but not
...
only what points a rb_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 12:16:23 +00:00
matz
0980fe7903
* encoding.c (rb_enc_fast_mbclen): faster mbclen for strings known
...
to be valid.
* string.c (enc_strlen): coderange specified version of
rb_enc_strlen(). use rb_enc_fast_mbclen() if coderange is 7bit
or valid.
* string.c (str_gsub): use rb_enc_fast_mbclen().
* string.c (rb_str_reverse, rb_str_split_m, rb_str_each_char,
scan_once): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 04:44:36 +00:00
matz
91e5ba1cb8
* encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
...
and rb_enc_codelen() in one function to reduce calls.
* encoding.c (rb_enc_codepoint): compatibility function.
* sprintf.c (rb_str_format): use rb_enc_codepoint_len().
* string.c (rb_str_inspect, rb_str_upcase_bang,
rb_str_downcase_bang, rb_str_capitalize_bang,
rb_str_swapcase_bang, trnext, tr_trans, rb_str_delete_bang,
rb_str_squeeze_bang, rb_str_count, rb_str_split_m,
rb_str_each_line, rb_str_each_codepoint, rb_str_lstrip_bang,
sym_printable): ditto.
* transcode.c (make_econv_exception): use rb_enc_mbc_to_codepoint()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 16:59:22 +00:00
naruse
f7bfe5f2df
* encoding.c (rb_filesystem_encoding): Change filesystem_encoding of
...
Mac OS X to UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-30 02:38:47 +00:00
nobu
12d2c8ba41
stripped trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
usa
9bd77cfd77
* encoding.c (rb_filesystem_encoding): Windows' filesystem encoding is
...
sometimes ANSI code page and sometimes OEM code page. we should check
whether code page is used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-01 21:53:14 +00:00
matz
80088a55fc
* encoding.c (enc_set_default_encoding): should not treat US-ASCII
...
special here. a patch from Yui NARUSE in [ruby-dev:37769].
[ruby-dev:37699]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 06:57:55 +00:00
nobu
994293bc81
* encoding.c (rb_locale_charmap): fixed typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 04:21:59 +00:00
nobu
ece0628ebe
* configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw
...
and mswin.
* encoding.c (rb_locale_charmap): use environments on mingw and mswin.
* missing/langinfo.c (nl_langinfo_codeset): MS-Windows Japanese
environment uses Windows-31J derived from Shift_JIS, not EUC-JP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 04:10:16 +00:00
nobu
22e711c4bf
* encoding.c (rb_locale_charmap): fallback to codepage if no
...
locale is found. [ruby-core:21110]
* missing/langinfo.c (nl_langinfo_codeset): returns NULL if no
locale is found.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 14:57:34 +00:00
akr
f0e91e54a3
describe Encoding.find("locale") in rdoc of Encoding.locale_charmap.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-12 17:28:40 +00:00
usa
c123952745
* encoding.c (rb_locale_charmap): use GetConsoleCP() instead of
...
GetACP() because external encoding should be console's one.
* encoding.c (rb_filesystem_encoding): use GetOEMCP() instead of
GetACP() because VFAT/FAT32 uses OEM CP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-05 08:44:10 +00:00
nobu
49ef25b151
* encoding.c (rb_filesystem_encoding): use ANSI codepage for file
...
system on cygwin.
* encoding.c (rb_locale_charmap): reverted. [ruby-core:21110]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-05 07:26:51 +00:00
nobu
ef7057fe2f
* encoding.c (rb_filesystem_encoding, rb_locale_charmap): uses
...
codepage on cygwin. [ruby-core:20994]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 06:41:43 +00:00
yugui
87f6de3e18
* encoding.c (default_external): endless recursion during
...
loading a locale encoding on some locale.
fixed by Nobuyuki Nakada.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 07:08:56 +00:00
yugui
58740ef881
* encoding.c (rb_enc_set_default_external): default_internal can be
...
nil, but default_external cannot.
* encoding.c (rb_set_default_internal): adds rdoc.
* encoding.c (enc_find): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 10:35:39 +00:00
yugui
aa06e69000
* encoding.c (enc_get_default_encoding): removed.
...
Generalizing rb_default_{external,internal}_encoding seems to be
difficult.
default_external cannot be NULL even before detected. [ruby-dev:37390]
* encoding.c (rb_default_external_encoding): has its own
implementation again.
* encoding.c (rb_default_internal_encoding): ditto.
* gem_prelude.rb: added notice.
* ruby.c (rubylib_mangled_path, rubylib_mangled_path2): uses locale
encoding but not ASCII-8BIT.
* ruby.c (process_options): refers less to default_external.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 05:25:39 +00:00
nobu
e5f1572583
* encoding.c (rb_enc_aliases_enc_i): skips default internal.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-11 11:05:21 +00:00
nobu
28d1621d10
* encoding.c (enc_set_default_encoding): allowed to set default
...
encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-11 04:36:20 +00:00
nobu
31c163e4c8
* encoding.c (rb_enc_set_default_internal): defines internal
...
encoding as nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-11 04:17:10 +00:00
nobu
84b5d04bed
* encoding.c (rb_locale_encoding): removed Encoding::LOCALE.
...
* encoding.c (rb_enc_set_default_external): ditto.
* encoding.c (rb_enc_set_default_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-11 02:51:46 +00:00
nobu
b1c07ee240
* encoding.c (rb_enc_set_default_internal): no alias "internal" if
...
defalt internal is not set. [ruby-dev:37000]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 02:35:41 +00:00
nobu
2db25b6ba0
* encoding.c (rb_locale_encoding): makes an alias for locale.
...
[ruby-dev:36976]
* encoding.c (rb_enc_set_default_external): ditto for external.
* encoding.c (rb_enc_set_default_internal): ditto for internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 00:31:47 +00:00
nobu
017ff9bfa2
* encoding.c (enc_names): minor improvement.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 16:55:51 +00:00
naruse
517a1c3406
* encoding.c (Init_Encoding): new instance method Encoding#names,
...
returns its name and alias names.
* encoding.c (enc_names): defined for Encoding#names.
* encoding.c (enc_names_i): defined for enc_names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 02:52:39 +00:00
matz
baeeebf474
* encoding.c (rb_default_internal_encoding): merged a patch from
...
Michael Selig <michael.selig at fs.com.au> in [ruby-core:18985].
* io.c (rb_io_ext_int_to_encs): ditto.
* ruby.c (proc_options): support default internal encoding in -E
option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-07 17:39:44 +00:00
naruse
163ac54f13
* encoding.c (get_default_external): add description.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 17:52:18 +00:00
akr
081c802cb9
* grapheme cluster implementation reverted. [ruby-dev:36375]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 12:53:25 +00:00
akr
a67d4fa01c
* include/ruby/oniguruma.h (OnigEncodingTypeST): add precise_ret
...
argument for mbc_to_code.
(ONIGENC_MBC_TO_CODE): provide NULL for precise_ret.
(ONIGENC_MBC_PRECISE_CODEPOINT): defined.
* include/ruby/encoding.h (rb_enc_mbc_precise_codepoint): defined.
* regenc.h (onigenc_single_byte_mbc_to_code): precise_ret argument
added.
(onigenc_mbn_mbc_to_code): ditto.
* regenc.c (onigenc_single_byte_mbc_to_code): precise_ret argument
added.
(onigenc_mbn_mbc_to_code): ditto.
* string.c (count_utf8_lead_bytes_with_word): removed.
(str_utf8_nth): removed.
(str_utf8_offset): removed.
(str_strlen): UTF-8 codepoint oriented optimization removed.
(rb_str_substr): ditto.
(enc_succ_char): use rb_enc_mbc_precise_codepoint.
(enc_pred_char): ditto.
(rb_str_succ): ditto.
* encoding.c (rb_enc_ascget): check length with
rb_enc_mbc_precise_codepoint.
(rb_enc_codepoint): use rb_enc_mbc_precise_codepoint.
* regexec.c (string_cmp_ic): add text_end argument.
(match_at): check end of character after exact string matches.
* enc/utf_8.c (graphme_table): defined for extended graphme cluster
boundary.
(grapheme_cmp): defined.
(get_grapheme_properties): defined.
(grapheme_boundary_p): defined.
(MAX_BYTES_LENGTH): defined.
(comb_char_enc_len): defined.
(mbc_to_code0): extracted from mbc_to_code.
(mbc_to_code): use mbc_to_code0.
(left_adjust_combchar_head): defined.
(utf_8): use a extended graphme cluster as a unit.
* enc/unicode.c (onigenc_unicode_mbc_case_fold): use
ONIGENC_MBC_PRECISE_CODEPOINT to extract codepoints.
(onigenc_unicode_get_case_fold_codes_by_str): ditto.
* enc/euc_jp.c (mbc_to_code): follow mbc_to_code field change.
use onigenc_mbn_mbc_to_code.
* enc/shift_jis.c (mbc_to_code): ditto.
* enc/emacs_mule.c (mbc_to_code): ditto.
* enc/gbk.c (gbk_mbc_to_code): follow mbc_to_code field and
onigenc_mbn_mbc_to_code change.
* enc/cp949.c (cp949_mbc_to_code): ditto.
* enc/big5.c (big5_mbc_to_code): ditto.
* enc/euc_tw.c (euctw_mbc_to_code): ditto.
* enc/euc_kr.c (euckr_mbc_to_code): ditto.
* enc/gb18030.c (gb18030_mbc_to_code): ditto.
* enc/utf_32be.c (utf32be_mbc_to_code): follow mbc_to_code field
change.
* enc/utf_16be.c (utf16be_mbc_to_code): ditto.
* enc/utf_32le.c (utf32le_mbc_to_code): ditto.
* enc/utf_16le.c (utf16le_mbc_to_code): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 16:48:05 +00:00
naruse
b73891b5f1
* encoding.c (Encoding#base_encoding): removed. [ruby-dev:36270]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 15:53:50 +00:00
ko1
69029b90fe
* gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
...
to rb_gc_register_mark_object().
* eval.c, vm.c: initialize vm->mark_object_ary at
Init_top_self().
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
use rb_gc_register_mark_object() instead of
rb_global_variable() or rb_gc_register_address().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:59:14 +00:00
matz
b121e47b44
* string.c (rb_str_squeeze_bang): specialized for 7bit characters in
...
ASCII compatible strings.
* string.c (rb_str_count): ditto.
* string.c (tr_trans): preserve 7bit/valid coderange flag.
* string.c (rb_str_squeeze_bang): preserve previous coderange value.
* string.c (rb_str_lstrip_bang): ditto.
* string.c (rb_str_rstrip_bang): ditto.
* encoding.c (rb_default_external_encoding): preserve
default_external_encoding in a static variable.
* string.c (single_byte_optimizable): check coderange first, to
reduce number of calling rb_enc_from_index().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:40:00 +00:00
akr
a517395056
* encoding.c (rb_enc_get_index): don't return -1.
...
* io.c (rb_scan_open_args): call FilePathValue before encoding
conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:29:09 +00:00
naruse
5fc383f9a3
* encoding.c (rb_enc_compatible): accepst other than strings and
...
regexps. [ruby-core:18595]
* encoding.c (rb_enc_get_index): works files and encodings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 05:17:18 +00:00
naruse
d51b061565
* include/ruby/oniguruma.h (OnigCodePoint): unsigned long to unsigned int.
...
* include/ruby/encoding.h (rb_enc_codepoint): ditto.
* encoding.c (rb_enc_codepoint): signed int to unsigned int.
* encoding.c (rb_enc_ascget): ditto.
* string.c (rb_str_casecmp): ditto.
* string.c (enc_succ_alnum_char): ditto.
* string.c (rb_str_inspect): ditto.
* string.c (rb_str_upcase_bang): ditto.
* string.c (rb_str_downcase_bang): ditto.
* string.c (rb_str_capitalize_bang): ditto.
* string.c (rb_str_swapcase_bang): ditto.
* string.c (struct tr): ditto.
* string.c (trnext): ditto.
* string.c (tr_trans): ditto.
* string.c (tr_setup_table): ditto.
* string.c (tr_find): ditto.
* string.c (rb_str_delete_bang): ditto.
* string.c (rb_str_squeeze_bang): ditto.
* string.c (rb_str_count): ditto.
* string.c (rb_str_split_m): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_lstrip_bang): ditto.
* string.c (rb_str_rstrip_bang): ditto.
* string.c (rb_str_intern): ditto.
* dir.c (char_casecmp): ditto.
* sprintf.c (rb_str_format): ditto.
* enc/emacs_mule.c (mbc_to_code): to be 32bit clean.
* enc/emacs_mule.c (code_to_mbc): ditto.
* enc/gb18030.c (mbc_to_code): ditto.
* enc/gb18030.c (code_to_mbc): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 10:34:59 +00:00
naruse
727625d9d4
* encoding.c (enc_compatible_p): use TYPE not BUILTIN_TYPE.
...
[ruby-dev:36048]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 23:10:25 +00:00
naruse
5159f500fd
* encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.
...
* test/ruby/test_m17n.rb (test_compatible): fix test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 22:50:16 +00:00
naruse
889acc8185
* encoding.c (enc_compatible_p): raise TypeError when argument is not
...
String nor Regexp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 09:37:00 +00:00
naruse
7fc16c2377
* encoding.c (rb_enc_compatible): ASCII compatible string and US-ASCII
...
regexp is compatible. [ruby-dev:36033]
* string.c (rb_str_index_m): second argument is position of character.
by usa. [ruby-dev:36033]
* string.c (rb_str_rindex_m): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 02:20:23 +00:00
naruse
33dd0c35f1
* encoding.c (enc_compatible_p): raise TypeError when argument is Encoding.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23 21:12:32 +00:00
nobu
5f9c188d97
* include/ruby/ruby.h (rb_intern_const): tiny optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
akr
d46728ec0e
* encoding.c (rb_filesystem_encoding): use default external encoding
...
for Unix.
* dir.c (dir_initialize): don't cache fs_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 12:11:14 +00:00