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

109 Коммитов

Автор SHA1 Сообщение Дата
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
matz d9ff499bf3 * re.c (rb_char_to_option_kcode): use rb_enc_find_index() instead
of using fixed index value.

* enc/Makefile.in (encsrcdir): make US-ASCII built-in.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 13:49:29 +00:00
naruse 0605d15f6a * encoding.c (rb_locale_encoding): return US-ASCII when charmap is nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 09:08:45 +00:00
naruse 21671b558c * enc/make_encdb.h: sort encoding names by original name.
* encoding.c, enc/*.c: define replicas and aliases.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 14:29:12 +00:00
naruse 62c596cb36 * encoding.c: add documents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 11:24:44 +00:00
nobu bb8ddbe847 * encoding.c (Init_Encoding): moved initialization from encdb.h.
* enc/make_encdb.rb (enc_name_list): constified.

* enc/make_encdb.rb (enc_init_db): moved some functions to encoding.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 09:41:50 +00:00
naruse 513d0ca7f6 * encoding.c (ENCINDEX_EUC_JP, ENCINDEX_SJIS): removed.
(rb_enc_init): EUC-JP and Shift_JIS are not builtin now.

* enc/Makefile.in: ditto.

* common.mk: ditto.

* ruby.c (proc_options): ditto.

* enc/shift_jis.c, enc/euc_jp.c: fixes for romove from builtin.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 02:51:15 +00:00
nobu 00fb802284 * encoding.c (enc_table): packed all enc_table stuff.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 01:21:42 +00:00
naruse 80a569906d * encoding.c (rb_enc_init): revert removing SJIS.
* enc/sjis.c: move to enc/shift_jis.c, to make encoding name equal to
  filename for convinience of loading lib.

* enc/shift_jis.c: moved from enc/sjis.c.

* common.mk: follows enc/shift_jis.c.

* enc/Makefile.in: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 01:15:32 +00:00
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