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

94 Коммитов

Автор SHA1 Сообщение Дата
naruse 4261dd6ab7 * encoding.c (rb_enc_aliases): don't see enc_table_alias when it wasn't initialized yet.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-12 16:34:08 +00:00
naruse 5b9739a832 * enc/make_encdb.rb: added. search enc/*.c and make encoding database.
* regenc.h (ENC_REPLICATE, ENC_ALIAS): added for defining replica
  encoding and encoding alias.

* encoding.c (rb_enc_init): move alias definitions to enc/*.c.
  (rb_enc_find_index): search original of replica and alias when no
  encoding library.
  (rb_enc_name_list, rb_enc_aliases_enc_i, rb_enc_aliases_str_i,
   rb_enc_aliases, Encoding.name_list, Encoding.aliases): added.
  (Init_Encoding): init encdb.

* enc/ascii.c, enc/us_ascii.c, enc/euc_jp.c, enc/sjis.c:
  add replica encoding and encoding alias difinition.

* common.mk (dist-clean-local): add rule for remvoe encdb.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-12 16:03:51 +00:00
naruse 9e35ba455d * encoding (set_base_encoding): must use rb_enc_dummy_p.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 00:39:44 +00:00
nobu 78900b98b3 * encoding.c (rb_to_encoding_index, rb_to_encoding): disallow nil.
[ruby-dev:33003]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-10 21:13:21 +00:00
naruse ad4fb57a3a * encoding.c (rb_enc_replicate): replica of dummy is a dummy.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 13:06:00 +00:00
naruse 5cd70fa5e9 * encoding.c (rb_enc_init): UTF-{16,32}{BE,LE} are not builtin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 14:56:50 +00:00
naruse ed540e8bdf * encoding.c, Makefile.in, include/ruby/oniguruma.h,
enc/Makefile.in: fix rules for UTF-{16,32}{BE,LE}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 13:35:24 +00:00
akr 4e4d4331ca * include/ruby/oniguruma.h (OnigEncodingType): new member
ruby_encoding_index to avoid linear search in rb_enc_to_index.

* include/ruby/encoding.h (rb_enc_to_index): macro defined to use
  ruby_encoding_index.

* encoding.c (rb_enc_to_index): removed.
  (enc_register_at): initialize ruby_encoding_index member.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 07:48:24 +00:00
akr 063beac343 * encoding.c (rb_enc_internal_get_index): extracted from
rb_enc_get_index.
  (rb_enc_internal_set_index): extracted from rb_enc_associate_index

* include/ruby/encoding.h (ENCODING_SET): work over ENCODING_INLINE_MAX.
  (ENCODING_GET): ditto.
  (ENCODING_IS_ASCII8BIT): defined.
  (ENCODING_CODERANGE_SET): defined.

* re.c (rb_reg_fixed_encoding_p): use ENCODING_IS_ASCII8BIT.

* string.c (rb_enc_str_buf_cat): use ENCODING_IS_ASCII8BIT.

* parse.y (reg_fragment_setenc_gen): use ENCODING_IS_ASCII8BIT.

* marshal.c (has_ivars): use ENCODING_IS_ASCII8BIT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 02:49:01 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 8702c4d0d7 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 03:35:13 +00:00
akr 9c2204972b * encoding.c (Init_Encoding): alias csWindows31J to Windows-31J.
IE6 accepts csWindows31J but Windows-31J.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 02:51:24 +00:00
akr 059fe7997e * encoding.c: (rb_tolower, rb_toupper): body was exchanged.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 09:40:00 +00:00
akr 5f237d7903 * encoding.c (rb_isalnum): defined.
(rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.

* include/ruby/ruby.h: don't include include/ruby/encoding.h.
  (rb_isascii): defined.
  (rb_isalnum): declared.
  (rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.
  (ISASCII): simplified.
  (ISPRINT): ditto.
  (ISSPACE): ditto.
  (ISUPPER): ditto.
  (ISLOWER): ditto.
  (ISALNUM): ditto.
  (ISALPHA): ditto.
  (ISDIGIT): ditto.
  (ISXDIGIT): ditto.
  (TOUPPER): ditto.
  (TOLOWER): ditto.

* include/ruby/encoding.h (rb_isascii): removed.
  (rb_isalnum): ditto.
  (rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.

* common.mk: dependency updated.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 08:44:01 +00:00
akr 041e829127 * include/ruby/encoding.h (rb_isascii): defined.
(rb_isalnum): ditto.
  (rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.

* include/ruby/st.h (st_strcasecmp): declared.
  (st_strncasecmp): ditto.

* st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp.
  (st_strcasecmp): defined.
  (st_strncasecmp): ditto.

* include/ruby/ruby.h: include include/ruby/encoding.h.
  (ISASCII): use rb_isascii.
  (ISPRINT): use rb_isprint.
  (ISSPACE): use rb_isspace.
  (ISUPPER): use rb_isupper.
  (ISLOWER): use rb_islower.
  (ISALNUM): use rb_isalnum.
  (ISALPHA): use rb_isalpha.
  (ISDIGIT): use rb_isdigit.
  (ISXDIGIT): use rb_isxdigit.
  (TOUPPER): defined.
  (TOLOWER): ditto.
  (STRCASECMP): ditto.
  (STRNCASECMP): ditto.

* dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c,
  transcode.c, ext/readline/readline.c: use locale insensitive
  functions.  [ruby-core:14662]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 12:24:04 +00:00
nobu 1701a536d1 * encoding.c (rb_to_encoding): raises for non-nil, non-encoding,
non-string object.  [ruby-core:14634]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 16:29:06 +00:00
akr e21907e0f8 fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 05:52:59 +00:00
nobu 1ed2aad958 * encoding.c (Init_Encoding): registered rb_encoding differs from
ONIG_ENCODINGs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-30 08:43:56 +00:00
usa 7c1cab2a4f * encoding.c (Init_encoding): register Windows-31J and its alias.
[ruby-dev:32843]

	* ruby.c (proc_options): -Ks options means Windows-31J, not Shift_JIS.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-29 21:34:15 +00:00
usa eb1014e4ae * encoding.c (rb_locale_encoding): should check return value from
rb_locale_charmap().

	* ruby.c (locale_encoding): removed.

	* ruby.c (process_options): use rb_locale_encoding() instead of
	  locale_encoding().

	* ext/readline/readline.c (readline_readline): use locale encoding
	  instead of input IO's encoding. [ruby-dev:32872]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 10:41:52 +00:00
akr 371977ff3d * encoding.c (rb_locale_encoding): defined.
* include/ruby/encoding.h (rb_locale_encoding): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 10:12:13 +00:00
nobu c3c58513d7 * encoding.c (set_base_encoding, enc_base_encoding): renamed
based_encoding as base_encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 06:10:49 +00:00
akr ce2b982cd2 * encoding.c (rb_enc_codelen): show codepoint in error message.
* include/ruby/encoding.h (rb_enc_codelen): comment it returns
  positive integer.

* string.c (rb_str_concat): rb_enc_codelen doesn't return 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 06:27:39 +00:00
akr cd2fd33edf * encoding.c (rb_enc_codelen): error message refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 06:19:09 +00:00
akr 8bb84c92d4 * encoding.c (rb_enc_check): show encodings in error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 06:12:19 +00:00
nobu 0ee5a49dd4 * encoding.h (rb_enc_mbc_to_codepoint): wrapper for
ONIGENC_MBC_TO_CODE().

* string.c (rb_str_succ): deal with invalid sequence as binary.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 10:01:06 +00:00
akr ead329fd8e * string.c (rb_str_inspect): don't call rb_enc_codepoint with empty
string.  fix '#'.inspect.

* encoding.c (rb_enc_codepoint): raise on empty string.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 09:07:32 +00:00
nobu 75e4572768 * encoding.c (rb_enc_register): do not use based_encoding to check if
dummy encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:59:53 +00:00
akr cf36df97fb * encoding.c (rb_enc_codepoint): implemented to raise invalid
encoding.

* include/ruby/encoding.h (rb_enc_codepoint): macro is replaced as a
  declaration.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 14:06:00 +00:00
akr 057d7369f9 add a comment for eucJP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 08:55:30 +00:00
akr 090b9a4f7d * encoding.c (rb_enc_init): add eucJP as an alias of EUC-JP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 08:40:37 +00:00
akr 5b809a28f8 * include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,
ruby.c, transcode.c: rename rb_ascii_encoding. to
  rb_ascii8bit_encoding.  rb_ascii_encoding is ambiguous with 
  ASCII-8BIT and US-ASCII.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 23:47:18 +00:00
akr 5b1d121bfa document updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 15:24:23 +00:00
akr 0fc7dfedd3 add rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 08:11:47 +00:00
akr bcb064eb0f * regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.
* regenc.h (onigenc_ascii_is_code_ctype): declared.

* enc/ascii.c: use onigenc_ascii_is_code_ctype.

* enc/us_ascii.c: new file for US-ASCII.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 05:38:33 +00:00
usa b507930297 * encoding.c (rb_locale_charmap): win32 support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 02:37:40 +00:00
matz d7cc14d436 * encoding.c (rb_ascii_encoding): renamed from previous
rb_default_encoding().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 18:55:30 +00:00
nobu 5f2e5c07a7 * encoding.c (rb_enc_replicate): now creates first class encoding.
* encoding.c (rb_define_dummy_encoding): always based on the default
  encoding.

* encoding.c (rb_enc_dummy_p): check if dummy.

* encoding.c (enc_inspect): shows if dummy.

* encoding.c (Init_Encoding): added dummy? method

* include/ruby/encoding.h (ENCODING_INLINE_MAX): increased.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 11:00:04 +00:00
akr 5bb7c8612f * encoding.c (Init_Encoding): use enc_name as to_s.
(enc_inspect): renamed from enc_to_s.  add "#" at beginning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 07:52:49 +00:00
matz e48ea0a5f3 * io.c (rb_io_s_read): allow specifying encoding explicitly.
* io.c (rb_io_binmode): specifies encoding to ASCII-8BIT (binary).

* io.c (rb_io_s_read): IO should be in binary mode when offset is
  specified.

* encoding.c (rb_to_encoding): returns default encoding if no
  corresponding encoding found.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 07:02:55 +00:00
nobu 12df6cf7ce * encoding.c (rb_enc_init): use enc_register_at() directly.
* encoding.c (rb_utf8_encoding): returns utf-8 encoding.

* include/ruby/encoding.h (rb_utf8_encoding): prototyped.

* parse.y (UTF8_ENC): uses rb_utf8_encoding().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 06:59:48 +00:00
nobu 4baea7dd8e * encoding.c (rb_to_encoding_index): should return error instead of
exception even if type is incorrect.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 06:16:02 +00:00
nobu e15390d08d * encoding.c (rb_enc_find_index): extension libraries have lower case
names conventionally.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:47:00 +00:00
nobu ef0706a5bf * encoding.c (rb_enc_register): set encoding constant.
* encoding.c (rb_enc_find_index): replace non-alphanumeric chars with
  underscores, so that initialize function can be called.

* ruby.c (proc_options, process_options): finds encoding after
  load_path is initialized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:40:13 +00:00
matz 1b27cfcd6c * io.c (rb_io_external_encoding): new method.
* encoding.c (rb_enc_from_encoding): returns Qnil for NULL
  encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:26:38 +00:00
akr 8c68d9a152 * encoding.c (rb_locale_charmap): return nil if no locale information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:09:45 +00:00
akr f2515d9938 * configure.in: check langinfo.h and locale.h.
* encoding.c: use langinfo.h only if available.

* main.c: use locale.h only if available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 03:03:29 +00:00
akr 0530cf9ff8 * encoding.c: include locale.h
(rb_locale_charmap): new method Encoding.locale_charmap for
  nl_langinfo(CODESET).

* include/ruby/encoding.h (rb_locale_charmap): declared.

* main.c (main): call setlocale with LC_CTYPE.

* ruby.c (locale_encoding): use rb_locale_charmap.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:52:23 +00:00
nobu 817a4e3c83 * common.mk (enc.mk): depends on $(RBCONFIG) instead of rbconfig.rb.
* encoding.c (Init_Encoding): ISO-8859-1 is no longer a replica.

* regenc.h (OnigEncodingDefine): names of extension and encoding can
  differ.

* enc/Makefile.in: always shared.

* enc/depend (deffile): should not upcase.

* enc/{ascii,euc_jp,sjis,utf8,iso_8859_{1..16}}.c: fix for Init.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:23:26 +00:00
matz ea1b9d58b9 * string.c (rb_str_index): check if substring is broken.
* string.c (rb_str_rindex): ditto.

* string.c (rb_str_succ): should carry over.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 09:08:27 +00:00