aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
Commit message (Collapse)AuthorAgeFilesLines
* * 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
* * encoding.c (rb_primary_encoding): added Encoding.primary_encoding.nobu2007-10-161-5/+37
| | | | | | | | | | | | | | | | | * parse.y (rb_parser_encoding): added. * ruby.c (proc_options): added -E and --encoding options. * ruby.c (process_options): set primary encoding from command line option if set, or source encoding. * include/ruby/encoding.h (rb_enc_from_encoding, rb_get_primary_encoding, rb_set_primary_encoding): prototypes. * include/ruby/node.h (rb_parser_encoding): prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (enc_to_s): rename function.matz2007-10-161-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (Init_Encoding): define #to_s to show encoding namematz2007-10-151-0/+1
| | | | | | in to_s representation as well as #inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_obj_encoding): rdoc update. a patch from Davidnobu2007-10-141-4/+23
| | | | | | | | | | | | | | | | Flanagan <david AT davidflanagan.com>. [ruby-core:12664] * encoding.c (enc_dump, enc_load): marshaling feature. a patch from David Flanagan. [ruby-core:12665] * encoding.c (Init_Encoding): undefine allocator of Encoding. [ruby-core:12665], [ruby-core:12666] * test/ruby/test_encoding.rb: tests for Encoding from David Flanagan [ruby-core:12665] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_cEncoding): new Encoding class.nobu2007-10-131-6/+153
| | | | | | | | | | | | | | | | | * encoding.c (rb_to_encoding, rb_to_encoding_index): helper functions. * encoding.c (rb_obj_encoding): return Encoding object now. * gc.c (garbage_collect): mark Encoding objects. * string.c (rb_str_force_encoding): accept Encoding object as well as encoding name. * include/ruby/encoding.h (rb_to_encoding_index, rb_to_encoding): prototypes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_init): don't alias iso-8859-1 to ascii.akr2007-10-101-4/+4
| | | | | | | | * ascii.c (OnigEncodingASCII): change the name US-ASCII to ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_register): returns new index or -1 if failed.nobu2007-10-061-9/+25
| | | | | | | | | | | | * encoding.c (rb_enc_alias): check if original name is registered. * encoding.c (rb_enc_init): register in same order as kcode options in re.c. added new aliases. * string.c (rb_str_force_encoding): check if valid encoding name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_obj_encoding): returns encoding of the given object.nobu2007-10-041-0/+14
| | | | | | | | | * re.c (Init_Regexp): new method Regexp#encoding. * string.c (str_encoding): moved to encoding.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_alias): allow encodings multiple aliases.nobu2007-09-281-10/+41
| | | | | | | | | | | | | | | | | | | | * encoding.c (rb_enc_find_index): search the encoding which has the given name and return its index if found, or -1. * st.c (type_strcasehash): case-insensitive string hash type. * string.c (rb_str_force_encoding): force encoding of self. this name comes from [ruby-dev:31894] by Martin Duerst. [ruby-dev:31744] * include/ruby/encoding.h (rb_enc_find_index, rb_enc_associate_index): prototyped. * include/ruby/encoding.h (rb_enc_isctype): direct interface to ctype. * include/ruby/st.h (st_init_strcasetable): prototyped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_comparable): need not to check asciicompat here.matz2007-09-281-17/+19
| | | | | | | | | | * encoding.c (rb_enc_check): ditto. * string.c (rb_enc_str_coderange): tuned a bit; no broken check. * encoding.c (rb_enc_check): new encoding comparison criteria. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_associate_index): deal with ASCII compatiblenobu2007-09-261-0/+12
| | | | | | | | | | | | | | | | | | | | flags. * encoding.c (rb_enc_check): allow ASCII compatible strings. * parse.y (rb_intern_str): use ASCII encoding for ASCII string. * string.c (rb_enc_str_coderange): check for code-range. * string.c (rb_str_modify): clear code-range flags. * string.c (rb_str_hash, rb_str_eql): ASCII compatible strings are comparable. * include/ruby/encoding.h: added code-range flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_check): check for ASCII-compatibilities.nobu2007-09-261-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y (parser_tokadd_string, parser_parse_string, parser_here_document, parser_yylex): set encoding to US-ASCII. * parse.y (rb_enc_symname_p): check if valid with encoding. * parse.y (rb_intern3): let symbols have encoding. * string.c (rb_str_hash): add encoding index. * string.c (rb_str_comparable, rb_str_equal, rb_str_eql): check if compatible encoding. * string.c (sym_inspect): made encoding aware. * insns.def (opt_eq): compare with encoding. * include/ruby/encoding.h (rb_enc_asciicompat): check if ASCII compatible. * include/ruby/encoding.h (rb_enc_get_index): added prototype. * include/ruby/intern.h (rb_str_comparable, rb_str_equal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_associate_index, rb_enc_get_index): check ifnobu2007-09-151-1/+43
| | | | | | | | | object is encoding capable. [ruby-dev:31780] * string.c (rb_str_subpat_set): check for if the argument is a String. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_cycle): typo in rdoc. a patch from Yuguimatz2007-09-061-4/+4
| | | | | | <yugui@yugui.sakura.ne.jp>. [ruby-dev:31748] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_codelen): raises invalid sequence exceptionmatz2007-08-271-0/+20
| | | | | | | | if ONIGENC_CODE_TO_MBCLEN() returns zero. [ruby-dev:31661] * encoding.c (rb_enc_mbclen): check invalid sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c: added.matz2007-08-251-0/+229
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e