Skip to content

Commit 2562004

Browse files
author
matz
committed
sync ev
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 3b0fec9 commit 2562004

File tree

13 files changed

+182
-58
lines changed

13 files changed

+182
-58
lines changed

ChangeLog

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
Tue Jul 28 13:03:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
2+
3+
* array.c (ary_s_new): argument to specify initial value is added.
4+
5+
* array.c (ary_s_new): specifies size, not capacity.
6+
7+
Mon Jul 27 12:39:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
8+
9+
* string.c (str_replace): zero fill for expansion gap.
10+
11+
* regex.c (mbctab_euc): set flags on for 0xA1-0xFE. suggested by
12+
<inaba@st.rim.or.jp>.
13+
14+
* string.c (str_inspect): consider current_mbctype.
15+
16+
Sun Jul 26 15:37:11 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
17+
18+
* array.c (ary_s_new): Array.new(1<<30) dumps core.
19+
120
Fri Jul 24 13:40:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
221

322
* version 1.1c1 released.
@@ -14,7 +33,7 @@ Fri Jul 24 02:10:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
1433

1534
Thu Jul 23 13:11:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
1635

17-
* eval.c (rb_attr): argument should be symbol or a string.
36+
* eval.c (rb_attr): argument should be symbol or string.
1837

1938
Wed Jul 22 11:59:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
2039

array.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ memclear(mem, size)
2727
}
2828
}
2929

30+
static void
31+
memfill(mem, size, val)
32+
register VALUE *mem;
33+
register int size;
34+
register VALUE val;
35+
{
36+
while (size--) {
37+
*mem++ = val;
38+
}
39+
}
40+
3041
#define ARY_FREEZE FL_USER1
3142

3243
static void
@@ -131,9 +142,6 @@ ary_new4(n, elts)
131142
if (elts) {
132143
MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
133144
}
134-
else {
135-
memclear(RARRAY(ary)->ptr, n);
136-
}
137145
RARRAY(ary)->len = n;
138146

139147
return ary;
@@ -159,13 +167,13 @@ ary_s_new(argc, argv, klass)
159167
VALUE *argv;
160168
VALUE klass;
161169
{
162-
VALUE size;
170+
VALUE size, val;
163171
NEWOBJ(ary, struct RArray);
164172
OBJSETUP(ary, klass, T_ARRAY);
165173

166174
ary->len = 0;
167175
ary->ptr = 0;
168-
if (rb_scan_args(argc, argv, "01", &size) == 0) {
176+
if (rb_scan_args(argc, argv, "02", &size, &val) == 0) {
169177
ary->capa = ARY_DEFAULT_SIZE;
170178
}
171179
else {
@@ -174,13 +182,14 @@ ary_s_new(argc, argv, klass)
174182
if (capa < 0) {
175183
ArgError("negative array size");
176184
}
177-
if (capa*sizeof(VALUE) < 0) {
185+
if (capa > 0 && capa*sizeof(VALUE) <= 0) {
178186
ArgError("array size too big");
179187
}
180188
ary->capa = capa;
189+
ary->len = capa;
181190
}
182191
ary->ptr = ALLOC_N(VALUE, ary->capa);
183-
memclear(ary->ptr, ary->capa);
192+
memfill(ary->ptr, ary->len, val);
184193
obj_call_init((VALUE)ary);
185194

186195
return (VALUE)ary;

configure.in

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no)])
539539
setup=Setup
540540
;;
541541
esac
542+
543+
544+
542545
AC_SUBST(binsuffix)
543546
AC_SUBST(setup)
544547

@@ -547,7 +550,7 @@ if test "$prefix" = NONE; then
547550
fi
548551

549552
if test "$fat_binary" = yes ; then
550-
CFLAGS="$CFLAGS -pipe $ARCH_FLAG"
553+
CFLAGS="$CFLAGS $ARCH_FLAG"
551554
fi
552555

553556
LIBRUBY='libruby.a'
@@ -575,9 +578,19 @@ if test "$enable_shared" = 'yes'; then
575578
LIBRUBYARG='-L./ -lruby'
576579
fi
577580

578-
if test "$host_os" = "rhapsody" ; then
579-
CFLAGS="$CFLAGS -no-precomp"
580-
fi
581+
case "$host_os" in
582+
nextstep*)
583+
CFLAGS="$CFLAGS -pipe"
584+
;;
585+
openstep*)
586+
CFLAGS="$CFLAGS -pipe"
587+
;;
588+
rhasody*)
589+
CFLAGS="$CFLAGS -pipe -no-precomp"
590+
;;
591+
*)
592+
;;
593+
esac
581594

582595

583596
AC_SUBST(LIBRUBY)

defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#ifdef NeXT
2525
#define DYNAMIC_ENDIAN /* determine endian at runtime */
26-
#ifndef __Apple__
26+
#ifndef __APPLE__
2727
#define S_IXUSR _S_IXUSR /* execute/search permission, owner */
2828
#endif
2929
#define S_IXGRP 0000010 /* execute/search permission, group */

dln.c

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,11 @@ dln_sym(name)
10881088
#endif
10891089

10901090
#ifdef NeXT
1091-
/*#include <mach-o/rld.h>*/
1091+
#if NS_TARGET_MAJOR < 4
1092+
#include <mach-o/rld.h>
1093+
#else
1094+
#include <mach-o/dyld.h>
1095+
#endif
10921096
#endif
10931097

10941098
#ifdef _WIN32
@@ -1316,6 +1320,7 @@ dln_load(file)
13161320
Mi hisho@tasihara.nest.or.jp,
13171321
and... Miss ARAI Akino(^^;)
13181322
----------------------------------------------------*/
1323+
#if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */
13191324
{
13201325
unsigned long init_address;
13211326
char *object_files[2] = {NULL, NULL};
@@ -1341,6 +1346,42 @@ dln_load(file)
13411346
(*init_fct)();
13421347
return ;
13431348
}
1349+
#else/* OPENSTEP dyld functions */
1350+
{
1351+
int dyld_result ;
1352+
NSObjectFileImage obj_file ; /* handle, but not use it */
1353+
/* "file" is module file name .
1354+
"buf" is initial function name with "_" . */
1355+
1356+
void (*init_fct)();
1357+
1358+
1359+
dyld_result = NSCreateObjectFileImageFromFile( file, &obj_file );
1360+
1361+
if (dyld_result != NSObjectFileImageSuccess)
1362+
{
1363+
LoadError("Failed to load %.200s", file);
1364+
}
1365+
1366+
NSLinkModule(obj_file, file, TRUE);
1367+
1368+
1369+
/* lookup the initial function */
1370+
/*NSIsSymbolNameDefined require function name without "_" */
1371+
if( NSIsSymbolNameDefined( buf + 1 ) )
1372+
{
1373+
LoadError("Failed to lookup Init function %.200s",file);
1374+
}
1375+
1376+
/* NSLookupAndBindSymbol require function name with "_" !! */
1377+
1378+
init_fct = NSAddressOfSymbol( NSLookupAndBindSymbol( buf ) );
1379+
(*init_fct)();
1380+
1381+
1382+
return ;
1383+
}
1384+
#endif /* rld or dyld */
13441385
#endif
13451386

13461387
#ifdef __BEOS__

instruby.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
archdir = libdir+"/"+CONFIG["arch"]
1919
mandir = CONFIG["mandir"] + "/man1"
2020

21+
File.makedirs bindir, TRUE
2122
File.install "ruby#{binsuffix}",
2223
"#{bindir}/#{ruby_install_name}#{binsuffix}", 0755, TRUE
2324
for dll in Dir['*.dll']

lib/tempfile.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,44 @@ class Tempfile < SimpleDelegator
1717

1818
def Tempfile.callback(path)
1919
lambda{
20-
print "removing ", path, "..."
20+
print "removing ", path, "..." if $DEBUG
2121
if File.exist?(path)
2222
File.unlink(path)
2323
end
2424
if File.exist?(path + '.lock')
25-
File.unlink(path + '.lock')
25+
File.rmdir(path + '.lock')
2626
end
27-
print "done\n"
27+
print "done\n" if $DEBUG
2828
}
2929
end
3030

3131
def initialize(basename, tmpdir = '/tmp')
3232
umask = File.umask(0177)
33+
tmpname = lock = nil
3334
begin
3435
n = 0
3536
while true
3637
begin
37-
@tmpname = sprintf('%s/%s.%d.%d', tmpdir, basename, $$, n)
38-
unless File.exist?(@tmpname)
39-
File.symlink(tmpdir, @tmpname + '.lock')
38+
tmpname = sprintf('%s/%s.%d.%d', tmpdir, basename, $$, n)
39+
lock = tmpname + '.lock'
40+
unless File.exist?(lock)
41+
Dir.mkdir(lock)
4042
break
4143
end
4244
rescue
43-
raise "cannot generate tmpfile `%s'" % @tmpname if n >= Max_try
45+
raise "cannot generate tmpfile `%s'" % tmpname if n >= Max_try
4446
#sleep(1)
4547
end
4648
n += 1
4749
end
4850

49-
@clean_files = Tempfile.callback(@tmpname)
51+
@clean_files = Tempfile.callback(tmpname)
5052
ObjectSpace.define_finalizer(self, @clean_files)
5153

52-
@tmpfile = File.open(@tmpname, 'w+')
54+
@tmpname = tmpname
55+
@tmpfile = File.open(tmpname, 'w+')
5356
super(@tmpfile)
54-
File.unlink(@tmpname + '.lock')
57+
Dir.rmdir(lock)
5558
ensure
5659
File.umask(umask)
5760
end
@@ -78,6 +81,7 @@ def close(real=false)
7881
end
7982

8083
if __FILE__ == $0
84+
# $DEBUG = true
8185
f = Tempfile.new("foo")
8286
f.print("foo\n")
8387
f.close

lib/tk.rb

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,19 @@ def bell
548548
tk_call 'bell'
549549
end
550550

551+
def Tk.focus(display=nil)
552+
if display == nil
553+
r = tk_call('focus')
554+
else
555+
r = tk_call('focus', '-displayof', display)
556+
end
557+
tk_tcl2ruby(r)
558+
end
559+
560+
def Tk.focus_lastfor(win)
561+
tk_tcl2ruby(tk_call('focus', '-lastfor', win))
562+
end
563+
551564
def toUTF8(str,encoding)
552565
INTERP._toUTF8(str,encoding)
553566
end
@@ -636,9 +649,15 @@ def overrideredirect(bool=None)
636649
def positionfrom(*args)
637650
tk_call 'wm', 'positionfrom', path, *args
638651
end
639-
def protocol(name, func=None)
640-
func = install_cmd(func) if not func == None
641-
tk_call 'wm', 'command', path, name, func
652+
def protocol(name=nil, cmd=nil)
653+
if cmd
654+
tk_call('wm', 'protocol', path, name, cmd)
655+
elsif name
656+
result = tk_call('wm', 'protocol', path, name)
657+
(result == "")? nil : tk_tcl2ruby(result)
658+
else
659+
tk_split_simplelist(tk_call('wm', 'protocol', path))
660+
end
642661
end
643662
def resizable(*args)
644663
w = tk_call('wm', 'resizable', path, *args)
@@ -1402,8 +1421,8 @@ def add pat, value, pri=None
14021421
def clear
14031422
tk_call 'option', 'clear'
14041423
end
1405-
def get win, classname, name
1406-
tk_call 'option', 'get', classname, name
1424+
def get win, name, klass
1425+
tk_call 'option', 'get', win ,name, klass
14071426
end
14081427
def readfile file, pri=None
14091428
tk_call 'option', 'readfile', file, pri
@@ -1735,8 +1754,12 @@ def place_slaves()
17351754
list(tk_call('place', 'slaves', epath))
17361755
end
17371756

1738-
def focus
1739-
tk_call 'focus', path
1757+
def focus(force=false)
1758+
if force
1759+
tk_call 'focus', '-force', path
1760+
else
1761+
tk_call 'focus', path
1762+
end
17401763
self
17411764
end
17421765

lib/tkcanvas.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def itemconfigure(tagOrId, key, value=None)
310310
|| key == 'latinfont' || key == 'asciifont' )
311311
tagfont_configure(tagid(tagOrId), {key=>value})
312312
else
313-
tk_call 'itemconfigure', tagid(tagOrId), "-#{key}", value
313+
tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
314314
end
315315
end
316316
end

0 commit comments

Comments
 (0)