mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1.1b9_26
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
16487ee284
commit
992923053c
30 changed files with 646 additions and 120 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
Thu Jun 18 16:46:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* experimental release 1.1b9_26.
|
||||||
|
|
||||||
|
Thu Jun 18 13:37:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* file.c (file_s_ftype): uses lstat(2) instead of stat(2).
|
||||||
|
|
||||||
|
* dir.c (dir_s_glob): there can be buffer overrun, check added.
|
||||||
|
|
||||||
|
* eval.c (f_binding): handles in-block variables declared after
|
||||||
|
binding's generation.
|
||||||
|
|
||||||
|
* numeric.c (flo_floor): floor, ceil, round added to Float.
|
||||||
|
|
||||||
|
Wed Jun 17 11:20:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* parse.y (gettable): nesting local variables should have higher
|
||||||
|
priority than normal local variables.
|
||||||
|
|
||||||
Tue Jun 16 12:30:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Jun 16 12:30:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* bignum.c (str2inum): handles `+ddd'.
|
* bignum.c (str2inum): handles `+ddd'.
|
||||||
|
|
1
MANIFEST
1
MANIFEST
|
@ -127,6 +127,7 @@ lib/tkclass.rb
|
||||||
lib/tkdialog.rb
|
lib/tkdialog.rb
|
||||||
lib/tkentry.rb
|
lib/tkentry.rb
|
||||||
lib/tkmenubar.rb
|
lib/tkmenubar.rb
|
||||||
|
lib/tkpalette.rb
|
||||||
lib/tkscrollbox.rb
|
lib/tkscrollbox.rb
|
||||||
lib/tktext.rb
|
lib/tktext.rb
|
||||||
lib/tracer.rb
|
lib/tracer.rb
|
||||||
|
|
16
Makefile.in
16
Makefile.in
|
@ -190,24 +190,24 @@ dln.o: dln.c config.h defines.h dln.h
|
||||||
dmyext.o: dmyext.c
|
dmyext.o: dmyext.c
|
||||||
enum.o: enum.c ruby.h config.h defines.h intern.h
|
enum.o: enum.c ruby.h config.h defines.h intern.h
|
||||||
error.o: error.c ruby.h config.h defines.h intern.h env.h
|
error.o: error.c ruby.h config.h defines.h intern.h env.h
|
||||||
eval.o: eval.c ruby.h config.h defines.h intern.h node.h env.h sig.h st.h dln.h
|
eval.o: eval.c ruby.h config.h defines.h intern.h node.h env.h rubysig.h st.h dln.h
|
||||||
file.o: file.c ruby.h config.h defines.h intern.h io.h sig.h
|
file.o: file.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
|
||||||
gc.o: gc.c ruby.h config.h defines.h intern.h sig.h st.h node.h env.h re.h regex.h
|
gc.o: gc.c ruby.h config.h defines.h intern.h rubysig.h st.h node.h env.h re.h regex.h
|
||||||
hash.o: hash.c ruby.h config.h defines.h intern.h st.h sig.h
|
hash.o: hash.c ruby.h config.h defines.h intern.h st.h rubysig.h
|
||||||
inits.o: inits.c ruby.h config.h defines.h intern.h
|
inits.o: inits.c ruby.h config.h defines.h intern.h
|
||||||
io.o: io.c ruby.h config.h defines.h intern.h io.h sig.h
|
io.o: io.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
|
||||||
main.o: main.c ruby.h config.h defines.h intern.h
|
main.o: main.c ruby.h config.h defines.h intern.h
|
||||||
marshal.o: marshal.c ruby.h config.h defines.h intern.h io.h sig.h st.h
|
marshal.o: marshal.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h st.h
|
||||||
math.o: math.c ruby.h config.h defines.h intern.h
|
math.o: math.c ruby.h config.h defines.h intern.h
|
||||||
numeric.o: numeric.c ruby.h config.h defines.h intern.h
|
numeric.o: numeric.c ruby.h config.h defines.h intern.h
|
||||||
object.o: object.c ruby.h config.h defines.h intern.h st.h
|
object.o: object.c ruby.h config.h defines.h intern.h st.h
|
||||||
pack.o: pack.c ruby.h config.h defines.h intern.h
|
pack.o: pack.c ruby.h config.h defines.h intern.h
|
||||||
process.o: process.c ruby.h config.h defines.h intern.h sig.h st.h
|
process.o: process.c ruby.h config.h defines.h intern.h rubysig.h st.h
|
||||||
random.o: random.c ruby.h config.h defines.h intern.h
|
random.o: random.c ruby.h config.h defines.h intern.h
|
||||||
range.o: range.c ruby.h config.h defines.h intern.h
|
range.o: range.c ruby.h config.h defines.h intern.h
|
||||||
re.o: re.c ruby.h config.h defines.h intern.h re.h regex.h
|
re.o: re.c ruby.h config.h defines.h intern.h re.h regex.h
|
||||||
ruby.o: ruby.c ruby.h config.h defines.h intern.h dln.h
|
ruby.o: ruby.c ruby.h config.h defines.h intern.h dln.h
|
||||||
signal.o: signal.c ruby.h config.h defines.h intern.h sig.h
|
signal.o: signal.c ruby.h config.h defines.h intern.h rubysig.h
|
||||||
sprintf.o: sprintf.c ruby.h config.h defines.h intern.h
|
sprintf.o: sprintf.c ruby.h config.h defines.h intern.h
|
||||||
st.o: st.c config.h st.h
|
st.o: st.c config.h st.h
|
||||||
string.o: string.c ruby.h config.h defines.h intern.h re.h regex.h
|
string.o: string.c ruby.h config.h defines.h intern.h re.h regex.h
|
||||||
|
|
8
configure
vendored
8
configure
vendored
|
@ -622,12 +622,12 @@ if test "${enable_fat_binary+set}" = set; then
|
||||||
fat_binary=$enableval
|
fat_binary=$enableval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$fat_binary" = yes ; then
|
if test "$fat_binary" = yes ; then
|
||||||
|
|
||||||
echo $ac_n "checking target architecture ""... $ac_c" 1>&6
|
echo $ac_n "checking target architecture ""... $ac_c" 1>&6
|
||||||
echo "configure:629: checking target architecture " >&5
|
echo "configure:629: checking target architecture " >&5
|
||||||
|
|
||||||
if "$host_os" = "rhapsody" ; then
|
if test "$host_os" = "rhapsody" ; then
|
||||||
echo -n "Rhapsody: "
|
echo -n "Rhapsody: "
|
||||||
if test "$TARGET_ARCHS" = "" ; then
|
if test "$TARGET_ARCHS" = "" ; then
|
||||||
TARGET_ARCHS="ppc i486"
|
TARGET_ARCHS="ppc i486"
|
||||||
|
@ -3905,8 +3905,8 @@ if test "$host_os" = "beos"; then
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if "$host_os" = "rhapsody" ; then
|
if test "$host_os" = "rhapsody" ; then
|
||||||
CFLAGS="$CFLAGS -no-precomp"
|
CFLAGS="$CFLAGS -no-precomp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
15
dir.c
15
dir.c
|
@ -371,22 +371,23 @@ push_braces(ary, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
dir_s_glob(dir, vstr)
|
dir_s_glob(dir, str)
|
||||||
VALUE dir, vstr;
|
VALUE dir, str;
|
||||||
{
|
{
|
||||||
char *p, *pend;
|
char *p, *pend;
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
char *t, *t0;
|
char *t, *t0;
|
||||||
int nest;
|
int nest;
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
struct RString *str;
|
|
||||||
|
|
||||||
Check_SafeStr(vstr);
|
Check_SafeStr(str);
|
||||||
str = RSTRING(vstr);
|
if (RSTRING(str)->len > MAXPATHLEN) {
|
||||||
|
ArgError("pathname too long (%d bytes)", RSTRING(str)->len);
|
||||||
|
}
|
||||||
ary = ary_new();
|
ary = ary_new();
|
||||||
|
|
||||||
p = str->ptr;
|
p = RSTRING(str)->ptr;
|
||||||
pend = p + str->len;
|
pend = p + RSTRING(str)->len;
|
||||||
|
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
t = buf;
|
t = buf;
|
||||||
|
|
51
eval.c
51
eval.c
|
@ -1041,19 +1041,19 @@ rb_eval_string(str)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
VALUE
|
||||||
rb_eval_cmd(cmd, arg)
|
rb_eval_cmd(cmd, arg)
|
||||||
VALUE cmd, arg;
|
VALUE cmd, arg;
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
|
VALUE val;
|
||||||
struct SCOPE *saved_scope;
|
struct SCOPE *saved_scope;
|
||||||
volatile int safe = rb_safe_level();
|
volatile int safe = rb_safe_level();
|
||||||
|
|
||||||
if (TYPE(cmd) != T_STRING) {
|
if (TYPE(cmd) != T_STRING) {
|
||||||
Check_Type(arg, T_ARRAY);
|
Check_Type(arg, T_ARRAY);
|
||||||
rb_funcall2(cmd, rb_intern("call"),
|
return rb_funcall2(cmd, rb_intern("call"),
|
||||||
RARRAY(arg)->len, RARRAY(arg)->ptr);
|
RARRAY(arg)->len, RARRAY(arg)->ptr);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSH_CLASS();
|
PUSH_CLASS();
|
||||||
|
@ -1067,7 +1067,7 @@ rb_eval_cmd(cmd, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
eval(TopSelf, cmd, Qnil, 0, 0);
|
val = eval(TopSelf, cmd, Qnil, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
the_scope = saved_scope;
|
the_scope = saved_scope;
|
||||||
|
@ -1097,24 +1097,27 @@ rb_eval_cmd(cmd, arg)
|
||||||
JUMP_TAG(state);
|
JUMP_TAG(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
VALUE
|
||||||
rb_trap_eval(cmd, sig)
|
rb_trap_eval(cmd, sig)
|
||||||
VALUE cmd;
|
VALUE cmd;
|
||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
|
VALUE val; /* OK */
|
||||||
|
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
rb_eval_cmd(cmd, ary_new3(1, INT2FIX(sig)));
|
val = rb_eval_cmd(cmd, ary_new3(1, INT2FIX(sig)));
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (state) {
|
if (state) {
|
||||||
trap_immediate = 0;
|
trap_immediate = 0;
|
||||||
JUMP_TAG(state);
|
JUMP_TAG(state);
|
||||||
}
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1122,7 +1125,7 @@ superclass(self, node)
|
||||||
VALUE self;
|
VALUE self;
|
||||||
NODE *node;
|
NODE *node;
|
||||||
{
|
{
|
||||||
VALUE val = 0; /* OK */
|
VALUE val; /* OK */
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
|
@ -1130,7 +1133,7 @@ superclass(self, node)
|
||||||
val = rb_eval(self, node);
|
val = rb_eval(self, node);
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
if (state == TAG_RAISE) {
|
if (state) {
|
||||||
superclass_error:
|
superclass_error:
|
||||||
switch (nd_type(node)) {
|
switch (nd_type(node)) {
|
||||||
case NODE_COLON2:
|
case NODE_COLON2:
|
||||||
|
@ -1351,8 +1354,8 @@ is_defined(self, node, buf)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_FCALL:
|
|
||||||
case NODE_VCALL:
|
case NODE_VCALL:
|
||||||
|
case NODE_FCALL:
|
||||||
val = CLASS_OF(self);
|
val = CLASS_OF(self);
|
||||||
goto check_bound;
|
goto check_bound;
|
||||||
|
|
||||||
|
@ -1401,6 +1404,7 @@ is_defined(self, node, buf)
|
||||||
case NODE_MASGN:
|
case NODE_MASGN:
|
||||||
case NODE_LASGN:
|
case NODE_LASGN:
|
||||||
case NODE_DASGN:
|
case NODE_DASGN:
|
||||||
|
case NODE_DASGN_PUSH:
|
||||||
case NODE_GASGN:
|
case NODE_GASGN:
|
||||||
case NODE_IASGN:
|
case NODE_IASGN:
|
||||||
case NODE_CASGN:
|
case NODE_CASGN:
|
||||||
|
@ -2075,6 +2079,19 @@ rb_eval(self, node)
|
||||||
result = dyna_var_asgn(node->nd_vid, rb_eval(self, node->nd_value));
|
result = dyna_var_asgn(node->nd_vid, rb_eval(self, node->nd_value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NODE_DASGN_PUSH:
|
||||||
|
result = rb_eval(self, node->nd_value);
|
||||||
|
if (the_dyna_vars && the_dyna_vars->id == 0) {
|
||||||
|
struct RVarmap* vars = new_dvar(node->nd_vid, result);
|
||||||
|
|
||||||
|
vars->next = the_dyna_vars->next;
|
||||||
|
the_dyna_vars->next = vars;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
push_dvar(node->nd_vid, result);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case NODE_GASGN:
|
case NODE_GASGN:
|
||||||
{
|
{
|
||||||
VALUE val;
|
VALUE val;
|
||||||
|
@ -2954,6 +2971,10 @@ assign(self, lhs, val)
|
||||||
dyna_var_asgn(lhs->nd_vid, val);
|
dyna_var_asgn(lhs->nd_vid, val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NODE_DASGN_PUSH:
|
||||||
|
push_dvar(lhs->nd_vid, val);
|
||||||
|
break;
|
||||||
|
|
||||||
case NODE_CASGN:
|
case NODE_CASGN:
|
||||||
rb_const_set(the_class, lhs->nd_vid, val);
|
rb_const_set(the_class, lhs->nd_vid, val);
|
||||||
break;
|
break;
|
||||||
|
@ -3604,7 +3625,7 @@ f_send(argc, argv, recv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef HAVE_STDARG_PROTOTYPES
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#define va_init_list(a,b) va_start(a,b)
|
#define va_init_list(a,b) va_start(a,b)
|
||||||
#else
|
#else
|
||||||
|
@ -4843,6 +4864,10 @@ f_binding(self)
|
||||||
data->prev = 0;
|
data->prev = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->d_vars && data->d_vars->id) {
|
||||||
|
push_dvar(0, 0);
|
||||||
|
data->d_vars = the_dyna_vars;
|
||||||
|
}
|
||||||
scope_dup(data->scope);
|
scope_dup(data->scope);
|
||||||
POP_BLOCK();
|
POP_BLOCK();
|
||||||
|
|
||||||
|
@ -4897,6 +4922,10 @@ proc_s_new(klass)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (data->d_vars && data->d_vars->id) {
|
||||||
|
push_dvar(0, 0);
|
||||||
|
data->d_vars = the_dyna_vars;
|
||||||
|
}
|
||||||
obj_call_init(proc);
|
obj_call_init(proc);
|
||||||
|
|
||||||
return proc;
|
return proc;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#option nodynamic
|
#option nodynamic
|
||||||
|
|
||||||
#GD
|
#GD
|
||||||
#curses
|
curses
|
||||||
#dbm
|
#dbm
|
||||||
#etc
|
#etc
|
||||||
#fcntl
|
#fcntl
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
if PLATFORM =~ /win32/i
|
case PLATFORM
|
||||||
$:.unshift '../..'
|
when /cygwin32/,/mingw32/
|
||||||
require 'rbconfig'
|
$CFLAGS = "-fno-defer-pop"
|
||||||
include Config
|
create_makefile("Win32API")
|
||||||
$CFLAGS = "-fno-defer-pop" if /gcc/ =~ CONFIG['CC']
|
when /win32/
|
||||||
create_makefile("Win32API")
|
create_makefile("Win32API")
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#! /usr/local/bin/ruby
|
#! /usr/local/bin/ruby
|
||||||
|
|
||||||
|
$".push 'mkmf.rb' #"
|
||||||
|
|
||||||
if ARGV[0] == 'static'
|
if ARGV[0] == 'static'
|
||||||
$force_static = TRUE
|
$force_static = TRUE
|
||||||
ARGV.shift
|
ARGV.shift
|
||||||
|
@ -379,7 +381,7 @@ def extmake(target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if $static
|
if $static
|
||||||
#$extlibs = " "
|
$extlibs = " "
|
||||||
$extlibs += " " + $LDFLAGS if $LDFLAGS
|
$extlibs += " " + $LDFLAGS if $LDFLAGS
|
||||||
$extlibs += " " + $local_libs if $local_libs
|
$extlibs += " " + $local_libs if $local_libs
|
||||||
$extlibs += " " + $libs if $libs
|
$extlibs += " " + $libs if $libs
|
||||||
|
@ -438,6 +440,8 @@ if $cache_mod
|
||||||
end
|
end
|
||||||
|
|
||||||
exit if $install or $clean
|
exit if $install or $clean
|
||||||
|
$extinit = " " unless $extinit
|
||||||
|
$extobjs = ""
|
||||||
if $extlist.size > 0
|
if $extlist.size > 0
|
||||||
for s,t in $extlist
|
for s,t in $extlist
|
||||||
#for s,t in $static_ext
|
#for s,t in $static_ext
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
socket.o : socket.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h $(hdrdir)/io.h $(hdrdir)/sig.h
|
socket.o : socket.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h
|
||||||
|
|
|
@ -120,8 +120,9 @@ ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
|
||||||
res = rb_rescue(rb_eval_string, (VALUE)argv[1], ip_eval_rescue, (VALUE)&failed);
|
res = rb_rescue(rb_eval_string, (VALUE)argv[1], ip_eval_rescue, (VALUE)&failed);
|
||||||
trap_immediate = old_trapflg;
|
trap_immediate = old_trapflg;
|
||||||
|
|
||||||
|
Tcl_ResetResult(interp);
|
||||||
if (failed) {
|
if (failed) {
|
||||||
Tcl_AppendResult(interp, RSTRING(failed)->ptr, (char*)NULL);
|
Tcl_AppendResult(interp, STR2CSTR(failed), (char*)NULL);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,12 +131,11 @@ ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
|
||||||
DUMP1("(rb_eval_string result) nil");
|
DUMP1("(rb_eval_string result) nil");
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
Check_Type(res, T_STRING);
|
|
||||||
|
|
||||||
/* copy result to the tcl interpreter */
|
/* copy result to the tcl interpreter */
|
||||||
DUMP2("(rb_eval_string result) %s", RSTRING(res)->ptr);
|
DUMP2("(rb_eval_string result) %s", STR2CSTR(res));
|
||||||
DUMP1("Tcl_AppendResult");
|
DUMP1("Tcl_AppendResult");
|
||||||
Tcl_AppendResult(interp, RSTRING(res)->ptr, (char *)NULL);
|
Tcl_AppendResult(interp, STR2CSTR(res), (char *)NULL);
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,7 @@ tk_eval_cmd(argc, argv)
|
||||||
VALUE cmd, rest;
|
VALUE cmd, rest;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "1*", &cmd, &rest);
|
rb_scan_args(argc, argv, "1*", &cmd, &rest);
|
||||||
rb_eval_cmd(cmd, rest);
|
return rb_eval_cmd(cmd, rest);
|
||||||
return Qnil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
7
file.c
7
file.c
|
@ -705,8 +705,15 @@ file_s_ftype(obj, fname)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
|
#if defined(MSDOS) || defined(NT)
|
||||||
if (rb_stat(fname, &st) < 0)
|
if (rb_stat(fname, &st) < 0)
|
||||||
|
rb_sys_fail(RSTRIN(fname)->ptr);
|
||||||
|
#else
|
||||||
|
Check_SafeStr(fname);
|
||||||
|
if (lstat(RSTRING(fname)->ptr, &st) == -1) {
|
||||||
rb_sys_fail(RSTRING(fname)->ptr);
|
rb_sys_fail(RSTRING(fname)->ptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (S_ISREG(st.st_mode)) {
|
if (S_ISREG(st.st_mode)) {
|
||||||
t = "file";
|
t = "file";
|
||||||
|
|
4
glob.c
4
glob.c
|
@ -111,6 +111,10 @@ extern void throw_to_top_level ();
|
||||||
extern int interrupt_state;
|
extern int interrupt_state;
|
||||||
#endif /* SHELL */
|
#endif /* SHELL */
|
||||||
|
|
||||||
|
#if defined(NT)
|
||||||
|
#include "missing/dir.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Global variable which controls whether or not * matches .*.
|
/* Global variable which controls whether or not * matches .*.
|
||||||
Non-zero means don't match .*. */
|
Non-zero means don't match .*. */
|
||||||
int noglob_dot_filenames = 1;
|
int noglob_dot_filenames = 1;
|
||||||
|
|
4
intern.h
4
intern.h
|
@ -103,8 +103,8 @@ VALUE dyna_var_asgn _((ID, VALUE));
|
||||||
void ruby_init _((void));
|
void ruby_init _((void));
|
||||||
void ruby_options _((int, char**));
|
void ruby_options _((int, char**));
|
||||||
void ruby_run _((void));
|
void ruby_run _((void));
|
||||||
void rb_eval_cmd _((VALUE, VALUE));
|
VALUE rb_eval_cmd _((VALUE, VALUE));
|
||||||
void rb_trap_eval _((VALUE, int));
|
VALUE rb_trap_eval _((VALUE, int));
|
||||||
int rb_respond_to _((VALUE, ID));
|
int rb_respond_to _((VALUE, ID));
|
||||||
void rb_raise _((VALUE));
|
void rb_raise _((VALUE));
|
||||||
void rb_fatal _((VALUE));
|
void rb_fatal _((VALUE));
|
||||||
|
|
10
io.c
10
io.c
|
@ -459,7 +459,11 @@ io_gets_method(argc, argv, io)
|
||||||
if (!NIL_P(rs)) Check_Type(rs, T_STRING);
|
if (!NIL_P(rs)) Check_Type(rs, T_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NIL_P(rs)) {
|
if (NIL_P(rs)) {
|
||||||
|
rsptr = 0;
|
||||||
|
rslen = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
rslen = RSTRING(rs)->len;
|
rslen = RSTRING(rs)->len;
|
||||||
if (rslen == 0) {
|
if (rslen == 0) {
|
||||||
rsptr = "\n\n";
|
rsptr = "\n\n";
|
||||||
|
@ -473,10 +477,6 @@ io_gets_method(argc, argv, io)
|
||||||
rsptr = RSTRING(rs)->ptr;
|
rsptr = RSTRING(rs)->ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
rsptr = 0;
|
|
||||||
rslen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
io_readable(fptr);
|
io_readable(fptr);
|
||||||
|
|
177
lib/tk.rb
177
lib/tk.rb
|
@ -54,6 +54,7 @@ module TkComm
|
||||||
return tk_tcl2ruby(str) unless idx
|
return tk_tcl2ruby(str) unless idx
|
||||||
|
|
||||||
list = tk_tcl2ruby(str[0,idx])
|
list = tk_tcl2ruby(str[0,idx])
|
||||||
|
list = [] if list == ""
|
||||||
str = str[idx+1..-1]
|
str = str[idx+1..-1]
|
||||||
i = -1
|
i = -1
|
||||||
brace = 1
|
brace = 1
|
||||||
|
@ -78,7 +79,6 @@ module TkComm
|
||||||
if keys and keys != None
|
if keys and keys != None
|
||||||
for k, v in keys
|
for k, v in keys
|
||||||
conf.push("-#{k}")
|
conf.push("-#{k}")
|
||||||
v = install_cmd(v) if v.kind_of? Proc
|
|
||||||
conf.push(v)
|
conf.push(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,6 +86,20 @@ module TkComm
|
||||||
end
|
end
|
||||||
private :hash_kv
|
private :hash_kv
|
||||||
|
|
||||||
|
def array2tk_list(ary)
|
||||||
|
ary.collect{|e|
|
||||||
|
if e.kind_of? Array
|
||||||
|
"{#{array2tk_list(e)}}"
|
||||||
|
elsif e.kind_of? Hash
|
||||||
|
"{#{e.to_a.collect{|ee| array2tk_list(ee)}.join(' ')}}"
|
||||||
|
else
|
||||||
|
s = _get_eval_string(e)
|
||||||
|
(s.index(/\s/))? "{#{s}}": s
|
||||||
|
end
|
||||||
|
}.join(" ")
|
||||||
|
end
|
||||||
|
private :array2tk_list
|
||||||
|
|
||||||
def bool(val)
|
def bool(val)
|
||||||
case val
|
case val
|
||||||
when "1", 1, 'yes', 'true'
|
when "1", 1, 'yes', 'true'
|
||||||
|
@ -221,8 +235,12 @@ module TkComm
|
||||||
end
|
end
|
||||||
|
|
||||||
def _bind(path, context, cmd, args=nil)
|
def _bind(path, context, cmd, args=nil)
|
||||||
|
context = context.join("><") if context.kind_of? Array
|
||||||
|
if /,/ =~ context
|
||||||
|
context = context.split(/\s*,\s*/).join("><")
|
||||||
|
end
|
||||||
|
id = install_bind(cmd, args)
|
||||||
begin
|
begin
|
||||||
id = install_bind(cmd, args)
|
|
||||||
tk_call 'bind', path, "<#{context}>", id
|
tk_call 'bind', path, "<#{context}>", id
|
||||||
rescue
|
rescue
|
||||||
uninstall_cmd(id)
|
uninstall_cmd(id)
|
||||||
|
@ -271,7 +289,7 @@ module TkCore
|
||||||
|
|
||||||
def TkCore.callback(arg)
|
def TkCore.callback(arg)
|
||||||
arg = Array(tk_split_list(arg))
|
arg = Array(tk_split_list(arg))
|
||||||
TkUtil.eval_cmd Tk_CMDTBL[arg.shift], *arg
|
_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
|
||||||
end
|
end
|
||||||
|
|
||||||
def mainloop
|
def mainloop
|
||||||
|
@ -282,6 +300,10 @@ module TkCore
|
||||||
return nil if str == None
|
return nil if str == None
|
||||||
if str.kind_of?(Hash)
|
if str.kind_of?(Hash)
|
||||||
str = hash_kv(str).join(" ")
|
str = hash_kv(str).join(" ")
|
||||||
|
elsif str.kind_of?(Array)
|
||||||
|
str = array2tk_list(str)
|
||||||
|
elsif str.kind_of?(Proc)
|
||||||
|
str = install_cmd(v)
|
||||||
elsif str == nil
|
elsif str == nil
|
||||||
str = ""
|
str = ""
|
||||||
elsif str == false
|
elsif str == false
|
||||||
|
@ -325,6 +347,9 @@ module Tk
|
||||||
include TkCore
|
include TkCore
|
||||||
extend Tk
|
extend Tk
|
||||||
|
|
||||||
|
TCL_VERSION = INTERP._invoke("info", "tclversion")
|
||||||
|
TK_VERSION = INTERP._invoke("set", "tk_version")
|
||||||
|
|
||||||
def root
|
def root
|
||||||
TkRoot.new
|
TkRoot.new
|
||||||
end
|
end
|
||||||
|
@ -448,8 +473,20 @@ class TkVariable
|
||||||
def initialize(val="")
|
def initialize(val="")
|
||||||
@id = Tk_VARIABLE_ID[0]
|
@id = Tk_VARIABLE_ID[0]
|
||||||
Tk_VARIABLE_ID[0] = Tk_VARIABLE_ID[0].succ
|
Tk_VARIABLE_ID[0] = Tk_VARIABLE_ID[0].succ
|
||||||
s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' #'
|
if val == []
|
||||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
|
||||||
|
@id, @id, @id))
|
||||||
|
elsif val.kind_of?(Array)
|
||||||
|
s = '"' + array2tk_list(val).gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
|
elsif val.kind_of?(Hash)
|
||||||
|
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||||
|
..gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
|
else
|
||||||
|
s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
|
@ -457,11 +494,50 @@ class TkVariable
|
||||||
end
|
end
|
||||||
|
|
||||||
def value
|
def value
|
||||||
INTERP._eval(format('global %s; set %s', @id, @id))
|
begin
|
||||||
|
INTERP._eval(format('global %s; set %s', @id, @id))
|
||||||
|
rescue
|
||||||
|
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
||||||
|
raise
|
||||||
|
else
|
||||||
|
INTERP._eval(format('global %s; array get %s', @id, @id))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def value=(val)
|
def value=(val)
|
||||||
INTERP._eval(format('global %s; set %s %s', @id, @id, _get_eval_string(val)))
|
begin
|
||||||
|
INTERP._eval(format('global %s; set %s %s', @id, @id, _get_eval_string(val)))
|
||||||
|
rescue
|
||||||
|
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
||||||
|
raise
|
||||||
|
else
|
||||||
|
INTERP._eval(format('global %s; unset %s'), @id, @id)
|
||||||
|
if val == []
|
||||||
|
INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
|
||||||
|
@id, @id, @id))
|
||||||
|
elsif val.kind_of?(Array)
|
||||||
|
s = '"' + array2tk_list(val).gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
|
elsif val.kind_of?(Hash)
|
||||||
|
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||||
|
.gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
|
else
|
||||||
|
raise
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def [](index)
|
||||||
|
INTERP._eval(format('global %s; set %s(%s)',
|
||||||
|
@id, @id, _get_eval_string(index)))
|
||||||
|
end
|
||||||
|
|
||||||
|
def []=(index,val)
|
||||||
|
INTERP._eval(format('global %s; set %s(%s) %s', @id, @id,
|
||||||
|
_get_eval_string(index), _get_eval_string(val)))
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_i
|
def to_i
|
||||||
|
@ -506,6 +582,16 @@ class TkVariable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TkVarAccess<TkVariable
|
||||||
|
def initialize(varname, val=nil)
|
||||||
|
@id = varname
|
||||||
|
if val
|
||||||
|
s = '"' + _get_eval_string(val).gsub(/[][$"]/, '\\\\\&') + '"' #'
|
||||||
|
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module TkSelection
|
module TkSelection
|
||||||
include Tk
|
include Tk
|
||||||
extend Tk
|
extend Tk
|
||||||
|
@ -577,49 +663,49 @@ module TkWinfo
|
||||||
def TkWinfo.depth(window)
|
def TkWinfo.depth(window)
|
||||||
number(tk_call('winfo', 'depth', window.path))
|
number(tk_call('winfo', 'depth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_depth(window)
|
def winfo_depth
|
||||||
TkWinfo.depth self
|
TkWinfo.depth self
|
||||||
end
|
end
|
||||||
def TkWinfo.exist?(window)
|
def TkWinfo.exist?(window)
|
||||||
bool(tk_call('winfo', 'exists', window.path))
|
bool(tk_call('winfo', 'exists', window.path))
|
||||||
end
|
end
|
||||||
def winfo_exist?(window)
|
def winfo_exist?
|
||||||
TkWinfo.exist? self
|
TkWinfo.exist? self
|
||||||
end
|
end
|
||||||
def TkWinfo.fpixels(window, number)
|
def TkWinfo.fpixels(window, number)
|
||||||
number(tk_call('winfo', 'fpixels', window.path, number))
|
number(tk_call('winfo', 'fpixels', window.path, number))
|
||||||
end
|
end
|
||||||
def winfo_fpixels(window, number)
|
def winfo_fpixels(number)
|
||||||
TkWinfo.fpixels self
|
TkWinfo.fpixels self
|
||||||
end
|
end
|
||||||
def TkWinfo.geometry(window)
|
def TkWinfo.geometry(window)
|
||||||
list(tk_call('winfo', 'geometry', window.path))
|
list(tk_call('winfo', 'geometry', window.path))
|
||||||
end
|
end
|
||||||
def winfo_geometry(window)
|
def winfo_geometry
|
||||||
TkWinfo.geometry self
|
TkWinfo.geometry self
|
||||||
end
|
end
|
||||||
def TkWinfo.height(window)
|
def TkWinfo.height(window)
|
||||||
number(tk_call('winfo', 'height', window.path))
|
number(tk_call('winfo', 'height', window.path))
|
||||||
end
|
end
|
||||||
def winfo_height(window)
|
def winfo_height
|
||||||
TkWinfo.height self
|
TkWinfo.height self
|
||||||
end
|
end
|
||||||
def TkWinfo.id(window)
|
def TkWinfo.id(window)
|
||||||
number(tk_call('winfo', 'id', window.path))
|
number(tk_call('winfo', 'id', window.path))
|
||||||
end
|
end
|
||||||
def winfo_id(window)
|
def winfo_id
|
||||||
TkWinfo.id self
|
TkWinfo.id self
|
||||||
end
|
end
|
||||||
def TkWinfo.mapped?(window)
|
def TkWinfo.mapped?(window)
|
||||||
bool(tk_call('winfo', 'ismapped', window.path))
|
bool(tk_call('winfo', 'ismapped', window.path))
|
||||||
end
|
end
|
||||||
def winfo_mapped?(window)
|
def winfo_mapped?
|
||||||
TkWinfo.mapped? self
|
TkWinfo.mapped? self
|
||||||
end
|
end
|
||||||
def TkWinfo.parent(window)
|
def TkWinfo.parent(window)
|
||||||
window(tk_call('winfo', 'parent', window.path))
|
window(tk_call('winfo', 'parent', window.path))
|
||||||
end
|
end
|
||||||
def winfo_parent(window)
|
def winfo_parent
|
||||||
TkWinfo.parent self
|
TkWinfo.parent self
|
||||||
end
|
end
|
||||||
def TkWinfo.widget(id)
|
def TkWinfo.widget(id)
|
||||||
|
@ -631,139 +717,139 @@ module TkWinfo
|
||||||
def TkWinfo.pixels(window, number)
|
def TkWinfo.pixels(window, number)
|
||||||
number(tk_call('winfo', 'pixels', window.path, number))
|
number(tk_call('winfo', 'pixels', window.path, number))
|
||||||
end
|
end
|
||||||
def winfo_pixels(window, number)
|
def winfo_pixels(number)
|
||||||
TkWinfo.pixels self, number
|
TkWinfo.pixels self, number
|
||||||
end
|
end
|
||||||
def TkWinfo.reqheight(window)
|
def TkWinfo.reqheight(window)
|
||||||
number(tk_call('winfo', 'reqheight', window.path))
|
number(tk_call('winfo', 'reqheight', window.path))
|
||||||
end
|
end
|
||||||
def winfo_reqheight(window)
|
def winfo_reqheight
|
||||||
TkWinfo.reqheight self
|
TkWinfo.reqheight self
|
||||||
end
|
end
|
||||||
def TkWinfo.reqwidth(window)
|
def TkWinfo.reqwidth(window)
|
||||||
number(tk_call('winfo', 'reqwidth', window.path))
|
number(tk_call('winfo', 'reqwidth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_reqwidth(window)
|
def winfo_reqwidth
|
||||||
TkWinfo.reqwidth self
|
TkWinfo.reqwidth self
|
||||||
end
|
end
|
||||||
def TkWinfo.rgb(window, color)
|
def TkWinfo.rgb(window, color)
|
||||||
list(tk_call('winfo', 'rgb', window.path, color))
|
list(tk_call('winfo', 'rgb', window.path, color))
|
||||||
end
|
end
|
||||||
def winfo_rgb(window, color)
|
def winfo_rgb(color)
|
||||||
TkWinfo.rgb self, color
|
TkWinfo.rgb self, color
|
||||||
end
|
end
|
||||||
def TkWinfo.rootx(window)
|
def TkWinfo.rootx(window)
|
||||||
number(tk_call('winfo', 'rootx', window.path))
|
number(tk_call('winfo', 'rootx', window.path))
|
||||||
end
|
end
|
||||||
def winfo_rootx(window)
|
def winfo_rootx
|
||||||
TkWinfo.rootx self
|
TkWinfo.rootx self
|
||||||
end
|
end
|
||||||
def TkWinfo.rooty(window)
|
def TkWinfo.rooty(window)
|
||||||
number(tk_call('winfo', 'rooty', window.path))
|
number(tk_call('winfo', 'rooty', window.path))
|
||||||
end
|
end
|
||||||
def winfo_rooty(window)
|
def winfo_rooty
|
||||||
TkWinfo.rooty self
|
TkWinfo.rooty self
|
||||||
end
|
end
|
||||||
def TkWinfo.screen(window)
|
def TkWinfo.screen(window)
|
||||||
tk_call 'winfo', 'screen', window.path
|
tk_call 'winfo', 'screen', window.path
|
||||||
end
|
end
|
||||||
def winfo_screen(window)
|
def winfo_screen
|
||||||
TkWinfo.screen self
|
TkWinfo.screen self
|
||||||
end
|
end
|
||||||
def TkWinfo.screencells(window)
|
def TkWinfo.screencells(window)
|
||||||
number(tk_call('winfo', 'screencells', window.path))
|
number(tk_call('winfo', 'screencells', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screencells(window)
|
def winfo_screencells
|
||||||
TkWinfo.screencells self
|
TkWinfo.screencells self
|
||||||
end
|
end
|
||||||
def TkWinfo.screendepth(window)
|
def TkWinfo.screendepth(window)
|
||||||
number(tk_call('winfo', 'screendepth', window.path))
|
number(tk_call('winfo', 'screendepth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screendepth(window)
|
def winfo_screendepth
|
||||||
TkWinfo.screendepth self
|
TkWinfo.screendepth self
|
||||||
end
|
end
|
||||||
def TkWinfo.screenheight (window)
|
def TkWinfo.screenheight (window)
|
||||||
number(tk_call('winfo', 'screenheight', window.path))
|
number(tk_call('winfo', 'screenheight', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screenheight(window)
|
def winfo_screenheight
|
||||||
TkWinfo.screenheight self
|
TkWinfo.screenheight self
|
||||||
end
|
end
|
||||||
def TkWinfo.screenmmheight(window)
|
def TkWinfo.screenmmheight(window)
|
||||||
number(tk_call('winfo', 'screenmmheight', window.path))
|
number(tk_call('winfo', 'screenmmheight', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screenmmheight(window)
|
def winfo_screenmmheight
|
||||||
TkWinfo.screenmmheight self
|
TkWinfo.screenmmheight self
|
||||||
end
|
end
|
||||||
def TkWinfo.screenmmwidth(window)
|
def TkWinfo.screenmmwidth(window)
|
||||||
number(tk_call('winfo', 'screenmmwidth', window.path))
|
number(tk_call('winfo', 'screenmmwidth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screenmmwidth(window)
|
def winfo_screenmmwidth
|
||||||
TkWinfo.screenmmwidth self
|
TkWinfo.screenmmwidth self
|
||||||
end
|
end
|
||||||
def TkWinfo.screenvisual(window)
|
def TkWinfo.screenvisual(window)
|
||||||
tk_call 'winfo', 'screenvisual', window.path
|
tk_call 'winfo', 'screenvisual', window.path
|
||||||
end
|
end
|
||||||
def winfo_screenvisual(window)
|
def winfo_screenvisual
|
||||||
TkWinfo.screenvisual self
|
TkWinfo.screenvisual self
|
||||||
end
|
end
|
||||||
def TkWinfo.screenwidth(window)
|
def TkWinfo.screenwidth(window)
|
||||||
number(tk_call('winfo', 'screenwidth', window.path))
|
number(tk_call('winfo', 'screenwidth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_screenwidth(window)
|
def winfo_screenwidth
|
||||||
TkWinfo.screenwidth self
|
TkWinfo.screenwidth self
|
||||||
end
|
end
|
||||||
def TkWinfo.toplevel(window)
|
def TkWinfo.toplevel(window)
|
||||||
window(tk_call('winfo', 'toplevel', window.path))
|
window(tk_call('winfo', 'toplevel', window.path))
|
||||||
end
|
end
|
||||||
def winfo_toplevel(window)
|
def winfo_toplevel
|
||||||
TkWinfo.toplevel self
|
TkWinfo.toplevel self
|
||||||
end
|
end
|
||||||
def TkWinfo.visual(window)
|
def TkWinfo.visual(window)
|
||||||
tk_call 'winfo', 'visual', window.path
|
tk_call 'winfo', 'visual', window.path
|
||||||
end
|
end
|
||||||
def winfo_visual(window)
|
def winfo_visual
|
||||||
TkWinfo.visual self
|
TkWinfo.visual self
|
||||||
end
|
end
|
||||||
def TkWinfo.vrootheigh(window)
|
def TkWinfo.vrootheigh(window)
|
||||||
number(tk_call('winfo', 'vrootheight', window.path))
|
number(tk_call('winfo', 'vrootheight', window.path))
|
||||||
end
|
end
|
||||||
def winfo_vrootheight(window)
|
def winfo_vrootheight
|
||||||
TkWinfo.vrootheight self
|
TkWinfo.vrootheight self
|
||||||
end
|
end
|
||||||
def TkWinfo.vrootwidth(window)
|
def TkWinfo.vrootwidth(window)
|
||||||
number(tk_call('winfo', 'vrootwidth', window.path))
|
number(tk_call('winfo', 'vrootwidth', window.path))
|
||||||
end
|
end
|
||||||
def winfo_vrootwidth(window)
|
def winfo_vrootwidth
|
||||||
TkWinfo.vrootwidth self
|
TkWinfo.vrootwidth self
|
||||||
end
|
end
|
||||||
def TkWinfo.vrootx(window)
|
def TkWinfo.vrootx(window)
|
||||||
number(tk_call('winfo', 'vrootx', window.path))
|
number(tk_call('winfo', 'vrootx', window.path))
|
||||||
end
|
end
|
||||||
def winfo_vrootx(window)
|
def winfo_vrootx
|
||||||
TkWinfo.vrootx self
|
TkWinfo.vrootx self
|
||||||
end
|
end
|
||||||
def TkWinfo.vrooty(window)
|
def TkWinfo.vrooty(window)
|
||||||
number(tk_call('winfo', 'vrooty', window.path))
|
number(tk_call('winfo', 'vrooty', window.path))
|
||||||
end
|
end
|
||||||
def winfo_vrooty(window)
|
def winfo_vrooty
|
||||||
TkWinfo.vrooty self
|
TkWinfo.vrooty self
|
||||||
end
|
end
|
||||||
def TkWinfo.width(window)
|
def TkWinfo.width(window)
|
||||||
number(tk_call('winfo', 'width', window.path))
|
number(tk_call('winfo', 'width', window.path))
|
||||||
end
|
end
|
||||||
def winfo_width(window)
|
def winfo_width
|
||||||
TkWinfo.width self
|
TkWinfo.width self
|
||||||
end
|
end
|
||||||
def TkWinfo.x(window)
|
def TkWinfo.x(window)
|
||||||
number(tk_call('winfo', 'x', window.path))
|
number(tk_call('winfo', 'x', window.path))
|
||||||
end
|
end
|
||||||
def winfo_x(window)
|
def winfo_x
|
||||||
TkWinfo.x self
|
TkWinfo.x self
|
||||||
end
|
end
|
||||||
def TkWinfo.y(window)
|
def TkWinfo.y(window)
|
||||||
number(tk_call('winfo', 'y', window.path))
|
number(tk_call('winfo', 'y', window.path))
|
||||||
end
|
end
|
||||||
def winfo_y(window)
|
def winfo_y
|
||||||
TkWinfo.y self
|
TkWinfo.y self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -804,7 +890,7 @@ module TkGrid
|
||||||
if args[-1].kind_of?(Hash)
|
if args[-1].kind_of?(Hash)
|
||||||
keys = args.pop
|
keys = args.pop
|
||||||
end
|
end
|
||||||
wins = [widget.path]
|
wins = [widget.epath]
|
||||||
for i in args
|
for i in args
|
||||||
wins.push i.epath
|
wins.push i.epath
|
||||||
end
|
end
|
||||||
|
@ -928,6 +1014,19 @@ class TkObject<TkKernel
|
||||||
configure slot, install_cmd(value)
|
configure slot, install_cmd(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def configinfo(slot = nil)
|
||||||
|
if slot
|
||||||
|
conf = tk_split_list(tk_send('configure', "-#{slot}") )
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
else
|
||||||
|
tk_split_list(tk_send('configure') ).collect{|conf|
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def bind(context, cmd=Proc.new, args=nil)
|
def bind(context, cmd=Proc.new, args=nil)
|
||||||
_bind path, context, cmd, args
|
_bind path, context, cmd, args
|
||||||
end
|
end
|
||||||
|
|
46
lib/tkpalette.rb
Normal file
46
lib/tkpalette.rb
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#
|
||||||
|
# tkpalette.rb : methods for Tcl/Tk standard library 'palette.tcl'
|
||||||
|
# 1998/06/18 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
|
||||||
|
#
|
||||||
|
module TkPalette
|
||||||
|
include Tk
|
||||||
|
extend Tk
|
||||||
|
|
||||||
|
def TkPalette.set(*args)
|
||||||
|
args = args.to_a.flatten if args.kind_of? Hash
|
||||||
|
tk_call 'tk_setPalette', *args
|
||||||
|
end
|
||||||
|
def TkPalette.setPalette(*args)
|
||||||
|
TkPalette.set(*args)
|
||||||
|
end
|
||||||
|
|
||||||
|
def TkPalette.bisque
|
||||||
|
tk_call 'tk_bisque'
|
||||||
|
end
|
||||||
|
|
||||||
|
def TkPalette.darken(color, percent)
|
||||||
|
tk_call 'tkDarken', color, percent
|
||||||
|
end
|
||||||
|
|
||||||
|
def TkPalette.recolorTree(window, colors)
|
||||||
|
if not colors.kind_of?(Hash)
|
||||||
|
fail "2nd arg need to be Hash"
|
||||||
|
end
|
||||||
|
|
||||||
|
colors.each{|key, value|
|
||||||
|
begin
|
||||||
|
if window.cget(key) == tk_call('set', "tkPalette(#{key})")
|
||||||
|
window[key] = colors[key]
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
# ignore
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
TkWinfo.children(window).each{|w| TkPalette.recolorTree(w, colors)}
|
||||||
|
end
|
||||||
|
|
||||||
|
def recolorTree(colors)
|
||||||
|
TkPalette.recolorTree(self, colors)
|
||||||
|
end
|
||||||
|
end
|
270
lib/tktext.rb
270
lib/tktext.rb
|
@ -45,6 +45,26 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
def image_names
|
||||||
|
tk_send('image', 'names').collect{|elt|
|
||||||
|
if not @tags[elt]
|
||||||
|
elt
|
||||||
|
else
|
||||||
|
@tags[elt]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_insert(index)
|
||||||
|
tk_send 'mark', 'set', 'insert', index
|
||||||
|
end
|
||||||
|
def set_current(index)
|
||||||
|
tk_send 'mark', 'set', 'current', index
|
||||||
|
end
|
||||||
|
|
||||||
|
def insert(index, chars, *tags)
|
||||||
|
super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@tags.each_value do |t|
|
@tags.each_value do |t|
|
||||||
|
@ -68,6 +88,15 @@ class TkText<TkTextWin
|
||||||
tk_send 'debug', boolean
|
tk_send 'debug', boolean
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bbox(index)
|
||||||
|
inf = tk_send('bbox', index)
|
||||||
|
(inf == "")? [0,0,0,0]: inf
|
||||||
|
end
|
||||||
|
def dlineinfo(index)
|
||||||
|
inf = tk_send('dlineinfo', index)
|
||||||
|
(inf == "")? [0,0,0,0,0]: inf
|
||||||
|
end
|
||||||
|
|
||||||
def yview(*what)
|
def yview(*what)
|
||||||
tk_send 'yview', *what
|
tk_send 'yview', *what
|
||||||
end
|
end
|
||||||
|
@ -107,18 +136,69 @@ class TkTextTag<TkObject
|
||||||
tk_call @t.path, 'tag', 'remove', @id, *index
|
tk_call @t.path, 'tag', 'remove', @id, *index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ranges
|
||||||
|
l = tk_split_list(tk_call(@t.path, 'tag', 'ranges', @id))
|
||||||
|
r = []
|
||||||
|
while key=l.shift
|
||||||
|
r.push [key, l.shift]
|
||||||
|
end
|
||||||
|
r
|
||||||
|
end
|
||||||
|
|
||||||
|
def nextrange(first, last=nil)
|
||||||
|
l = tk_split_list(tk_call(@t.path, 'tag', 'nextrange', @id, first, last))
|
||||||
|
r = []
|
||||||
|
while key=l.shift
|
||||||
|
r.push [key, l.shift]
|
||||||
|
end
|
||||||
|
r
|
||||||
|
end
|
||||||
|
|
||||||
|
def prevrange(first, last=nil)
|
||||||
|
l = tk_split_list(tk_call(@t.path, 'tag', 'prevrange', @id, first, last))
|
||||||
|
r = []
|
||||||
|
while key=l.shift
|
||||||
|
r.push [key, l.shift]
|
||||||
|
end
|
||||||
|
r
|
||||||
|
end
|
||||||
|
|
||||||
|
def [](key)
|
||||||
|
cget key
|
||||||
|
end
|
||||||
|
|
||||||
|
def []=(key,val)
|
||||||
|
configure key, val
|
||||||
|
end
|
||||||
|
|
||||||
|
def cget(key)
|
||||||
|
tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
|
||||||
|
end
|
||||||
|
|
||||||
def configure(keys)
|
def configure(keys)
|
||||||
tk_call @t.path, 'tag', 'configure', @id, *hash_kv(keys)
|
tk_call @t.path, 'tag', 'configure', @id, *hash_kv(keys)
|
||||||
end
|
end
|
||||||
|
# def configure(key, value)
|
||||||
|
# if value == FALSE
|
||||||
|
# value = "0"
|
||||||
|
# elsif value.kind_of? Proc
|
||||||
|
# value = install_cmd(value)
|
||||||
|
# end
|
||||||
|
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
|
||||||
|
# end
|
||||||
|
|
||||||
def bind(seq, cmd=Proc.new, args=nil)
|
def bind(seq, cmd=Proc.new, args=nil)
|
||||||
id = install_bind(cmd, args)
|
id = install_bind(cmd, args)
|
||||||
tk_call @t, 'tag', 'bind', @id, "<#{seq}>", id
|
tk_call @t.path, 'tag', 'bind', @id, "<#{seq}>", id
|
||||||
@t._addcmd cmd
|
@t._addcmd cmd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def raise(above=None)
|
||||||
|
tk_call @t.path, 'tag', 'raise', @id, above
|
||||||
|
end
|
||||||
|
|
||||||
def lower(below=None)
|
def lower(below=None)
|
||||||
tk_call @t.path, 'tag', 'lower', below
|
tk_call @t.path, 'tag', 'lower', @id, below
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -126,6 +206,18 @@ class TkTextTag<TkObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TkTextTagSel<TkTextTag
|
||||||
|
def initialize(parent, keys=nil)
|
||||||
|
if not parent.kind_of?(TkText)
|
||||||
|
fail format("%s need to be TkText", parent.inspect)
|
||||||
|
end
|
||||||
|
@t = parent
|
||||||
|
@path = @id = 'sel'
|
||||||
|
tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
|
||||||
|
@t._addtag id, self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class TkTextMark<TkObject
|
class TkTextMark<TkObject
|
||||||
$tk_text_mark = 'mark0000'
|
$tk_text_mark = 'mark0000'
|
||||||
def initialize(parent, index)
|
def initialize(parent, index)
|
||||||
|
@ -150,19 +242,183 @@ class TkTextMark<TkObject
|
||||||
tk_call @t.path, 'mark', 'unset', @id
|
tk_call @t.path, 'mark', 'unset', @id
|
||||||
end
|
end
|
||||||
alias destroy unset
|
alias destroy unset
|
||||||
|
|
||||||
|
def gravity
|
||||||
|
tk_call @t.path, 'mark', 'gravity', @id
|
||||||
|
end
|
||||||
|
|
||||||
|
def gravity=(direction)
|
||||||
|
tk_call @t.path, 'mark', 'gravity', @id, direction
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextWindow<TkObject
|
class TkTextMarkInsert<TkTextMark
|
||||||
def initialize(parent, index, *args)
|
def initialize(parent, index=nil)
|
||||||
if not parent.kind_of?(TkText)
|
if not parent.kind_of?(TkText)
|
||||||
fail format("%s need to be TkText", parent.inspect)
|
fail format("%s need to be TkText", parent.inspect)
|
||||||
end
|
end
|
||||||
@t = parent
|
@t = parent
|
||||||
@path = @index = index
|
@path = @id = 'insert'
|
||||||
tk_call @t.path, 'window', 'create', index, *args
|
tk_call @t.path, 'mark', 'set', @id, index if index
|
||||||
|
@t._addtag id, self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class TkTextMarkCurrent<TkTextMark
|
||||||
|
def initialize(parent,index=nil)
|
||||||
|
if not parent.kind_of?(TkText)
|
||||||
|
fail format("%s need to be TkText", parent.inspect)
|
||||||
|
end
|
||||||
|
@t = parent
|
||||||
|
@path = @id = 'current'
|
||||||
|
tk_call @t.path, 'mark', 'set', @id, index if index
|
||||||
|
@t._addtag id, self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class TkTextWindow<TkObject
|
||||||
|
def initialize(parent, index, keys)
|
||||||
|
if not parent.kind_of?(TkText)
|
||||||
|
fail format("%s need to be TkText", parent.inspect)
|
||||||
|
end
|
||||||
|
@t = parent
|
||||||
|
if index == 'end'
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars'))
|
||||||
|
elsif index.kind_of? TkTextMark
|
||||||
|
if tk_call(@t.path,'index',index.path) == tk_call(@t.path,'index','end')
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars'))
|
||||||
|
else
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', index.path))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', index))
|
||||||
|
end
|
||||||
|
@path.gravity = 'left'
|
||||||
|
@index = @path.path
|
||||||
|
@id = keys['window']
|
||||||
|
if keys['create']
|
||||||
|
@p_create = keys['create']
|
||||||
|
if @p_create.kind_of? Proc
|
||||||
|
keys['create'] = install_cmd(proc{@id = @p_create.call; @id.path})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tk_call @t.path, 'window', 'create', @index, *hash_kv(keys)
|
||||||
|
end
|
||||||
|
|
||||||
|
def [](slot)
|
||||||
|
cget(slot)
|
||||||
|
end
|
||||||
|
def []=(slot, value)
|
||||||
|
configure(slot, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
def cget(slot)
|
||||||
|
tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure(slot, value)
|
def configure(slot, value)
|
||||||
tk_call @t.path, 'window', 'configure', @index, "-#{slot}", value
|
@id = value if slot == 'window'
|
||||||
|
if slot == 'create'
|
||||||
|
self.create=value
|
||||||
|
else
|
||||||
|
tk_call @t.path, 'window', 'configure', @index, "-#{slot}", value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def window
|
||||||
|
@id
|
||||||
|
end
|
||||||
|
|
||||||
|
def window=(value)
|
||||||
|
tk_call @t.path, 'window', 'configure', @index, '-window', value
|
||||||
|
@id = value
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@p_create
|
||||||
|
end
|
||||||
|
|
||||||
|
def create=(value)
|
||||||
|
@p_create = value
|
||||||
|
if @p_create.kind_of? Proc
|
||||||
|
value = install_cmd(proc{@id = @p_create.call})
|
||||||
|
end
|
||||||
|
tk_call @t.path, 'window', 'configure', @index, '-create', value
|
||||||
|
end
|
||||||
|
|
||||||
|
def configinfo(slot = nil)
|
||||||
|
if slot
|
||||||
|
conf = tk_split_list(tk_call @t.path, 'window', 'configure',
|
||||||
|
@index, "-#{slot}")
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
else
|
||||||
|
tk_split_list(tk_call @t.path, 'window', 'configure',
|
||||||
|
@index).collect{|conf|
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class TkTextImage<TkObject
|
||||||
|
def initialize(parent, index, keys)
|
||||||
|
if not parent.kind_of?(TkText)
|
||||||
|
fail format("%s need to be TkText", parent.inspect)
|
||||||
|
end
|
||||||
|
@t = parent
|
||||||
|
if index == 'end'
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars'))
|
||||||
|
elsif index.kind_of? TkTextMark
|
||||||
|
if tk_call(@t.path,'index',index.path) == tk_call(@t.path,'index','end')
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars'))
|
||||||
|
else
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', index.path))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', index))
|
||||||
|
end
|
||||||
|
@path.gravity = 'left'
|
||||||
|
@index = @path.path
|
||||||
|
@id = tk_call(@t.path, 'image', 'create', @index, *hash_kv(keys))
|
||||||
|
end
|
||||||
|
|
||||||
|
def [](slot)
|
||||||
|
cget(slot)
|
||||||
|
end
|
||||||
|
def []=(slot, value)
|
||||||
|
configure(slot, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
def cget(slot)
|
||||||
|
tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def configure(slot, value)
|
||||||
|
tk_call @t.path, 'image', 'configure', @index, "-#{slot}", value
|
||||||
|
end
|
||||||
|
|
||||||
|
def image
|
||||||
|
tk_call @t.path, 'image', 'configure', @index, '-image'
|
||||||
|
end
|
||||||
|
|
||||||
|
def image=(value)
|
||||||
|
tk_call @t.path, 'image', 'configure', @index, '-image', value
|
||||||
|
end
|
||||||
|
|
||||||
|
def configinfo(slot = nil)
|
||||||
|
if slot
|
||||||
|
conf = tk_split_list(tk_call @t.path, 'image', 'configure',
|
||||||
|
@index, "-#{slot}")
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
else
|
||||||
|
tk_split_list(tk_call @t.path, 'image', 'configure',
|
||||||
|
@index).collect{|conf|
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
16
missing/nt.h
16
missing/nt.h
|
@ -230,20 +230,8 @@ extern char *mystrerror(int);
|
||||||
#define pclose mypclose
|
#define pclose mypclose
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef va_start
|
/* #undef va_start */
|
||||||
#undef va_end
|
/* #undef va_end */
|
||||||
|
|
||||||
#ifdef popen
|
|
||||||
#undef popen
|
|
||||||
#define popen mypopen
|
|
||||||
#endif
|
|
||||||
#ifdef pclose
|
|
||||||
#undef pclose
|
|
||||||
#define pclose mypclose
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef va_start
|
|
||||||
#undef va_end
|
|
||||||
|
|
||||||
#ifdef fdopen
|
#ifdef fdopen
|
||||||
#undef fdopen
|
#undef fdopen
|
||||||
|
|
2
node.h
2
node.h
|
@ -41,6 +41,7 @@ enum node_type {
|
||||||
NODE_MASGN,
|
NODE_MASGN,
|
||||||
NODE_LASGN,
|
NODE_LASGN,
|
||||||
NODE_DASGN,
|
NODE_DASGN,
|
||||||
|
NODE_DASGN_PUSH,
|
||||||
NODE_GASGN,
|
NODE_GASGN,
|
||||||
NODE_IASGN,
|
NODE_IASGN,
|
||||||
NODE_CASGN,
|
NODE_CASGN,
|
||||||
|
@ -250,6 +251,7 @@ typedef struct RNode {
|
||||||
#define NEW_GASGN(v,val) node_newnode(NODE_GASGN,v,val,rb_global_entry(v))
|
#define NEW_GASGN(v,val) node_newnode(NODE_GASGN,v,val,rb_global_entry(v))
|
||||||
#define NEW_LASGN(v,val) node_newnode(NODE_LASGN,v,val,local_cnt(v))
|
#define NEW_LASGN(v,val) node_newnode(NODE_LASGN,v,val,local_cnt(v))
|
||||||
#define NEW_DASGN(v,val) node_newnode(NODE_DASGN,v,val,0);
|
#define NEW_DASGN(v,val) node_newnode(NODE_DASGN,v,val,0);
|
||||||
|
#define NEW_DASGN_PUSH(v,val) node_newnode(NODE_DASGN_PUSH,v,val,0);
|
||||||
#define NEW_IASGN(v,val) node_newnode(NODE_IASGN,v,val,0)
|
#define NEW_IASGN(v,val) node_newnode(NODE_IASGN,v,val,0)
|
||||||
#define NEW_CASGN(v,val) node_newnode(NODE_CASGN,v,val,0)
|
#define NEW_CASGN(v,val) node_newnode(NODE_CASGN,v,val,0)
|
||||||
#define NEW_OP_ASGN1(p,id,a) node_newnode(NODE_OP_ASGN1,p,id,a)
|
#define NEW_OP_ASGN1(p,id,a) node_newnode(NODE_OP_ASGN1,p,id,a)
|
||||||
|
|
49
numeric.c
49
numeric.c
|
@ -573,6 +573,51 @@ flo_to_i(num)
|
||||||
return INT2FIX(val);
|
return INT2FIX(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
flo_floor(num)
|
||||||
|
VALUE num;
|
||||||
|
{
|
||||||
|
double f = floor(RFLOAT(num)->value);
|
||||||
|
long val;
|
||||||
|
|
||||||
|
if (!FIXABLE(f)) {
|
||||||
|
return dbl2big(f);
|
||||||
|
}
|
||||||
|
val = f;
|
||||||
|
return INT2FIX(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
flo_ceil(num)
|
||||||
|
VALUE num;
|
||||||
|
{
|
||||||
|
double f = ceil(RFLOAT(num)->value);
|
||||||
|
long val;
|
||||||
|
|
||||||
|
if (!FIXABLE(f)) {
|
||||||
|
return dbl2big(f);
|
||||||
|
}
|
||||||
|
val = f;
|
||||||
|
return INT2FIX(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
flo_round(num)
|
||||||
|
VALUE num;
|
||||||
|
{
|
||||||
|
double f = RFLOAT(num)->value;
|
||||||
|
long val;
|
||||||
|
|
||||||
|
if (f > 0.0) f = floor(f+0.5);
|
||||||
|
if (f < 0.0) f = ceil(f-0.5);
|
||||||
|
|
||||||
|
if (!FIXABLE(f)) {
|
||||||
|
return dbl2big(f);
|
||||||
|
}
|
||||||
|
val = f;
|
||||||
|
return INT2FIX(val);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
flo_to_f(num)
|
flo_to_f(num)
|
||||||
VALUE num;
|
VALUE num;
|
||||||
|
@ -1410,4 +1455,8 @@ Init_Numeric()
|
||||||
rb_define_method(cFloat, "to_f", flo_to_f, 0);
|
rb_define_method(cFloat, "to_f", flo_to_f, 0);
|
||||||
rb_define_method(cFloat, "abs", flo_abs, 0);
|
rb_define_method(cFloat, "abs", flo_abs, 0);
|
||||||
rb_define_method(cFloat, "zero?", flo_zero_p, 0);
|
rb_define_method(cFloat, "zero?", flo_zero_p, 0);
|
||||||
|
|
||||||
|
rb_define_method(cFloat, "floor", flo_floor, 0);
|
||||||
|
rb_define_method(cFloat, "ceil", flo_ceil, 0);
|
||||||
|
rb_define_method(cFloat, "round", flo_round, 0);
|
||||||
}
|
}
|
||||||
|
|
7
parse.y
7
parse.y
|
@ -3379,8 +3379,8 @@ gettable(id)
|
||||||
return NEW_LIT(INT2FIX(sourceline));
|
return NEW_LIT(INT2FIX(sourceline));
|
||||||
}
|
}
|
||||||
else if (is_local_id(id)) {
|
else if (is_local_id(id)) {
|
||||||
if (local_id(id)) return NEW_LVAR(id);
|
|
||||||
if (dyna_var_defined(id)) return NEW_DVAR(id);
|
if (dyna_var_defined(id)) return NEW_DVAR(id);
|
||||||
|
if (local_id(id)) return NEW_LVAR(id);
|
||||||
/* method call without arguments */
|
/* method call without arguments */
|
||||||
return NEW_VCALL(id);
|
return NEW_VCALL(id);
|
||||||
}
|
}
|
||||||
|
@ -3429,8 +3429,11 @@ assignable(id, val)
|
||||||
else{
|
else{
|
||||||
if (!dyna_var_defined(id)) {
|
if (!dyna_var_defined(id)) {
|
||||||
dyna_var_asgn(id, 0);
|
dyna_var_asgn(id, 0);
|
||||||
|
lhs = NEW_DASGN_PUSH(id, val);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lhs = NEW_DASGN(id, val);
|
||||||
}
|
}
|
||||||
lhs = NEW_DASGN(id, val);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_global_id(id)) {
|
else if (is_global_id(id)) {
|
||||||
|
|
3
regex.c
3
regex.c
|
@ -2971,6 +2971,9 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
regstart[mcnt] = regend[mcnt]
|
regstart[mcnt] = regend[mcnt]
|
||||||
= old_regstart[mcnt] = old_regend[mcnt]
|
= old_regstart[mcnt] = old_regend[mcnt]
|
||||||
= best_regstart[mcnt] = best_regend[mcnt] = REG_UNSET_VALUE;
|
= best_regstart[mcnt] = best_regend[mcnt] = REG_UNSET_VALUE;
|
||||||
|
#ifdef __CHECKER__
|
||||||
|
reg_info[mcnt].word = 0;
|
||||||
|
#endif
|
||||||
REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
|
REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
|
||||||
IS_ACTIVE (reg_info[mcnt]) = 0;
|
IS_ACTIVE (reg_info[mcnt]) = 0;
|
||||||
MATCHED_SOMETHING (reg_info[mcnt]) = 0;
|
MATCHED_SOMETHING (reg_info[mcnt]) = 0;
|
||||||
|
|
|
@ -749,6 +749,13 @@ x = proc{proc{}}.call
|
||||||
eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
|
eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
|
||||||
ok($x[4].call == 8)
|
ok($x[4].call == 8)
|
||||||
|
|
||||||
|
proc {
|
||||||
|
p = proc{}
|
||||||
|
foo = 1
|
||||||
|
eval "foo = 10", p
|
||||||
|
ok(eval("foo", p) == eval("foo"))
|
||||||
|
}.call
|
||||||
|
|
||||||
check "system"
|
check "system"
|
||||||
ok(`echo foobar` == "foobar\n")
|
ok(`echo foobar` == "foobar\n")
|
||||||
ok(`./ruby -e 'print "foobar"'` == 'foobar')
|
ok(`./ruby -e 'print "foobar"'` == 'foobar')
|
||||||
|
|
9
util.c
9
util.c
|
@ -15,6 +15,10 @@
|
||||||
#define RUBY_NO_INLINE
|
#define RUBY_NO_INLINE
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
|
|
||||||
|
#ifdef NT
|
||||||
|
#include "missing/file.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_type(obj)
|
rb_type(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -101,6 +105,10 @@ int *retlen;
|
||||||
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
|
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NT
|
||||||
|
#include "missing/file.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
check_dir(dir)
|
check_dir(dir)
|
||||||
char *dir;
|
char *dir;
|
||||||
|
@ -133,7 +141,6 @@ ruby_mktemp()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)
|
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)
|
||||||
#include <fcntl.h>
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1993, Intergraph Corporation
|
* Copyright (c) 1993, Intergraph Corporation
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define RUBY_VERSION "1.1b9_25"
|
#define RUBY_VERSION "1.1b9_26"
|
||||||
#define VERSION_DATE "98/06/11"
|
#define VERSION_DATE "98/06/18"
|
||||||
|
|
|
@ -15,7 +15,7 @@ INSTALL_DATA = $(INSTALL) -m 644
|
||||||
PURIFY =
|
PURIFY =
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -nologo -DNT=1 -Ox
|
CFLAGS = -nologo -DNT=1 -Ox -I. -I./missing
|
||||||
LDFLAGS = $(CFLAGS) -Fm
|
LDFLAGS = $(CFLAGS) -Fm
|
||||||
#CFLAGS = -nologo -DNT=1 -Zi -MD
|
#CFLAGS = -nologo -DNT=1 -Zi -MD
|
||||||
#LDFLAGS = $(CFLAGS) -Fm -MD
|
#LDFLAGS = $(CFLAGS) -Fm -MD
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#define SIZEOF_VOIDP 4
|
#define SIZEOF_VOIDP 4
|
||||||
#define HAVE_PROTOTYPES 1
|
#define HAVE_PROTOTYPES 1
|
||||||
#define HAVE_STDARG_PROTOTYPES 1
|
#define HAVE_STDARG_PROTOTYPES 1
|
||||||
#define HAVE_ATTR_NORETURN 1
|
/* #define HAVE_ATTR_NORETURN 1 */
|
||||||
/* #define HAVE_DIRENT_H 1 */
|
/* #define HAVE_DIRENT_H 1 */
|
||||||
/* #define HAVE_UNISTD_H 1 */
|
/* #define HAVE_UNISTD_H 1 */
|
||||||
#define HAVE_STDLIB_H 1
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
|
@ -96,7 +96,8 @@ EXPORTS
|
||||||
int2inum
|
int2inum
|
||||||
str2inum
|
str2inum
|
||||||
big2str
|
big2str
|
||||||
big2int
|
big2ulong
|
||||||
|
big2long
|
||||||
big_to_i
|
big_to_i
|
||||||
dbl2big
|
dbl2big
|
||||||
big2dbl
|
big2dbl
|
||||||
|
@ -365,7 +366,7 @@ EXPORTS
|
||||||
str_substr
|
str_substr
|
||||||
str_modify
|
str_modify
|
||||||
str_freeze
|
str_freeze
|
||||||
str_dup_freezed
|
str_dup_frozen
|
||||||
str_taint
|
str_taint
|
||||||
str_tainted
|
str_tainted
|
||||||
str_resize
|
str_resize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue