summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-31 11:44:49 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-31 11:44:49 +0000
commitf072d4e34a70d79a78d06616aad3658dd6b97141 (patch)
treee057c597ca1693829f73ebba7161435fc7176685
parent0d0c31ff8414edc38417b7b172819275e03f4dc3 (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.in1
-rw-r--r--NEWS2
-rw-r--r--configure.in6
-rw-r--r--dir.c2
-rw-r--r--enum.c3
-rw-r--r--error.c8
-rw-r--r--eval.c58
-rw-r--r--ext/tk/sample/demos-en/toolbar.rb10
-rw-r--r--ext/tk/sample/demos-en/ttkprogress.rb6
-rw-r--r--ext/tk/sample/demos-en/widget68
-rw-r--r--ext/tk/sample/demos-jp/widget67
-rw-r--r--file.c2
-rw-r--r--intern.h2
-rw-r--r--io.c29
-rw-r--r--keywords2
-rw-r--r--lex.c2
-rw-r--r--marshal.c6
-rw-r--r--numeric.c2
-rw-r--r--object.c9
-rw-r--r--pack.c20
-rw-r--r--parse.y10
-rw-r--r--re.c9
-rw-r--r--ruby.c2
-rw-r--r--ruby.h6
-rw-r--r--signal.c8
-rw-r--r--string.c10
-rw-r--r--struct.c8
-rw-r--r--time.c4
-rw-r--r--util.c2
-rw-r--r--variable.c10
-rw-r--r--version.h6
32 files changed, 218 insertions, 180 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c6a815d7c..61fedd0ab7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Sat May 31 18:28:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * suppress warnings with -Wwrite-string.
+
+Sat May 31 15:58:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, configure.in (warnflags): defaulted to -Wall
+ -Wno-parentheses with gcc. [ruby-dev:34810]
+
+Fri May 30 05:28:18 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (count_i, count_iter_i, count_all_i): add prototypes for VC.
+
Fri May 30 04:32:07 2008 Akinori MUSHA <knu@iDaemons.org>
* enum.c (count_i, count_iter_i): Sync with trunk.
@@ -28,6 +41,11 @@ Thu May 29 20:07:45 2008 Akinori MUSHA <knu@iDaemons.org>
ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the
vendor_ruby directory support.
+Thu May 29 17:52:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/extconf.rb: search zlib1, and regard mswin32 later than VC6
+ as WIN32. [ruby-core:16984]
+
Wed May 28 17:54:29 2008 Akinori MUSHA <knu@iDaemons.org>
* string.c (rb_str_start_with): Remove an unused variable.
diff --git a/Makefile.in b/Makefile.in
index a37bcf65fb..38bbe24874 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -42,6 +42,7 @@ CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
EXTLDFLAGS =
XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
+warnflags = @warnflags@
EXTLIBS =
LIBS = @LIBS@ $(EXTLIBS)
MISSING = @LIBOBJS@ @ALLOCA@
diff --git a/NEWS b/NEWS
index ea7fee0e51..aa581f1746 100644
--- a/NEWS
+++ b/NEWS
@@ -260,7 +260,7 @@ with all sufficient information, see the ChangeLog file.
* String#each_byte
* String#each
- * String#each_lines
+ * String#each_line
* String#gsub(pattern)
Return an enumerator if no block is given.
diff --git a/configure.in b/configure.in
index d5e5be9e86..821b74ed50 100644
--- a/configure.in
+++ b/configure.in
@@ -156,13 +156,16 @@ AC_ARG_PROGRAM
dnl Checks for programs.
+: ${CFLAGS=} ${CXXFLAGS=}
if test x"${build}" != x"${host}"; then
AC_CHECK_TOOL(CC, gcc)
fi
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
+test $ac_cv_prog_cc_g = yes && : ${debugflags=-g}
if test "$GCC" = yes; then
linker_flag=-Wl,
+ : ${optflags=-O2} ${warnflags="-Wall -Wno-parentheses"}
else
linker_flag=
fi
@@ -1638,9 +1641,10 @@ CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
AC_SUBST(cppflags, [])dnl
-AC_SUBST(cflags, ['${optflags} ${debugflags}'])dnl
+AC_SUBST(cflags, ['${optflags} ${debugflags} ${warnflags}'])dnl
AC_SUBST(optflags)dnl
AC_SUBST(debugflags)dnl
+AC_SUBST(warnflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
diff --git a/dir.c b/dir.c
index 118d2ff477..c2c3f9452f 100644
--- a/dir.c
+++ b/dir.c
@@ -475,7 +475,7 @@ dir_inspect(dir)
Data_Get_Struct(dir, struct dir_data, dirp);
if (dirp->path) {
- char *c = rb_obj_classname(dir);
+ const char *c = rb_obj_classname(dir);
int len = strlen(c) + strlen(dirp->path) + 4;
VALUE s = rb_str_new(0, len);
snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
diff --git a/enum.c b/enum.c
index 485fc38828..df35c2fe03 100644
--- a/enum.c
+++ b/enum.c
@@ -113,6 +113,7 @@ enum_grep(obj, pat)
return ary;
}
+static VALUE count_i _((VALUE, VALUE));
static VALUE
count_i(i, memop)
VALUE i, memop;
@@ -125,6 +126,7 @@ count_i(i, memop)
return Qnil;
}
+static VALUE count_iter_i _((VALUE, VALUE));
static VALUE
count_iter_i(i, memop)
VALUE i, memop;
@@ -137,6 +139,7 @@ count_iter_i(i, memop)
return Qnil;
}
+static VALUE count_all_i _((VALUE, VALUE));
static VALUE
count_all_i(i, memop)
VALUE i, memop;
diff --git a/error.c b/error.c
index a0530172f6..4dd5a421b4 100644
--- a/error.c
+++ b/error.c
@@ -259,7 +259,7 @@ rb_check_type(x, t)
if (TYPE(x) != t) {
while (type->type >= 0) {
if (type->type == t) {
- char *etype;
+ const char *etype;
if (NIL_P(x)) {
etype = "nil";
@@ -500,7 +500,7 @@ rb_check_backtrace(bt)
VALUE bt;
{
long i;
- static char *err = "backtrace must be Array of String";
+ static const char err[] = "backtrace must be Array of String";
if (!NIL_P(bt)) {
int t = TYPE(bt);
@@ -729,7 +729,7 @@ name_err_mesg_to_str(obj)
mesg = ptr[0];
if (NIL_P(mesg)) return Qnil;
else {
- char *desc = 0;
+ const char *desc = 0;
VALUE d = 0, args[3];
obj = ptr[1];
@@ -883,7 +883,7 @@ syserr_initialize(argc, argv, self)
#if !defined(_WIN32) && !defined(__VMS)
char *strerror();
#endif
- char *err;
+ const char *err;
VALUE mesg, error;
VALUE klass = rb_obj_class(self);
diff --git a/eval.c b/eval.c
index 89659bb21f..9391b5b927 100644
--- a/eval.c
+++ b/eval.c
@@ -1103,8 +1103,8 @@ static void scope_dup _((struct SCOPE *));
} while (0)
static VALUE rb_eval _((VALUE,NODE*));
-static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
-static NODE *compile _((VALUE, char*, int));
+static VALUE eval _((VALUE,VALUE,VALUE,const char*,int));
+static NODE *compile _((VALUE, const char*, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
@@ -1227,7 +1227,7 @@ error_print()
{
VALUE errat = Qnil; /* OK */
volatile VALUE eclass, e;
- char *einfo;
+ const char *einfo;
long elen;
if (NIL_P(ruby_errinfo)) return;
@@ -2032,7 +2032,7 @@ void
rb_frozen_class_p(klass)
VALUE klass;
{
- char *desc = "something(?!)";
+ const char *desc = "something(?!)";
if (OBJ_FROZEN(klass)) {
if (FL_TEST(klass, FL_SINGLETON))
@@ -2070,7 +2070,7 @@ rb_undef(klass, id)
}
body = search_method(klass, id, &origin);
if (!body || !body->nd_body) {
- char *s0 = " class";
+ const char *s0 = " class";
VALUE c = klass;
if (FL_TEST(c, FL_SINGLETON)) {
@@ -2322,9 +2322,9 @@ rb_copy_node_scope(node, rval)
#define MATCH_DATA *rb_svar(node->nd_cnt)
-static char* is_defined _((VALUE, NODE*, char*));
+static const char* is_defined _((VALUE, NODE*, char*));
-static char*
+static const char*
arg_defined(self, node, buf, type)
VALUE self;
NODE *node;
@@ -2351,7 +2351,7 @@ arg_defined(self, node, buf, type)
return type;
}
-static char*
+static const char*
is_defined(self, node, buf)
VALUE self;
NODE *node; /* OK */
@@ -2671,27 +2671,27 @@ set_trace_func(obj, trace)
return trace;
}
-static char *
+static const char *
get_event_name(rb_event_t event)
{
switch (event) {
- case RUBY_EVENT_LINE:
+ case RUBY_EVENT_LINE:
return "line";
- case RUBY_EVENT_CLASS:
+ case RUBY_EVENT_CLASS:
return "class";
- case RUBY_EVENT_END:
+ case RUBY_EVENT_END:
return "end";
- case RUBY_EVENT_CALL:
+ case RUBY_EVENT_CALL:
return "call";
- case RUBY_EVENT_RETURN:
+ case RUBY_EVENT_RETURN:
return "return";
- case RUBY_EVENT_C_CALL:
+ case RUBY_EVENT_C_CALL:
return "c-call";
- case RUBY_EVENT_C_RETURN:
+ case RUBY_EVENT_C_RETURN:
return "c-return";
- case RUBY_EVENT_RAISE:
+ case RUBY_EVENT_RAISE:
return "raise";
- default:
+ default:
return "unknown";
}
}
@@ -2708,7 +2708,7 @@ call_trace_func(event, node, self, id, klass)
struct FRAME *prev;
NODE *node_save;
VALUE srcfile;
- char *event_name;
+ const char *event_name;
if (!trace_func) return;
if (tracing) return;
@@ -4136,7 +4136,7 @@ rb_eval(self, n)
case NODE_DEFINED:
{
char buf[20];
- char *desc = is_defined(self, node->nd_head, buf);
+ const char *desc = is_defined(self, node->nd_head, buf);
if (desc) result = rb_str_new2(desc);
else result = Qnil;
@@ -4804,7 +4804,7 @@ proc_jump_error(state, result)
VALUE result;
{
char mesg[32];
- char *statement;
+ const char *statement;
switch (state) {
case TAG_BREAK:
@@ -5638,7 +5638,7 @@ rb_method_missing(argc, argv, obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
- char *format = 0;
+ const char *format = 0;
NODE *cnode = ruby_current_node;
if (argc == 0 || !SYMBOL_P(argv[0])) {
@@ -6448,7 +6448,7 @@ rb_frame_this_func()
static NODE*
compile(src, file, line)
VALUE src;
- char *file;
+ const char *file;
int line;
{
NODE *node;
@@ -6468,7 +6468,7 @@ compile(src, file, line)
static VALUE
eval(self, src, scope, file, line)
VALUE self, src, scope;
- char *file;
+ const char *file;
int line;
{
struct BLOCK *data = NULL;
@@ -6629,7 +6629,7 @@ rb_f_eval(argc, argv, self)
VALUE self;
{
VALUE src, scope, vfile, vline;
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
@@ -6783,7 +6783,7 @@ specific_eval(argc, argv, klass, self)
return yield_under(klass, self, Qundef);
}
else {
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
if (argc == 0) {
@@ -9014,7 +9014,7 @@ proc_to_s(self)
{
struct BLOCK *data;
NODE *node;
- char *cname = rb_obj_classname(self);
+ const char *cname = rb_obj_classname(self);
const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
VALUE str;
@@ -9748,7 +9748,7 @@ method_inspect(method)
struct METHOD *data;
VALUE str;
const char *s;
- char *sharp = "#";
+ const char *sharp = "#";
Data_Get_Struct(method, struct METHOD, data);
str = rb_str_buf_new2("#<");
@@ -12923,7 +12923,7 @@ static VALUE
rb_thread_inspect(thread)
VALUE thread;
{
- char *cname = rb_obj_classname(thread);
+ const char *cname = rb_obj_classname(thread);
rb_thread_t th = rb_thread_check(thread);
const char *status = thread_status_name(th->status);
VALUE str;
diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb
index 700db68146..5cf863717b 100644
--- a/ext/tk/sample/demos-en/toolbar.rb
+++ b/ext/tk/sample/demos-en/toolbar.rb
@@ -18,11 +18,12 @@ $toolbar_demo = TkToplevel.new {|w|
base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true)
if Tk.windowingsystem != 'aqua'
- msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
+ msg = Ttk::Label.new(base_frame, :wraplength=>'4i',
+ :text=>Tk::UTF8_String.new(<<EOL))
This is a demonstration of how to do \
a toolbar that is styled correctly \
and which can be torn off (this feature reqrires Tcl/Tk8.5). \
-The buttons are configured to be \u201Ctoolbar style\u201D buttons by \
+The buttons are configured to be \\u201Ctoolbar style\\u201D buttons by \
telling them that they are to use the Toolbutton style. At the left \
end of the toolbar is a simple marker that the cursor changes to a \
movement icon over; drag that away from the toolbar to tear off the \
@@ -31,10 +32,11 @@ toolbar is no longer needed, just close it like any normal toplevel \
and it will reattach to the window it was torn off from.
EOL
else
- msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
+ msg = Ttk::Label.new(base_frame, :wraplength=>'4i',
+ :text=>Tk::UTF8_String.new(<<EOL))
This is a demonstration of how to do \
a toolbar that is styled correctly. The buttons are configured to \
-be \u201Ctoolbar style\u201D buttons by telling them that they are \
+be \\u201Ctoolbar style\\u201D buttons by telling them that they are \
to use the Toolbutton style.
EOL
end
diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb
index d1b882f546..3eb9a64a4a 100644
--- a/ext/tk/sample/demos-en/ttkprogress.rb
+++ b/ext/tk/sample/demos-en/ttkprogress.rb
@@ -18,11 +18,11 @@ $ttkprogress_demo = TkToplevel.new {|w|
base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true)
Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left,
- :text=><<EOL).pack(:side=>:top, :fill=>:x)
+ :text=>Tk::UTF8_String.new(<<EOL)).pack(:side=>:top, :fill=>:x)
Below are two progress bars. \
-The top one is a \u201Cdeterminate\u201D progress bar, \
+The top one is a \\u201Cdeterminate\\u201D progress bar, \
which is used for showing how far through a defined task the program has got. \
-The bottom one is an \u201Cindeterminate\u201D progress bar, \
+The bottom one is an \\u201Cindeterminate\\u201D progress bar, \
which is used to show that the program is busy \
but does not know how long for. Both are run here in self-animated mode, \
which can be turned on and off using the buttons underneath.
diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget
index dc40f0a95f..9a0605d8b9 100644
--- a/ext/tk/sample/demos-en/widget
+++ b/ext/tk/sample/demos-en/widget
@@ -775,6 +775,12 @@ def showCode1(demo)
TkLabel.new(f,'text'=>' pos:').pack('side'=>'left')
posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
if $tk_version =~ /^4\.[01]/
@@ -820,10 +826,21 @@ def showCode1(demo)
TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
}
end
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
end
+
$code_window.title("Demo code: #{file}")
$code_window.iconname(file)
# fid = open(file, 'r')
@@ -835,22 +852,7 @@ def showCode1(demo)
#$code_text.set_insert('1.0')
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
@@ -879,6 +881,12 @@ def showCode2(demo)
TkLabel.new(lf, :text=>' pos:').pack(:side=>:left)
posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
b_dis = TkButton.new(bf, :text=>'Dismiss', :default=>:active,
:command=>proc{
$code_window.destroy
@@ -909,6 +917,17 @@ def showCode2(demo)
$code_window.bindinfo('Return').each{|cmd, arg|
$code_window.bind_append('Escape', cmd, arg)
}
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+ btag.bind('Configure', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
@@ -921,22 +940,7 @@ def showCode2(demo)
$code_text.insert('1.0', fid.read)
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index 60ec5b5e96..8eb699e513 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -814,6 +814,12 @@ def showCode1(demo)
TkLabel.new(f,'text'=>' pos:').pack('side'=>'left')
posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
if $tk_version =~ /^4\.[01]/
@@ -858,10 +864,21 @@ def showCode1(demo)
TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
}
end
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
end
+
$code_window.title("Demo code: #{file}")
$code_window.iconname(file)
# fid = open(file, 'r')
@@ -873,22 +890,7 @@ def showCode1(demo)
#$code_text.set_insert('1.0')
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
@@ -917,6 +919,12 @@ def showCode2(demo)
TkLabel.new(lf, :text=>' pos:').pack(:side=>:left)
posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
+ $set_linenum = proc{|w|
+ line, pos = w.index('insert').split('.')
+ linenum.text = line
+ posnum.text = pos
+ }
+
#b_dis = TkButton.new(bf, :text=>'λ²ò', :default=>:active,
b_dis = TkButton.new(bf, :text=>'ÊĤ¸¤ë', :default=>:active,
:command=>proc{
@@ -948,6 +956,16 @@ def showCode2(demo)
$code_window.bindinfo('Return').each{|cmd, arg|
$code_window.bind_append('Escape', cmd, arg)
}
+
+ btag = TkBindTag.new
+
+ btag.bind('Key', $set_linenum, '%W')
+ btag.bind('Button', $set_linenum, '%W')
+
+ btags = $code_text.bindtags
+ btags.insert(btags.index($code_text.class) + 1, btag)
+ $code_text.bindtags = btags
+
else
$code_window.deiconify
$code_window.raise
@@ -960,22 +978,7 @@ def showCode2(demo)
$code_text.insert('1.0', fid.read)
TkTextMarkInsert.new($code_text,'1.0')
- btag = TkBindTag.new
-
- set_linenum = proc{|w|
- line, pos = w.index('insert').split('.')
- linenum.text = line
- posnum.text = pos
- }
-
- btag.bind('Key', set_linenum, '%W')
- btag.bind('Button', set_linenum, '%W')
-
- btags = $code_text.bindtags
- btags.insert(btags.index($code_text.class) + 1, btag)
- $code_text.bindtags = btags
-
- set_linenum.call($code_text)
+ $set_linenum.call($code_text)
fid.close
end
diff --git a/file.c b/file.c
index c844e3f88b..8d54961ec3 100644
--- a/file.c
+++ b/file.c
@@ -1495,7 +1495,7 @@ static VALUE
rb_file_ftype(st)
struct stat *st;
{
- char *t;
+ const char *t;
if (S_ISREG(st->st_mode)) {
t = "file";
diff --git a/intern.h b/intern.h
index e7e06efb0a..a7d82a671a 100644
--- a/intern.h
+++ b/intern.h
@@ -467,7 +467,7 @@ VALUE rb_struct_alloc _((VALUE, VALUE));
VALUE rb_struct_aref _((VALUE, VALUE));
VALUE rb_struct_aset _((VALUE, VALUE, VALUE));
VALUE rb_struct_getmember _((VALUE, ID));
-VALUE rb_struct_iv_get _((VALUE, char*));
+VALUE rb_struct_iv_get _((VALUE, const char*));
VALUE rb_struct_s_members _((VALUE));
VALUE rb_struct_members _((VALUE));
/* time.c */
diff --git a/io.c b/io.c
index 94c2fe8e9d..d21970e7b7 100644
--- a/io.c
+++ b/io.c
@@ -1000,7 +1000,8 @@ rb_io_inspect(obj)
VALUE obj;
{
rb_io_t *fptr;
- char *buf, *cname, *st = "";
+ char *buf;
+ const char *cname, *st = "";
long len;
fptr = RFILE(rb_io_taint_check(obj))->fptr;
@@ -1703,7 +1704,7 @@ rb_io_getline(rs, io)
}
else {
int c, newline;
- char *rsptr;
+ const char *rsptr;
long rslen;
int rspara = 0;
@@ -2705,7 +2706,7 @@ rb_io_binmode(io)
return io;
}
-char*
+const char*
rb_io_flags_mode(flags)
int flags;
{
@@ -2858,7 +2859,7 @@ rb_io_mode_modenum(mode)
#define MODENUM_MAX 4
-static char*
+static const char*
rb_io_modenum_mode(flags)
int flags;
{
@@ -3005,7 +3006,7 @@ rb_file_sysopen_internal(io, fname, flags, mode)
{
rb_io_t *fptr;
int fd;
- char *m;
+ const char *m;
MakeOpenFile(io, fptr);
@@ -3123,12 +3124,12 @@ rb_io_unbuffered(fptr)
rb_io_synchronized(fptr);
}
-static VALUE pipe_open(VALUE pstr, char *pname, char *mode);
+static VALUE pipe_open(VALUE pstr, const char *pname, const char *mode);
static VALUE
pipe_open(pstr, pname, mode)
VALUE pstr;
- char *pname, *mode;
+ const char *pname, *mode;
{
int modef = rb_io_mode_flags(mode);
rb_io_t *fptr;
@@ -3350,7 +3351,7 @@ rb_io_s_popen(argc, argv, klass)
VALUE *argv;
VALUE klass;
{
- char *mode;
+ const char *mode;
VALUE pname, pmode, port;
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
@@ -3388,7 +3389,7 @@ rb_open_file(argc, argv, io)
VALUE io;
{
VALUE fname, vmode, perm;
- char *path, *mode;
+ const char *path, *mode;
int flags, fmode;
rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
@@ -3606,7 +3607,7 @@ rb_io_check_io(io)
return rb_check_convert_type(io, T_FILE, "IO", "to_io");
}
-static char*
+static const char*
rb_io_mode_string(fptr)
rb_io_t *fptr;
{
@@ -3626,7 +3627,7 @@ io_reopen(io, nfile)
VALUE io, nfile;
{
rb_io_t *fptr, *orig;
- char *mode;
+ const char *mode;
int fd, fd2;
off_t pos = 0;
@@ -3742,7 +3743,7 @@ rb_io_reopen(argc, argv, file)
VALUE file;
{
VALUE fname, nmode;
- char *mode;
+ const char *mode;
rb_io_t *fptr;
rb_secure(4);
@@ -3805,7 +3806,7 @@ rb_io_init_copy(dest, io)
{
rb_io_t *fptr, *orig;
int fd;
- char *mode;
+ const char *mode;
io = rb_io_get_io(io);
if (dest == io) return dest;
@@ -4425,7 +4426,7 @@ rb_io_s_new(argc, argv, klass)
VALUE klass;
{
if (rb_block_given_p()) {
- char *cname = rb_class2name(klass);
+ const char *cname = rb_class2name(klass);
rb_warn("%s::new() does not take block; use %s::open() instead",
cname, cname);
diff --git a/keywords b/keywords
index 04be992857..6eed5e1f4d 100644
--- a/keywords
+++ b/keywords
@@ -1,4 +1,4 @@
-struct kwtable {char *name; int id[2]; enum lex_state state;};
+struct kwtable {const char *name; int id[2]; enum lex_state state;};
%%
__LINE__, {k__LINE__, k__LINE__}, EXPR_END
__FILE__, {k__FILE__, k__FILE__}, EXPR_END
diff --git a/lex.c b/lex.c
index 79d9448dae..a15309d502 100644
--- a/lex.c
+++ b/lex.c
@@ -1,6 +1,6 @@
/* C code produced by gperf version 2.7.2 */
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' ./keywords */
-struct kwtable {char *name; int id[2]; enum lex_state state;};
+struct kwtable {const char *name; int id[2]; enum lex_state state;};
#define TOTAL_KEYWORDS 40
#define MIN_WORD_LENGTH 2
diff --git a/marshal.c b/marshal.c
index 39758d89d2..a7735eff53 100644
--- a/marshal.c
+++ b/marshal.c
@@ -338,7 +338,7 @@ w_symbol(id, arg)
ID id;
struct dump_arg *arg;
{
- char *sym = rb_id2name(id);
+ const char *sym = rb_id2name(id);
st_data_t num;
if (st_lookup(arg->symbols, id, &num)) {
@@ -381,7 +381,7 @@ w_extended(klass, arg, check)
struct dump_arg *arg;
int check;
{
- char *path;
+ const char *path;
if (check && FL_TEST(klass, FL_SINGLETON)) {
if (RCLASS(klass)->m_tbl->num_entries ||
@@ -948,7 +948,7 @@ r_symbol(arg)
return r_symreal(arg);
}
-static char*
+static const char*
r_unique(arg)
struct load_arg *arg;
{
diff --git a/numeric.c b/numeric.c
index b2f2e1fad9..aaf98b62e8 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2776,7 +2776,7 @@ static VALUE
fix_id2name(fix)
VALUE fix;
{
- char *name = rb_id2name(FIX2UINT(fix));
+ const char *name = rb_id2name(FIX2UINT(fix));
if (name) return rb_str_new2(name);
return Qnil;
}
diff --git a/object.c b/object.c
index fcc30bd2f7..813518676f 100644
--- a/object.c
+++ b/object.c
@@ -314,7 +314,7 @@ VALUE
rb_any_to_s(obj)
VALUE obj;
{
- char *cname = rb_obj_classname(obj);
+ const char *cname = rb_obj_classname(obj);
size_t len;
VALUE str;
@@ -341,7 +341,7 @@ inspect_i(id, value, str)
VALUE str;
{
VALUE str2;
- char *ivname;
+ const char *ivname;
/* need not to show internal data */
if (CLASS_OF(value) == 0) return ST_CONTINUE;
@@ -397,9 +397,8 @@ rb_obj_inspect(obj)
&& ROBJECT(obj)->iv_tbl->num_entries > 0) {
VALUE str;
size_t len;
- char *c;
+ const char *c = rb_obj_classname(obj);
- c = rb_obj_classname(obj);
if (rb_inspecting_p(obj)) {
len = strlen(c)+10+16+1;
str = rb_str_new(0, len); /* 10:tags 16:addr 1:nul */
@@ -1161,7 +1160,7 @@ sym_inspect(sym)
VALUE sym;
{
VALUE str;
- char *name;
+ const char *name;
ID id = SYM2ID(sym);
name = rb_id2name(id);
diff --git a/pack.c b/pack.c
index e5324d1e8e..cf348947f1 100644
--- a/pack.c
+++ b/pack.c
@@ -366,7 +366,7 @@ num2i32(x)
#endif
static const char toofew[] = "too few arguments";
-static void encodes _((VALUE,char*,long,int));
+static void encodes _((VALUE,const char*,long,int));
static void qpencode _((VALUE,VALUE,long));
static int uv_to_utf8 _((char*,unsigned long));
@@ -441,13 +441,13 @@ static VALUE
pack_pack(ary, fmt)
VALUE ary, fmt;
{
- static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
- static char *spc10 = " ";
+ static const char nul10[] = "\0\0\0\0\0\0\0\0\0\0";
+ static const char spc10[] = " ";
char *p, *pend;
VALUE res, from, associates = 0;
char type;
long items, len, idx, plen;
- char *ptr;
+ const char *ptr;
#ifdef NATINT_PACK
int natint; /* native integer */
#endif
@@ -1004,21 +1004,21 @@ pack_pack(ary, fmt)
return res;
}
-static char uu_table[] =
+static const char uu_table[] =
"`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
-static char b64_table[] =
+static const char b64_table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static void
encodes(str, s, len, type)
VALUE str;
- char *s;
+ const char *s;
long len;
int type;
{
char *buff = ALLOCA_N(char, len * 4 / 3 + 6);
long i = 0;
- char *trans = type == 'u' ? uu_table : b64_table;
+ const char *trans = type == 'u' ? uu_table : b64_table;
int padding;
if (type == 'u') {
@@ -1304,7 +1304,7 @@ static VALUE
pack_unpack(str, fmt)
VALUE str, fmt;
{
- static char *hexdigits = "0123456789abcdef0123456789ABCDEFx";
+ static const char hexdigits[] = "0123456789abcdef0123456789ABCDEFx";
char *s, *send;
char *p, *pend;
VALUE ary;
@@ -1338,7 +1338,7 @@ pack_unpack(str, fmt)
}
star = 0;
if (*p == '_' || *p == '!') {
- char *natstr = "sSiIlL";
+ static const char natstr[] = "sSiIlL";
if (strchr(natstr, type)) {
#ifdef NATINT_PACK
diff --git a/parse.y b/parse.y
index 1834778e92..94505c7989 100644
--- a/parse.y
+++ b/parse.y
@@ -4524,7 +4524,7 @@ yylex()
}
if (lex_state != EXPR_DOT) {
- struct kwtable *kw;
+ const struct kwtable *kw;
/* See if it is a reserved word. */
kw = rb_reserved_word(tok(), toklen());
@@ -5178,7 +5178,7 @@ static void
void_expr0(node)
NODE *node;
{
- char *useless = 0;
+ const char *useless = 0;
if (!RTEST(ruby_verbose)) return;
@@ -5945,7 +5945,7 @@ rb_parser_while_loop(chop, split)
static struct {
ID token;
- char *name;
+ const char *name;
} op_tbl[] = {
{tDOT2, ".."},
{tDOT3, "..."},
@@ -6193,11 +6193,11 @@ rb_intern(name)
return id;
}
-char *
+const char *
rb_id2name(id)
ID id;
{
- char *name;
+ const char *name;
st_data_t data;
if (id < tLAST_TOKEN) {
diff --git a/re.c b/re.c
index ae5473ed0a..a060f27edb 100644
--- a/re.c
+++ b/re.c
@@ -595,7 +595,7 @@ static VALUE
rb_reg_kcode_m(re)
VALUE re;
{
- char *kcode;
+ const char *kcode;
if (FL_TEST(re, KCODE_FIXED)) {
switch (RBASIC(re)->flags & KCODE_MASK) {
@@ -1340,7 +1340,7 @@ match_string(match)
static VALUE
match_inspect(VALUE match)
{
- char *cname = rb_obj_classname(match);
+ const char *cname = rb_obj_classname(match);
VALUE str;
int i;
struct re_registers *regs = RMATCH(match)->regs;
@@ -1477,8 +1477,9 @@ rb_reg_regcomp(str)
case_cache = ruby_ignorecase;
kcode_cache = reg_kcode;
- return reg_cache = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
- ruby_ignorecase);
+ reg_cache = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len, ruby_ignorecase);
+ RB_GC_GUARD(save_str);
+ return reg_cache;
}
static int
diff --git a/ruby.c b/ruby.c
index 934cb8fd8b..b85b1440a6 100644
--- a/ruby.c
+++ b/ruby.c
@@ -65,7 +65,7 @@ static VALUE do_loop = Qfalse, do_print = Qfalse;
static VALUE do_check = Qfalse, do_line = Qfalse;
static VALUE do_split = Qfalse;
-static char *script;
+static const char *script;
static int origargc;
static char **origargv;
diff --git a/ruby.h b/ruby.h
index 5dfebbc699..f51a81292e 100644
--- a/ruby.h
+++ b/ruby.h
@@ -538,11 +538,11 @@ void rb_gc_register_address _((VALUE*));
void rb_gc_unregister_address _((VALUE*));
ID rb_intern _((const char*));
-char *rb_id2name _((ID));
+const char *rb_id2name _((ID));
ID rb_to_id _((VALUE));
-char *rb_class2name _((VALUE));
-char *rb_obj_classname _((VALUE));
+const char *rb_class2name _((VALUE));
+const char *rb_obj_classname _((VALUE));
void rb_p _((VALUE));
diff --git a/signal.c b/signal.c
index 351cdc4600..90962328ca 100644
--- a/signal.c
+++ b/signal.c
@@ -36,7 +36,7 @@
#endif
static struct signals {
- char *signm;
+ const char *signm;
int signo;
} siglist [] = {
{"EXIT", 0},
@@ -186,7 +186,7 @@ signm2signo(nm)
return 0;
}
-static char*
+static const char*
signo2signm(no)
int no;
{
@@ -327,7 +327,7 @@ rb_f_kill(argc, argv)
int negative = 0;
int sig;
int i;
- char *s;
+ const char *s;
rb_secure(2);
if (argc < 2)
@@ -706,7 +706,7 @@ trap(arg)
sighandler_t func, oldfunc;
VALUE command, oldcmd;
int sig = -1;
- char *s;
+ const char *s;
func = sighandler;
command = arg->cmd;
diff --git a/string.c b/string.c
index 3d8a664962..2e0a127f72 100644
--- a/string.c
+++ b/string.c
@@ -545,7 +545,8 @@ rb_str_associated(str)
return Qfalse;
}
-static char *null_str = "";
+static const char null_str[] = "";
+#define null_str ((char *)null_str)
VALUE
rb_string_value(ptr)
@@ -4480,7 +4481,7 @@ rb_str_crypt(str, salt)
{
extern char *crypt();
VALUE result;
- char *s;
+ const char *s;
StringValue(salt);
if (RSTRING(salt)->len < 2)
@@ -4607,7 +4608,8 @@ rb_str_justify(argc, argv, str, jflag)
VALUE w;
long width, flen = 0;
VALUE res;
- char *p, *pend, *f = " ";
+ char *p, *pend;
+ const char *f = " ";
long n;
VALUE pad;
@@ -4633,7 +4635,7 @@ rb_str_justify(argc, argv, str, jflag)
}
}
else {
- char *q = f;
+ const char *q = f;
while (p + flen <= pend) {
memcpy(p,f,flen);
p += flen;
diff --git a/struct.c b/struct.c
index 8a3f8acb5c..9417c1c347 100644
--- a/struct.c
+++ b/struct.c
@@ -20,7 +20,7 @@ static VALUE struct_alloc _((VALUE));
VALUE
rb_struct_iv_get(c, name)
VALUE c;
- char *name;
+ const char *name;
{
ID id;
@@ -470,7 +470,7 @@ static VALUE
inspect_struct(s)
VALUE s;
{
- char *cname = rb_class2name(rb_obj_class(s));
+ const char *cname = rb_class2name(rb_obj_class(s));
VALUE str, members;
long i;
@@ -481,7 +481,7 @@ inspect_struct(s)
for (i=0; i<RSTRUCT(s)->len; i++) {
VALUE slot;
ID id;
- char *p;
+ const char *p;
if (i > 0) {
rb_str_cat2(str, ", ");
@@ -517,7 +517,7 @@ rb_struct_inspect(s)
VALUE s;
{
if (rb_inspecting_p(s)) {
- char *cname = rb_class2name(rb_obj_class(s));
+ const char *cname = rb_class2name(rb_obj_class(s));
size_t len = strlen(cname) + 14;
VALUE str = rb_str_new(0, len);
diff --git a/time.c b/time.c
index 3792701b06..492f1c8e4c 100644
--- a/time.c
+++ b/time.c
@@ -171,7 +171,7 @@ time_timeval(time, interval)
int interval;
{
struct timeval t;
- char *tstr = interval ? "time interval" : "time";
+ const char *tstr = interval ? "time interval" : "time";
#ifndef NEGATIVE_TIME_T
interval = 1;
@@ -279,7 +279,7 @@ time_s_at(argc, argv, klass)
return t;
}
-static char *months [12] = {
+static const char months[][4] = {
"jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec",
};
diff --git a/util.c b/util.c
index 059fa912ad..dd501f03c6 100644
--- a/util.c
+++ b/util.c
@@ -3100,7 +3100,7 @@ rv_alloc(int i)
}
static char *
-nrv_alloc(char *s, char **rve, int n)
+nrv_alloc(const char *s, char **rve, int n)
{
char *rv, *t;
diff --git a/variable.c b/variable.c
index 8b6aa74955..fbb011759d 100644
--- a/variable.c
+++ b/variable.c
@@ -195,7 +195,7 @@ rb_class_path(klass)
return path;
}
else {
- char *s = "Class";
+ const char *s = "Class";
size_t len;
if (TYPE(klass) == T_MODULE) {
@@ -294,14 +294,14 @@ rb_class_name(klass)
return rb_class_path(rb_class_real(klass));
}
-char *
+const char *
rb_class2name(klass)
VALUE klass;
{
return RSTRING(rb_class_name(klass))->ptr;
}
-char *
+const char *
rb_obj_classname(obj)
VALUE obj;
{
@@ -789,7 +789,7 @@ rb_f_global_variables()
{
VALUE ary = rb_ary_new();
char buf[4];
- char *s = "&`'+123456789";
+ const char *s = "&`'+123456789";
st_foreach(rb_global_tbl, gvar_i, ary);
if (!NIL_P(rb_backref_get())) {
@@ -1653,7 +1653,7 @@ mod_av_set(klass, id, val, isconst)
VALUE val;
int isconst;
{
- char *dest = isconst ? "constant" : "class variable";
+ const char *dest = isconst ? "constant" : "class variable";
if (!OBJ_TAINTED(klass) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't set %s", dest);
diff --git a/version.h b/version.h
index 555d42c55d..2ffc4a53fd 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-05-30"
+#define RUBY_RELEASE_DATE "2008-05-31"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20080530
+#define RUBY_RELEASE_CODE 20080531
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 30
+#define RUBY_RELEASE_DAY 31
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];