* encoding.c: provide basic features for M17N.

* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-08-25 03:29:39 +00:00
parent 0ada813abf
commit a25fbe3b3e
113 changed files with 1428 additions and 757 deletions

View file

@ -5,7 +5,7 @@
$Author$
created at: Thu Jun 10 14:26:32 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
Copyright (C) 1993-2007 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
@ -455,6 +455,7 @@ struct RString {
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
RSTRING(str)->as.ary : \
RSTRING(str)->as.heap.ptr)
#define RSTRING_END(str) (RSTRING_PTR(str)+RSTRING_LEN(str))
struct RArray {
struct RBasic basic;
@ -598,6 +599,32 @@ enum ruby_value_flags {
#define FL_USER6 RUBY_FL_USER6
RUBY_FL_USER7 = (1<<(FL_USHIFT+7)),
#define FL_USER7 RUBY_FL_USER7
RUBY_FL_USER8 = (1<<(FL_USHIFT+8)),
#define FL_USER8 RUBY_FL_USER8
RUBY_FL_USER9 = (1<<(FL_USHIFT+9)),
#define FL_USER9 RUBY_FL_USER9
RUBY_FL_USER10 = (1<<(FL_USHIFT+10)),
#define FL_USER10 RUBY_FL_USER10
RUBY_FL_USER11 = (1<<(FL_USHIFT+11)),
#define FL_USER11 RUBY_FL_USER11
RUBY_FL_USER12 = (1<<(FL_USHIFT+12)),
#define FL_USER12 RUBY_FL_USER12
RUBY_FL_USER13 = (1<<(FL_USHIFT+13)),
#define FL_USER13 RUBY_FL_USER13
RUBY_FL_USER14 = (1<<(FL_USHIFT+14)),
#define FL_USER14 RUBY_FL_USER14
RUBY_FL_USER15 = (1<<(FL_USHIFT+15)),
#define FL_USER15 RUBY_FL_USER15
RUBY_FL_USER16 = (1<<(FL_USHIFT+16)),
#define FL_USER16 RUBY_FL_USER16
RUBY_FL_USER17 = (1<<(FL_USHIFT+17)),
#define FL_USER17 RUBY_FL_USER17
RUBY_FL_USER18 = (1<<(FL_USHIFT+18)),
#define FL_USER18 RUBY_FL_USER18
RUBY_FL_USER19 = (1<<(FL_USHIFT+19)),
#define FL_USER19 RUBY_FL_USER19
RUBY_FL_USER20 = (1<<(FL_USHIFT+20)),
#define FL_USER20 RUBY_FL_USER20
};
#define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
@ -667,6 +694,7 @@ void rb_gc_unregister_address(VALUE*);
ID rb_intern(const char*);
ID rb_intern2(const char*, long);
ID rb_intern_str(VALUE str);
const char *rb_id2name(ID);
ID rb_to_id(VALUE);
VALUE rb_id2str(ID);