Skip to content

Commit

Permalink
sync ev
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jul 29, 1998
1 parent 3b0fec9 commit 2562004
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 58 deletions.
21 changes: 20 additions & 1 deletion ChangeLog
@@ -1,3 +1,22 @@
Tue Jul 28 13:03:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* array.c (ary_s_new): argument to specify initial value is added.

* array.c (ary_s_new): specifies size, not capacity.

Mon Jul 27 12:39:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* string.c (str_replace): zero fill for expansion gap.

* regex.c (mbctab_euc): set flags on for 0xA1-0xFE. suggested by
<inaba@st.rim.or.jp>.

* string.c (str_inspect): consider current_mbctype.

Sun Jul 26 15:37:11 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>

* array.c (ary_s_new): Array.new(1<<30) dumps core.

Fri Jul 24 13:40:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

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

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

* eval.c (rb_attr): argument should be symbol or a string.
* eval.c (rb_attr): argument should be symbol or string.

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

Expand Down
23 changes: 16 additions & 7 deletions array.c
Expand Up @@ -27,6 +27,17 @@ memclear(mem, size)
}
}

static void
memfill(mem, size, val)
register VALUE *mem;
register int size;
register VALUE val;
{
while (size--) {
*mem++ = val;
}
}

#define ARY_FREEZE FL_USER1

static void
Expand Down Expand Up @@ -131,9 +142,6 @@ ary_new4(n, elts)
if (elts) {
MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
}
else {
memclear(RARRAY(ary)->ptr, n);
}
RARRAY(ary)->len = n;

return ary;
Expand All @@ -159,13 +167,13 @@ ary_s_new(argc, argv, klass)
VALUE *argv;
VALUE klass;
{
VALUE size;
VALUE size, val;
NEWOBJ(ary, struct RArray);
OBJSETUP(ary, klass, T_ARRAY);

ary->len = 0;
ary->ptr = 0;
if (rb_scan_args(argc, argv, "01", &size) == 0) {
if (rb_scan_args(argc, argv, "02", &size, &val) == 0) {
ary->capa = ARY_DEFAULT_SIZE;
}
else {
Expand All @@ -174,13 +182,14 @@ ary_s_new(argc, argv, klass)
if (capa < 0) {
ArgError("negative array size");
}
if (capa*sizeof(VALUE) < 0) {
if (capa > 0 && capa*sizeof(VALUE) <= 0) {
ArgError("array size too big");
}
ary->capa = capa;
ary->len = capa;
}
ary->ptr = ALLOC_N(VALUE, ary->capa);
memclear(ary->ptr, ary->capa);
memfill(ary->ptr, ary->len, val);
obj_call_init((VALUE)ary);

return (VALUE)ary;
Expand Down
21 changes: 17 additions & 4 deletions configure.in
Expand Up @@ -539,6 +539,9 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no)])
setup=Setup
;;
esac



AC_SUBST(binsuffix)
AC_SUBST(setup)

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

if test "$fat_binary" = yes ; then
CFLAGS="$CFLAGS -pipe $ARCH_FLAG"
CFLAGS="$CFLAGS $ARCH_FLAG"
fi

LIBRUBY='libruby.a'
Expand Down Expand Up @@ -575,9 +578,19 @@ if test "$enable_shared" = 'yes'; then
LIBRUBYARG='-L./ -lruby'
fi

if test "$host_os" = "rhapsody" ; then
CFLAGS="$CFLAGS -no-precomp"
fi
case "$host_os" in
nextstep*)
CFLAGS="$CFLAGS -pipe"
;;
openstep*)
CFLAGS="$CFLAGS -pipe"
;;
rhasody*)
CFLAGS="$CFLAGS -pipe -no-precomp"
;;
*)
;;
esac


AC_SUBST(LIBRUBY)
Expand Down
2 changes: 1 addition & 1 deletion defines.h
Expand Up @@ -23,7 +23,7 @@

#ifdef NeXT
#define DYNAMIC_ENDIAN /* determine endian at runtime */
#ifndef __Apple__
#ifndef __APPLE__
#define S_IXUSR _S_IXUSR /* execute/search permission, owner */
#endif
#define S_IXGRP 0000010 /* execute/search permission, group */
Expand Down
43 changes: 42 additions & 1 deletion dln.c
Expand Up @@ -1088,7 +1088,11 @@ dln_sym(name)
#endif

#ifdef NeXT
/*#include <mach-o/rld.h>*/
#if NS_TARGET_MAJOR < 4
#include <mach-o/rld.h>
#else
#include <mach-o/dyld.h>
#endif
#endif

#ifdef _WIN32
Expand Down Expand Up @@ -1316,6 +1320,7 @@ dln_load(file)
Mi hisho@tasihara.nest.or.jp,
and... Miss ARAI Akino(^^;)
----------------------------------------------------*/
#if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */
{
unsigned long init_address;
char *object_files[2] = {NULL, NULL};
Expand All @@ -1341,6 +1346,42 @@ dln_load(file)
(*init_fct)();
return ;
}
#else/* OPENSTEP dyld functions */
{
int dyld_result ;
NSObjectFileImage obj_file ; /* handle, but not use it */
/* "file" is module file name .
"buf" is initial function name with "_" . */

void (*init_fct)();


dyld_result = NSCreateObjectFileImageFromFile( file, &obj_file );

if (dyld_result != NSObjectFileImageSuccess)
{
LoadError("Failed to load %.200s", file);
}

NSLinkModule(obj_file, file, TRUE);


/* lookup the initial function */
/*NSIsSymbolNameDefined require function name without "_" */
if( NSIsSymbolNameDefined( buf + 1 ) )
{
LoadError("Failed to lookup Init function %.200s",file);
}

/* NSLookupAndBindSymbol require function name with "_" !! */

init_fct = NSAddressOfSymbol( NSLookupAndBindSymbol( buf ) );
(*init_fct)();


return ;
}
#endif /* rld or dyld */
#endif

#ifdef __BEOS__
Expand Down
1 change: 1 addition & 0 deletions instruby.rb
Expand Up @@ -18,6 +18,7 @@
archdir = libdir+"/"+CONFIG["arch"]
mandir = CONFIG["mandir"] + "/man1"

File.makedirs bindir, TRUE
File.install "ruby#{binsuffix}",
"#{bindir}/#{ruby_install_name}#{binsuffix}", 0755, TRUE
for dll in Dir['*.dll']
Expand Down
24 changes: 14 additions & 10 deletions lib/tempfile.rb
Expand Up @@ -17,41 +17,44 @@ class Tempfile < SimpleDelegator

def Tempfile.callback(path)
lambda{
print "removing ", path, "..."
print "removing ", path, "..." if $DEBUG
if File.exist?(path)
File.unlink(path)
end
if File.exist?(path + '.lock')
File.unlink(path + '.lock')
File.rmdir(path + '.lock')
end
print "done\n"
print "done\n" if $DEBUG
}
end

def initialize(basename, tmpdir = '/tmp')
umask = File.umask(0177)
tmpname = lock = nil
begin
n = 0
while true
begin
@tmpname = sprintf('%s/%s.%d.%d', tmpdir, basename, $$, n)
unless File.exist?(@tmpname)
File.symlink(tmpdir, @tmpname + '.lock')
tmpname = sprintf('%s/%s.%d.%d', tmpdir, basename, $$, n)
lock = tmpname + '.lock'
unless File.exist?(lock)
Dir.mkdir(lock)
break
end
rescue
raise "cannot generate tmpfile `%s'" % @tmpname if n >= Max_try
raise "cannot generate tmpfile `%s'" % tmpname if n >= Max_try
#sleep(1)
end
n += 1
end

@clean_files = Tempfile.callback(@tmpname)
@clean_files = Tempfile.callback(tmpname)
ObjectSpace.define_finalizer(self, @clean_files)

@tmpfile = File.open(@tmpname, 'w+')
@tmpname = tmpname
@tmpfile = File.open(tmpname, 'w+')
super(@tmpfile)
File.unlink(@tmpname + '.lock')
Dir.rmdir(lock)
ensure
File.umask(umask)
end
Expand All @@ -78,6 +81,7 @@ def close(real=false)
end

if __FILE__ == $0
# $DEBUG = true
f = Tempfile.new("foo")
f.print("foo\n")
f.close
Expand Down
37 changes: 30 additions & 7 deletions lib/tk.rb
Expand Up @@ -548,6 +548,19 @@ def bell
tk_call 'bell'
end

def Tk.focus(display=nil)
if display == nil
r = tk_call('focus')
else
r = tk_call('focus', '-displayof', display)
end
tk_tcl2ruby(r)
end

def Tk.focus_lastfor(win)
tk_tcl2ruby(tk_call('focus', '-lastfor', win))
end

def toUTF8(str,encoding)
INTERP._toUTF8(str,encoding)
end
Expand Down Expand Up @@ -636,9 +649,15 @@ def overrideredirect(bool=None)
def positionfrom(*args)
tk_call 'wm', 'positionfrom', path, *args
end
def protocol(name, func=None)
func = install_cmd(func) if not func == None
tk_call 'wm', 'command', path, name, func
def protocol(name=nil, cmd=nil)
if cmd
tk_call('wm', 'protocol', path, name, cmd)
elsif name
result = tk_call('wm', 'protocol', path, name)
(result == "")? nil : tk_tcl2ruby(result)
else
tk_split_simplelist(tk_call('wm', 'protocol', path))
end
end
def resizable(*args)
w = tk_call('wm', 'resizable', path, *args)
Expand Down Expand Up @@ -1402,8 +1421,8 @@ def add pat, value, pri=None
def clear
tk_call 'option', 'clear'
end
def get win, classname, name
tk_call 'option', 'get', classname, name
def get win, name, klass
tk_call 'option', 'get', win ,name, klass
end
def readfile file, pri=None
tk_call 'option', 'readfile', file, pri
Expand Down Expand Up @@ -1735,8 +1754,12 @@ def place_slaves()
list(tk_call('place', 'slaves', epath))
end

def focus
tk_call 'focus', path
def focus(force=false)
if force
tk_call 'focus', '-force', path
else
tk_call 'focus', path
end
self
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tkcanvas.rb
Expand Up @@ -310,7 +310,7 @@ def itemconfigure(tagOrId, key, value=None)
|| key == 'latinfont' || key == 'asciifont' )
tagfont_configure(tagid(tagOrId), {key=>value})
else
tk_call 'itemconfigure', tagid(tagOrId), "-#{key}", value
tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
end
end
end
Expand Down

0 comments on commit 2562004

Please sign in to comment.