aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
Commit message (Collapse)AuthorAgeFilesLines
* * encoding.c (rb_enc_codepoint): implemented to raise invalidakr2007-12-231-0/+9
| | | | | | | | | | 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
* add a comment for eucJP.akr2007-12-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_init): add eucJP as an alias of EUC-JP.akr2007-12-231-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,akr2007-12-221-2/+2
| | | | | | | | | 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
* document updated.akr2007-12-221-4/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add rdoc.akr2007-12-221-0/+101
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.akr2007-12-221-1/+0
| | | | | | | | | | | * 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
* * encoding.c (rb_locale_charmap): win32 support.usa2007-12-221-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_ascii_encoding): renamed from previousmatz2007-12-211-2/+2
| | | | | | rb_default_encoding(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_replicate): now creates first class encoding.nobu2007-12-211-13/+57
| | | | | | | | | | | | | | | | * 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
* * encoding.c (Init_Encoding): use enc_name as to_s.akr2007-12-211-4/+4
| | | | | | | (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
* * io.c (rb_io_s_read): allow specifying encoding explicitly.matz2007-12-211-1/+4
| | | | | | | | | | | | * 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
* * encoding.c (rb_enc_init): use enc_register_at() directly.nobu2007-12-211-5/+23
| | | | | | | | | | | * 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
* * encoding.c (rb_to_encoding_index): should return error instead ofnobu2007-12-211-0/+3
| | | | | | | exception even if type is incorrect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_find_index): extension libraries have lower casenobu2007-12-211-0/+1
| | | | | | | names conventionally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_register): set encoding constant.nobu2007-12-211-3/+14
| | | | | | | | | | | * 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
* * io.c (rb_io_external_encoding): new method.matz2007-12-211-1/+1
| | | | | | | * 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
* * encoding.c (rb_locale_charmap): return nil if no locale information.akr2007-12-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: check langinfo.h and locale.h.akr2007-12-211-0/+6
| | | | | | | | | * 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
* * encoding.c: include locale.hakr2007-12-211-0/+10
| | | | | | | | | | | | | | (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
* * common.mk (enc.mk): depends on $(RBCONFIG) instead of rbconfig.rb.nobu2007-12-211-3/+0
| | | | | | | | | | | | | | | | * 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
* * string.c (rb_str_index): check if substring is broken.matz2007-12-171-1/+2
| | | | | | | | * 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
* * configure.in (enc/Makefile): add external encoding objects list.nobu2007-12-151-2/+22
| | | | | | | | | | | | | | * common.mk (BUILTIN_ENCOBJS): renamed from ENCOBJS. * Makefile.in (BUILTIN_ENCOBJS): substitued by autoconf. * enc/Makefile.in: new file to compile external encoding sources. * encoding.c (rb_enc_find_index): auto-load external encoding objects as "ext/ENCODING_NAME". [ruby-dev:32606] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_register, rb_enc_replicate, rb_enc_alias): checknobu2007-12-151-10/+48
| | | | | | | if already registered. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): 1st argument (typically thematz2007-12-131-1/+1
| | | | | | receiver) would have higher priority in encoding detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): encoding should never fall backmatz2007-12-131-1/+4
| | | | | | to ASCII-8BIT unless both encodings are ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (enc_get_encoding): removed.nobu2007-12-131-10/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): should swap encoding indexes too.nobu2007-12-131-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): should not judge compatibilitymatz2007-12-131-6/+0
| | | | | | based on rb_enc_asciicompat(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_ascget): renamed from rb_enc_get_ascii.akr2007-12-111-1/+1
| | | | | | | | | | * include/ruby/encoding.h: follow the renaming. * re.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_get_ascii): add an argument to provide the akr2007-12-111-5/+9
| | | | | | | | | | | | | length of the returned character. * include/ruby/encoding.h (rb_enc_get_ascii): add the argument. * re.c (rb_reg_expr_str): modify rb_enc_get_ascii call. (rb_reg_quote): ditto. (rb_reg_regsub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_precise_mbclen): return needmore if underlyingakr2007-12-081-1/+5
| | | | | | | implementation returns a length longer than e-p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_mbclen): return 1 if underlying implementationakr2007-12-081-1/+2
| | | | | | | returns a length longer than e-p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_mbclen): make it never fail.akr2007-12-081-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_enc_nth): don't check the return value of rb_enc_mbclen. (rb_enc_strlen): ditto. (rb_enc_precise_mbclen): return needmore(1) if e <= p. (rb_enc_get_ascii): new function for extracting ASCII character. * include/ruby/encoding.h (rb_enc_get_ascii): declared. * include/ruby/regex.h (ismbchar): removed. * re.c (rb_reg_expr_str): use rb_enc_get_ascii. (unescape_escaped_nonascii): use rb_enc_precise_mbclen to determine the termination of escaped non-ASCII character. (unescape_nonascii): use rb_enc_precise_mbclen. (rb_reg_quote): use rb_enc_get_ascii. (rb_reg_regsub): use rb_enc_get_ascii. * string.c (rb_str_reverse) don't check the return value of rb_enc_mbclen. (rb_str_split_m): don't call rb_enc_mbclen with e <= p. * parse.y (is_identchar): use ISASCII. (parser_ismbchar): removed. (parser_precise_mbclen): new macro. (parser_isascii): new macro. (parser_tokadd_mbchar): use parser_precise_mbclen to check invalid character precisely. (parser_tokadd_string): use parser_isascii. (parser_yylex): ditto. (is_special_global_name): don't call is_identchar with e <= p. (rb_enc_symname_p): ditto. [ruby-dev:32455] * ext/tk/sample/tkextlib/vu/canvSticker2.rb: remove coding cookie because the encoding is not UTF-8. [ruby-dev:32475] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_precise_mbclen): new function for mbclen withakr2007-12-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | validation. * include/ruby/encoding.h (rb_enc_precise_mbclen): declared. (MBCLEN_CHARFOUND): new macro. (MBCLEN_INVALID): new macro. (MBCLEN_NEEDMORE): new macro. * include/ruby/oniguruma.h (OnigEncodingTypeST): replace mbc_enc_len by precise_mbc_enc_len. (ONIGENC_PRECISE_MBC_ENC_LEN): new macro. (ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND): new macro. (ONIGENC_CONSTRUCT_MBCLEN_INVALID): new macro. (ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE): new macro. (ONIGENC_MBCLEN_CHARFOUND): new macro. (ONIGENC_MBCLEN_INVALID): new macro. (ONIGENC_MBCLEN_NEEDMORE): new macro. (ONIGENC_MBC_ENC_LEN): use ONIGENC_PRECISE_MBC_ENC_LEN. * enc/euc_jp.c: validation implemented. * enc/sjis.c: ditto. * enc/utf8.c: ditto. * string.c (rb_str_inspect): use rb_enc_precise_mbclen for invalid encoding. (rb_str_valid_encoding_p): new method String#valid_encoding?. * io.c (rb_io_getc): use rb_enc_precise_mbclen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: rename primary_encoding -> default_external (encoding).matz2007-12-011-12/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h, encoding.c, re.c, string.c, parse.y: akr2007-11-271-4/+4
| | | | | | | | | | rename ENC_CODERANGE_SINGLE to ENC_CODERANGE_7BIT. rename ENC_CODERANGE_MULTI to ENC_CODERANGE_8BIT. Because single byte 8bit character, such as Shift_JIS 1byte katakana, is represented by ENC_CODERANGE_MULTI even if it is not multi byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (enc_check_encoding, rb_set_primary_encoding): ENCODINGnobu2007-11-091-4/+2
| | | | | | | is no longer in FL_USERS flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_basicinstructions.rb: updated for new classmatz2007-11-091-7/+5
| | | | | | | | | | | | | | | | | behavior. [ruby-dev:32192] * encoding.c (enc_name): Encoding should not rely on ENCODING in the FL_USERS flags. * encoding.c (rb_enc_from_encoding): do not call rb_enc_associate for encoding itself. * encoding.c (enc_register_at): ditto. * marshal.c (r_ivar): do not set real instance variable for encoding data associated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_setup_table): use C array for characters that fitmatz2007-11-031-1/+1
| | | | | | | | | | | | | | in a byte to gain performance. * string.c (rb_str_delete_bang): ditto. * string.c (rb_str_squeeze_bang): ditto. * string.c (rb_str_count): ditto. * string.c (tr_trans): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_replicate): new function to replicate encoding.nobu2007-10-291-15/+62
| | | | | | | | * encoding.c (enc_based_encoding): Encoding#base_encoding returns based encoding of replica. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): ASCII encoding is compatible withnobu2007-10-291-0/+5
| | | | | | | ASCII-compatible encoding, even for non-string objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_to_encoding_index, rb_to_encoding): commit miss.nobu2007-10-221-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (enc_check_encoding): returns index now.nobu2007-10-221-12/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): check if two objects have compatiblenobu2007-10-221-1/+21
| | | | | | | | | | | encodings. * encoding.c (enc_compatible_p): added Encoding.compatible?. * include/ruby/encoding.h (rb_enc_compatible): prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_default, rb_enc_primary): return pointers tonobu2007-10-211-12/+19
| | | | | | | | | rb_encoding of default and primary respectively. [ruby-core:12795] * encoding.c (set_primary_encoding): removed primary_encoding setter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_id_encoding): returns ID "encoding".nobu2007-10-191-8/+11
| | | | | | | | | * marshal.c (w_encoding): dump encoding name. * marshal.c (r_ivar): load encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_from_encoding, rb_enc_register): associate indexnobu2007-10-171-3/+11
| | | | | | | | | | | | to self. * encoding.c (enc_capable): Encoding objects are encoding capable. * re.c (rb_reg_s_union): check if encoding matching by exact encoding objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_alias, rb_enc_find_index): changednobu2007-10-161-11/+68
| | | | | | | | | | | | | | | | enc_table_alias to a name-to-index hash. * encoding.c (rb_enc_init): use upper case names for aliases to use as constant names. * encoding.c (enc_find): allow symbols. * encoding.c (Init_Encoding): define encoding constants. * st.c (strcasehash): fix wrong code range condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (enc_list): seems a commit miss.nobu2007-10-161-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e