From f132f2705ded61b6b76ed829351c7f24ed0640e5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Mar 2005 10:39:46 +0000 Subject: [PATCH] * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#do_includes): replace also locally defined modules. * ext/iconv/iconv.c: backport Iconv::InvalidEncoding from CVS HEAD. * ext/strscan/strscan.c: moved misplaced rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 ++++++++++++--- ext/iconv/iconv.c | 15 ++++++++++++--- ext/strscan/strscan.c | 30 +++++++++++++++++++++--------- lib/rdoc/parsers/parse_c.rb | 2 +- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a4a0d7b23..8586aeecf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,16 @@ +Fri Mar 4 19:39:28 2005 Nobuyoshi Nakada + + * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#do_includes): replace + also locally defined modules. + + * ext/iconv/iconv.c: backport Iconv::InvalidEncoding from CVS HEAD. + + * ext/strscan/strscan.c: moved misplaced rdoc. + Fri Mar 4 11:17:06 2005 Hidetoshi NAGAI * ext/tcltklib/tcltklib.c (ip_rbUpdateCommand): get rid of - warnings with Tcl/Tk 8.3 or former (backport from CVS_HEAD). + warnings with Tcl/Tk 8.3 or former (backport from CVS_HEAD). * ext/tcltklib/tcltklib.c (ip_rb_threadUpdateCommand): ditto. @@ -12,11 +21,11 @@ Fri Mar 4 10:15:30 2005 Yukihiro Matsumoto Thu Mar 4 07:07:00 2005 NARUSE, Yui - * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.63 + * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.63 Thu Mar 3 23:49:00 2005 NARUSE, Yui - * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.62 + * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.62 Thu Mar 3 11:49:51 2005 Kouhei Sutou diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index c395373ff2..a6d63855ae 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -83,6 +83,7 @@ struct iconv_env_t VALUE (*append)_((VALUE, VALUE)); }; +static VALUE rb_eIconvInvalidEncoding; static VALUE rb_eIconvFailure; static VALUE rb_eIconvIllegalSeq; static VALUE rb_eIconvInvalidChar; @@ -161,10 +162,15 @@ iconv_create cd = iconv_open(tocode, fromcode); } if (cd == (iconv_t)-1) { - volatile VALUE msg = rb_str_new2("iconv(\""); + int inval = errno == EINVAL; + volatile VALUE msg = rb_str_new2("iconv(\"" + (inval ? 5 : 0)); + char *s; + rb_str_buf_cat2(rb_str_buf_append(msg, to), "\", \""); rb_str_buf_cat2(rb_str_buf_append(msg, from), "\")"); - rb_sys_fail(StringValuePtr(msg)); + s = StringValuePtr(msg); + if (!inval) rb_sys_fail(s); + rb_raise(rb_eIconvInvalidEncoding, "invalid encoding %s", s); } } @@ -625,6 +631,8 @@ iconv_s_iconv * Document-method: Iconv::conv * call-seq: Iconv.iconv(to, from, *strs) * + * Shorthand for + * Iconv.iconv(to, from, str).join * See Iconv.iconv ??? */ static VALUE @@ -732,7 +740,7 @@ iconv_iconv return iconv_convert(VALUE2ICONV(cd), str, NIL_P(n1) ? 0 : NUM2INT(n1), - NIL_P(n2) ? -1 : NUM2INT(n2), + NIL_P(n2) ? -1 : NUM2INT(n2), NULL); } @@ -868,6 +876,7 @@ Init_iconv _((void)) rb_define_method(rb_eIconvFailure, "failed", iconv_failure_failed, 0); rb_define_method(rb_eIconvFailure, "inspect", iconv_failure_inspect, 0); + rb_eIconvInvalidEncoding = rb_define_class_under(rb_cIconv, "InvalidEncoding", rb_eArgError); rb_eIconvIllegalSeq = rb_define_class_under(rb_cIconv, "IllegalSequence", rb_eArgError); rb_eIconvInvalidChar = rb_define_class_under(rb_cIconv, "InvalidCharacter", rb_eArgError); rb_eIconvOutOfRange = rb_define_class_under(rb_cIconv, "OutOfRange", rb_eRuntimeError); diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 81d3d84b9b..17ec3a8f81 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -269,7 +269,8 @@ strscan_terminate(self) } /* - * Returns the string being scanned. + * Equivalent to #terminate. + * This method is obsolete; use #terminate instead. */ static VALUE strscan_clear(self) @@ -279,6 +280,9 @@ strscan_clear(self) return strscan_terminate(self); } +/* + * Returns the string being scanned. + */ static VALUE strscan_get_string(self) VALUE self; @@ -719,6 +723,10 @@ strscan_get_byte(self) p->prev + p->regs.end[0]); } +/* + * Equivalent to #get_byte. + * This method is obsolete; use #get_byte instead. + */ static VALUE strscan_getbyte(self) VALUE self; @@ -756,6 +764,18 @@ strscan_peek(self, vlen) return extract_beg_len(p, p->curr, len); } +/* + * Equivalent to #peek. + * This method is obsolete; use #peek instead. + */ +static VALUE +strscan_peep(self, vlen) + VALUE self, vlen; +{ + rb_warning("StringScanner#peep is obsolete; use #peek instead"); + return strscan_peek(self, vlen); +} + /* * Set the scan pointer to the previous position. Only one previous position is * remembered, and it changes with each scanning operation. @@ -767,14 +787,6 @@ strscan_peek(self, vlen) * s.scan(/\d/) # => nil * s.unscan # ScanError: can't unscan: prev match had failed */ -static VALUE -strscan_peep(self, vlen) - VALUE self, vlen; -{ - rb_warning("StringScanner#peep is obsolete; use #peek instead"); - return strscan_peek(self, vlen); -} - static VALUE strscan_unscan(self) VALUE self; diff --git a/lib/rdoc/parsers/parse_c.rb b/lib/rdoc/parsers/parse_c.rb index 25ce83dd8e..7e7b952583 100644 --- a/lib/rdoc/parsers/parse_c.rb +++ b/lib/rdoc/parsers/parse_c.rb @@ -596,7 +596,7 @@ module RDoc def do_includes @body.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m| if cls = @classes[c] - m = KNOWN_CLASSES[m] || m + m = @known_classes[m] || m cls.add_include(Include.new(m, "")) end end