Граф коммитов

152 Коммитов

Автор SHA1 Сообщение Дата
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
naruse 85c41f4fbc * error.c (rb_eEncCompatError): add Exception.
* include/ruby/ruby.h: ditto.

* encoding.c (rb_enc_check): use rb_eEncCompatError.

* string.c (rb_enc_cr_str_buf_cat): ditto.

* string.c (rb_str_sub_bang): ditto.

* string.c (rb_str_hex): ditto.

* string.c (rb_str_oct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 18:17:05 +00:00
mame 4d763fb8ee * encoding.c: include util.h. [ruby-dev:35715]
* common.mk: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-10 13:25:34 +00:00
nobu c97a842391 * encoding.c (rb_to_encoding_index, rb_to_encoding): check if the name
is ascii compatible as well as Encoding.find.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-05 20:31:59 +00:00
akr 4fb4516af8 * encoding.c (rb_filesystem_encoding): use locale encoding on Unix.
[ruby-dev:35617]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21 08:16:34 +00:00
nobu 28b216ac45 * include/ruby/oniguruma.h (OnigEncoding): removed auxiliary_data.
* include/ruby/encoding.h (ENC_DUMMY_P): moved dummy encoding flag to
  rb_encoding from Encoding instance.

* encoding.c (rb_encoding_list): list of Encoding instances.

* encoding.c (struct rb_encoding_entry): moved base encoding from
  instance variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-04 11:44:05 +00:00
naruse 04d83114a6 * encoding.c (rb_utf8_encindex): defined.
* include/ruby/encoding.h (rb_utf8_encindex): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-29 17:33:01 +00:00
naruse 2755479bd9 * encoding.c (rb_filesystem_encoding): defined.
* include/ruby/encoding.h (rb_filesystem_encoding): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-16 21:28:03 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
nobu 7c5e3348f7 * suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 19:55:25 +00:00
naruse 19337db497 * fix for (rb_enc_get_index(obj) == idx) case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 22:50:01 +00:00
naruse fe8bb86125 * encoding.c, include/ruby/encoding.h
(rb_enc_associate, rb_enc_associate_index):
  returns obj. [ruby-dev:34778]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 22:26:14 +00:00
naruse 13f20ccda7 * encoding.c (rb_ascii8bit_encoding): use ENCINDEX_ASCII.
* encoding.c, include/ruby/encoding.h (rb_ascii8bit_encindex):
  added.

* encoding.c (rb_locale_encoding): use rb_usascii_encoding().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 19:21:26 +00:00
matz 44cd8e457b * regparse.c (PINC): use optimized enclen() instead of
ONIGENC_MBC_ENC_LEN().

* regparse.c (PFETCH): ditto.

* regparse.c (PFETCH): small optimization.

* regexec.c (slow_search): single byte encoding optimization.

* regenc.h (enclen): avoid calling function when encoding's
  min_len == max_len.

* re.c (rb_reg_regsub): rb_enc_ascget() optimization for single
  byte encoding.

* re.c (rb_reg_search): avoid allocating new re_registers if we
  already have MatchData.

* re.c (match_init_copy): avoid unnecessary onig_region_free()
  before onig_region_copy. 

* encoding.c (rb_enc_get_index): remove implicit enc_capable check
  each time.

* encoding.c (rb_enc_set_index): ditto.

* encoding.c (enc_compatible_p): small refactoring.

* include/ruby/encoding.h (rb_enc_dummy_p): inline
  rb_enc_dummy_p() and export related code.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 08:25:03 +00:00
nobu 1369cfd16e * encoding.c (enc_init_db): moved to enc/encdb.c.
* transcode.c (init_transcoder_table): moved to enc/trans/transdb.c.

* enc/depend (enc/encdb.o enc/trans/transdb.o): depend on
  corresponding headers.

* common.mk (COMMONOBJS): moved transcode.o from OBJS


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-07 06:51:33 +00:00
nobu 555eb7ded4 * encoding.c (enc_check_encoding): should not load autoloaded encoding
directly, instead use rb_enc_find_index() which deal with alias and
  replica.  [ruby-core:15957]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 05:08:49 +00:00
matz 2694b2f937 * encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().
* string.c (rb_str_cmp): reduce invocation of rb_enc_compatible().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-15 09:19:38 +00:00
nobu cd89edc065 * encoding.c (rb_enc_dummy_p): bootstrap encodings can not be dummy.
* encoding.c (rb_enc_ascget): no needs to call rb_enc_precise_mbclen()
  twice.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29 15:29:09 +00:00
naruse 5eafc201d8 * encoding.c (enc_capable): IMMEDIATE_P doesn't include Qnil and Qfalse.
use SPECIAL_CONST_P.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 13:22:29 +00:00
naruse 6f99342c92 * encoding.c (enc_find): check type of argument and convert to String
if it is StringValue. [ruby-cvs:22866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 11:58:11 +00:00
duerst ad3577b59b Mon Feb 25 10:41:41 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
* encoding.c (Encoding#dummy): minor grammatical fixes
	  in rdoc documentation.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 01:42:47 +00:00
akr 81fc1cf201 * encoding.c (rb_enc_mbclen): return minlen instead of 1 when
a character is not found properly.

* string.c (rb_enc_strlen): round up string length with fixed
  multibyte encoding such as UTF-32.
  (rb_enc_strlen_cr): ditto.
  (rb_str_substr): fix substring with fixed multibyte encoding.
  (rb_str_justify): check number of characters.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 06:52:54 +00:00
naruse b62df564a6 * string.c (rb_str_times): empty string's coderange is CODERANGE_7BIT.
* string.c (rb_str_substr): ditto.

* encoding.c (rb_enc_compatible): empty string is compatible with not
  only nonasciicompatible strings. [ruby-dev:33895]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-21 19:54:48 +00:00
naruse 1e0958098f * encoding.c (rb_enc_associate_index): doesn't clear coderange
when new encoding equals to old one.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-20 10:44:28 +00:00
akr 8bcfa698a0 * encoding.c (rb_enc_compatible): check encoding incapable arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 11:43:12 +00:00
akr 7eeba5f440 * encoding.c (rb_enc_compatible): empty strings are always compatible.
* string.c (rb_enc_cr_str_buf_cat): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 09:02:12 +00:00
akr af75cc01bc * encoding.c (rb_enc_strlen): moved to string.c.
* string.c (rb_enc_strlen): use search_nonascii.
  (str_strlen): don't use search_nonascii.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 02:55:08 +00:00
akr 0831222a91 * encoding.c (rb_enc_nth): moved to string.c.
* string.c (rb_enc_nth): moved from string.c.  use search_nonascii
  for ASCII compatible string.
  (str_nth): wrong optimization removed to fix
  "a".force_encoding("EUC-JP").slice!(0,10) returns
  "a\x00\x00\x00\x00\x00\x00\x00\x00\x00"


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 18:48:27 +00:00
matz 8b09f7015a * string.c (str_strlen): use search_nonascii() for performance.
* string.c (str_nth): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 08:14:40 +00:00
nobu f3ed7fa233 * encoding.c (encdb_{replicate,alias,dummy,declare}): define only if
NO_ENCDB_H is not defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 09:05:50 +00:00
naruse 315196bc7a * dmyencoding.c, encoding.c (enc_init_db, NO_ENCDB_H):
miniruby doesn't use encdb.

* common.mk: encdb.h use miniruby.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 08:48:35 +00:00
akr fc208c1bd5 * include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
inline functions.
  (onigenc_mbclen_charfound): removed.
  (onigenc_mbclen_needmore): removed.
  (onigenc_mbclen_recover): removed.
  (ONIGENC_MBCLEN_CHARFOUND): removed.
  (ONIGENC_MBCLEN_CHARFOUND_P): defined.
  (ONIGENC_MBCLEN_CHARFOUND_LEN): defined.
  (ONIGENC_MBCLEN_INVALID): removed.
  (ONIGENC_MBCLEN_INVALID_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE): removed.
  (ONIGENC_MBCLEN_NEEDMORE_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE_LEN): defined.
  (ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate.

* regenc.c (onigenc_mbclen_approximate): defined.

* include/ruby/encoding.h (MBCLEN_CHARFOUND): removed.
  (MBCLEN_INVALID): removed.
  (MBCLEN_NEEDMORE): removed.
  (MBCLEN_CHARFOUND_P): defined.
  (MBCLEN_INVALID_P): defined.
  (MBCLEN_NEEDMORE_P): defined.
  (MBCLEN_CHARFOUND_LEN): defined.
  (MBCLEN_NEEDMORE_LEN): defined.

* encoding.c: use new API.

* re.c: ditto.

* string.c: ditto.

* parse.y: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 14:27:07 +00:00
naruse 42dcda08ae * string.c (rb_str_usascii_new{,2}: defined.
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
  string.

* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
  (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
  use rb_str_ascii_new.

* array.c (recursive_join, inspect_ary): ditto.

* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
  rb_mod_to_s): ditto.

* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
  env_clear, env_to_s, env_inspect): ditto.

* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.

* bignum.c (rb_big2str): ditto.

* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
  file_inspect_join, Init_file): ditto.

* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:40:02 +00:00
naruse 1ccb0642ed * encoding.{c, h} (rb_usascii_encoding): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 16:03:29 +00:00
matz 707f2fd26e * encoding.c (rb_enc_compatible): wrong compatibility condition.
[ruby-dev:33273]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 06:56:44 +00:00
matz 65a8185eb2 * configure.in (MINIRUBY): remove -I$(EXTOUT)/$(arch) from
MINIRUBY since miniruby might not be able to load DLL.

* test/ruby/test_m17n.rb: move tests from bootstrap test.

* encoding.c (enc_find): should check name if ASCII compatible.

* string.c (rb_str_end_with): should check character boundary.

* encoding.c (rb_enc_compatible): encoding must be ASCII
  compatible before checking ENC_CODERANGE_7BIT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 03:59:53 +00:00
akr bbeefa53ca * encoding.c (enc_new): don't free rb_encoding to avoid SEGV by
`miniruby -e exit' on x86_64 GNU/Linux.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-19 11:43:24 +00:00
nobu b66eb53650 * encoding.c (rb_enc_name_list_i, rb_enc_aliases_enc_i): freeze
element strings to be returned.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 06:56:06 +00:00
nobu 845ae33b17 * encoding.c (load_encoding): check if successfully loaded.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 03:25:15 +00:00
nobu 9f9ac39996 * encoding.c (rb_enc_find_index): use original encoding name to
replicate loaded encoding instead alias.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 02:39:12 +00:00
matz f28118eb69 * encoding.c (rb_enc_find_index): use original encoding name to
load DLL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 01:37:27 +00:00
matz d8644f632b * encoding.c (rb_enc_aliases_enc_i): exclude non alias names from
Encoding.aliases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 01:30:41 +00:00
matz 231ab57f6f * parse.y (parser_initialize): explicitly call rb_ascii8bit_encoding().
* parse.y (parser_prepare): lex_input may not be have encoding (e.g. IO).

* parse.y (rb_parser_compile_string): set encoding from input string. 

* encoding.c (rb_enc_find_index): use ASCII-8BIT if loading known
  encoding failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 00:23:18 +00:00
nobu a3776588ef * encoding.c (enc_free): removed since rb_encoding may be used while
cleanup.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 15:23:33 +00:00
nobu 0052259d5e * common.mk (encdb.h): give output file name to make_encdb.rb.
* encoding.c (enc_table): simplified.

* encoding.c (enc_register_at): lazy loading.  [ruby-dev:33013]

* regenc.h (ENC_DUMMY): added.

* enc/make_encdb.rb: now emits macros only.

* enc/iso_2022_jp.h: split from encoding.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 14:56:22 +00:00
nobu d969620ea8 * encoding.c (enc_register_at): make own copy. [ruby-dev:33136]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 13:45:29 +00:00
naruse edc61cf4c1 * encoding.c (ENC_REGISTER): use &OnigEncoding*.
(ENCINDEX_UTF_8): renamed from ENCINDEX_UTF8.
  (rb_enc_init): use ENC_REGISTER.

* include/ruby/oniguruma.h (OnigEncodingUTF8, ONIG_ENCODING_UTF8):
  removed.

* enc/*.c: remove use of &encoding_*; use enc argument instead.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-15 13:36:18 +00:00
nobu 3c3b2fe143 * encoding.c (rb_locale_charmap): use ASCII-8BIT in miniruby.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-15 05:44:55 +00:00
nobu 2e8965863d * common.mk (OBJS): moved encoding.o from COMMONOBJS.
* common.mk (dmyencoding.o): added.  [ruby-dev:33099]

* configure.in, {win,bcc}32/Makefile.sub (MINIOBJS): added
  dmyencoding.o.

* dmyencoding.c (rb_locale_charmap): returns nil for miniruby.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 16:19:02 +00:00