summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-26 09:39:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-26 09:39:08 +0000
commit05253b86cbd7ab1c7cd57203c39a8c4c1e07c8f4 (patch)
tree3ab3cc624ac5e26788e772517645bb312837e1c8 /include
parent3cc595484341c7510fbca8e0e01315727714492f (diff)
downloadruby-05253b86cbd7ab1c7cd57203c39a8c4c1e07c8f4.tar.gz
ruby-05253b86cbd7ab1c7cd57203c39a8c4c1e07c8f4.tar.xz
ruby-05253b86cbd7ab1c7cd57203c39a8c4c1e07c8f4.zip
* encoding.c (rb_enc_check): check for ASCII-compatibilities.
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/encoding.h4
-rw-r--r--include/ruby/intern.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index f43160a68..1b97b6ab6 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -27,6 +27,7 @@
typedef OnigEncodingType rb_encoding;
int rb_enc_to_index(rb_encoding*);
+int rb_enc_get_index(VALUE obj);
rb_encoding* rb_enc_get(VALUE);
rb_encoding* rb_enc_check(VALUE,VALUE);
void rb_enc_associate(VALUE, rb_encoding*);
@@ -73,8 +74,11 @@ int rb_enc_codelen(int, rb_encoding*);
#define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE(enc,c)
#define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT(enc,c)
+#define rb_enc_asciicompat(enc) (rb_enc_mbminlen(enc)==1)
+
int rb_enc_toupper(int c, rb_encoding *enc);
int rb_enc_tolower(int c, rb_encoding *enc);
ID rb_intern3(const char*, long, rb_encoding*);
+int rb_enc_symname_p(const char*, rb_encoding*);
#endif /* RUBY_ENCODING_H */
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 7391845e2..e06e36892 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -516,7 +516,9 @@ VALUE rb_str_append(VALUE, VALUE);
VALUE rb_str_concat(VALUE, VALUE);
int rb_memhash(const void *ptr, long len);
int rb_str_hash(VALUE);
+int rb_str_comparable(VALUE, VALUE);
int rb_str_cmp(VALUE, VALUE);
+VALUE rb_str_equal(VALUE str1, VALUE str2);
void rb_str_update(VALUE, long, long, VALUE);
VALUE rb_str_inspect(VALUE);
VALUE rb_str_dump(VALUE);