Skip to content

Commit c30c3bf

Browse files
author
matz
committed
1.1b9_31
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 35c6e6a commit c30c3bf

File tree

18 files changed

+1024
-206
lines changed

18 files changed

+1024
-206
lines changed

ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
Wed Jul 15 15:11:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
2+
3+
* experimental release 1.1b9_31.
4+
5+
Wed Jul 15 15:05:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
6+
7+
* eval.c (thread_create): exit() and abort() in threads now
8+
forwarded to main_thread.
9+
10+
Tue Jul 14 14:03:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
11+
12+
* variable.c (obj_instance_variables): list names that is not
13+
instance variables.
14+
15+
* gc.c (GC_MALLOC_LIMIT): choose smaller limit value.
16+
117
Mon Jul 13 12:39:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
218

319
* object.c (str2cstr): should not return NULL.
420

21+
Fri Jul 10 11:51:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
22+
23+
* parse.y (gettable): needed to add dyna_in_block() check.
24+
525
Thu Jul 9 17:38:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
626

727
* experimental release 1.1b9_30.

bignum.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef unsigned short USHORT;
1919
#define BITSPERDIG (sizeof(short)*CHAR_BIT)
2020
#define BIGRAD (1L << BITSPERDIG)
2121
#define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short)))
22-
#define BIGUP(x) ((unsigned int)(x) << BITSPERDIG)
22+
#define BIGUP(x) ((unsigned long)(x) << BITSPERDIG)
2323
#define BIGDN(x) (((x)<0) ? ~((~(x))>>BITSPERDIG) : (x)>>BITSPERDIG)
2424
#define BIGLO(x) ((x) & (BIGRAD-1))
2525

@@ -85,17 +85,17 @@ bignorm(x)
8585
while (len-- && !ds[len]) ;
8686
RBIGNUM(x)->len = ++len;
8787

88-
if (len*sizeof(USHORT) < sizeof(VALUE) ||
89-
(len*sizeof(USHORT) == sizeof(VALUE) &&
90-
ds[sizeof(VALUE)/sizeof(USHORT)-1] <= 0x3fff)) {
88+
if (len*sizeof(USHORT) <= sizeof(VALUE)) {
9189
long num = 0;
9290
while (len--) {
9391
num = BIGUP(num) + ds[len];
9492
}
95-
if (RBIGNUM(x)->sign) {
96-
if (POSFIXABLE(num)) return INT2FIX(num);
93+
if (num >= 0) {
94+
if (RBIGNUM(x)->sign) {
95+
if (POSFIXABLE(num)) return INT2FIX(num);
96+
}
97+
else if (NEGFIXABLE(-num)) return INT2FIX(-num);
9798
}
98-
else if (NEGFIXABLE(-num)) return INT2FIX(-num);
9999
}
100100
return x;
101101
}

eval.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5649,7 +5649,6 @@ thread_remove()
56495649
curr_thread->status = THREAD_KILLED;
56505650
curr_thread->prev->next = curr_thread->next;
56515651
curr_thread->next->prev = curr_thread->prev;
5652-
thread_schedule();
56535652
}
56545653

56555654
static int
@@ -6230,6 +6229,8 @@ catch_timer(sig)
62306229
int thread_tick = THREAD_TICK;
62316230
#endif
62326231

6232+
static VALUE thread_raise _((int, VALUE*, VALUE));
6233+
62336234
VALUE
62346235
thread_create(fn, arg)
62356236
VALUE (*fn)();
@@ -6274,36 +6275,29 @@ thread_create(fn, arg)
62746275
}
62756276
}
62766277
POP_TAG();
6278+
thread_remove();
62776279
if (state && th->status != THREAD_TO_KILL && !NIL_P(errinfo)) {
6278-
if (state == TAG_FATAL || obj_is_kind_of(errinfo, eSystemExit) ||
6279-
thread_abort || curr_thread->abort || RTEST(debug)) {
6280-
/* fatal error or global exit within this thread */
6281-
/* need to stop whole script */
6280+
if (state == TAG_FATAL) {
6281+
/* fatal error within this thread, need to stop whole script */
62826282
main_thread->errinfo = errinfo;
62836283
thread_cleanup();
62846284
}
6285-
#if 0
6285+
else if (obj_is_kind_of(errinfo, eSystemExit)) {
6286+
/* delegate exception to main_thread */
6287+
thread_raise(1, &errinfo, main_thread->thread);
6288+
}
62866289
else if (thread_abort || curr_thread->abort || RTEST(debug)) {
6287-
thread_critical = 0;
6288-
thread_ready(main_thread);
6289-
main_thread->errinfo = errinfo;
6290-
if (curr_thread == main_thread) {
6291-
rb_raise(errinfo);
6292-
}
6293-
curr_thread = main_thread;
6294-
th_raise_argc = 1;
6295-
th_raise_argv[0] = errinfo;
6296-
th_raise_file = sourcefile;
6297-
th_raise_line = sourceline;
6298-
thread_restore_context(curr_thread, 4);
6290+
VALUE err = exc_new(eSystemExit, 0, 0);
6291+
error_print();
6292+
/* exit on main_thread */
6293+
thread_raise(1, &err, main_thread->thread);
62996294
}
6300-
#endif
63016295
else {
63026296
curr_thread->errinfo = errinfo;
63036297
}
63046298
}
6305-
thread_remove();
6306-
return 0;
6299+
thread_schedule();
6300+
return 0; /* not reached */
63076301
}
63086302

63096303
static VALUE

ext/tcltklib/tcltklib.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,72 @@ ip_eval(VALUE self, VALUE str)
242242
return(str_new2(ptr->ip->result));
243243
}
244244

245+
246+
static VALUE
247+
ip_toUTF8(VALUE self, VALUE str, VALUE encodename)
248+
{
249+
#ifndef TCL_UTF_MAX
250+
return str;
251+
#else
252+
Tcl_Interp *interp;
253+
Tcl_Encoding encoding;
254+
Tcl_DString dstr;
255+
struct tcltkip *ptr;
256+
char *buff1,*buff2;
257+
258+
Data_Get_Struct(self,struct tcltkip, ptr);
259+
interp = ptr->ip;
260+
261+
encoding = Tcl_GetEncoding(interp,STR2CSTR(encodename));
262+
buff1 = ALLOCA_N(char,strlen(STR2CSTR(str))+1);
263+
strcpy(buff1,STR2CSTR(str));
264+
265+
Tcl_DStringInit(&dstr);
266+
Tcl_DStringFree(&dstr);
267+
Tcl_ExternalToUtfDString(encoding,buff1,strlen(buff1),&dstr);
268+
buff2 = ALLOCA_N(char,Tcl_DStringLength(&dstr)+1);
269+
strcpy(buff2,Tcl_DStringValue(&dstr));
270+
271+
Tcl_FreeEncoding(encoding);
272+
Tcl_DStringFree(&dstr);
273+
274+
return str_new2(buff2);
275+
#endif
276+
}
277+
278+
static VALUE
279+
ip_fromUTF8(VALUE self, VALUE str, VALUE encodename)
280+
{
281+
#ifndef TCL_UTF_MAX
282+
return str;
283+
#else
284+
Tcl_Interp *interp;
285+
Tcl_Encoding encoding;
286+
Tcl_DString dstr;
287+
struct tcltkip *ptr;
288+
char *buff1,*buff2;
289+
290+
Data_Get_Struct(self,struct tcltkip, ptr);
291+
interp = ptr->ip;
292+
293+
encoding = Tcl_GetEncoding(interp,STR2CSTR(encodename));
294+
buff1 = ALLOCA_N(char,strlen(STR2CSTR(str))+1);
295+
strcpy(buff1,STR2CSTR(str));
296+
297+
Tcl_DStringInit(&dstr);
298+
Tcl_DStringFree(&dstr);
299+
Tcl_UtfToExternalDString(encoding,buff1,strlen(buff1),&dstr);
300+
buff2 = ALLOCA_N(char,Tcl_DStringLength(&dstr)+1);
301+
strcpy(buff2,Tcl_DStringValue(&dstr));
302+
303+
Tcl_FreeEncoding(encoding);
304+
Tcl_DStringFree(&dstr);
305+
306+
return str_new2(buff2);
307+
#endif
308+
}
309+
310+
245311
static VALUE
246312
ip_invoke(int argc, VALUE *argv, VALUE obj)
247313
{
@@ -356,6 +422,8 @@ void Init_tcltklib()
356422

357423
rb_define_singleton_method(ip, "new", ip_new, 0);
358424
rb_define_method(ip, "_eval", ip_eval, 1);
425+
rb_define_method(ip, "_toUTF8",ip_toUTF8,2);
426+
rb_define_method(ip, "_fromUTF8",ip_fromUTF8,2);
359427
rb_define_method(ip, "_invoke", ip_invoke, -1);
360428
rb_define_method(ip, "_return_value", ip_retval, 0);
361429
rb_define_method(ip, "mainloop", lib_mainloop, 0);

gc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ static void run_final();
3737

3838
#ifndef GC_MALLOC_LIMIT
3939
#if defined(MSDOS) || defined(__human68k__)
40-
#define GC_MALLOC_LIMIT 200000
40+
#define GC_MALLOC_LIMIT 100000
4141
#else
42-
#define GC_MALLOC_LIMIT 400000
42+
#define GC_MALLOC_LIMIT 200000
4343
#endif
4444
#endif
4545

@@ -55,12 +55,10 @@ xmalloc(size)
5555
ArgError("negative allocation size (or too big)");
5656
}
5757
if (size == 0) size = 1;
58-
#if 0
5958
malloc_memories += size;
6059
if (malloc_memories > GC_MALLOC_LIMIT) {
6160
gc_gc();
6261
}
63-
#endif
6462
mem = malloc(size);
6563
if (!mem) {
6664
gc_gc();
@@ -95,6 +93,10 @@ xrealloc(ptr, size)
9593
ArgError("negative re-allocation size");
9694
}
9795
if (!ptr) return xmalloc(size);
96+
malloc_memories += size;
97+
if (malloc_memories > GC_MALLOC_LIMIT) {
98+
gc_gc();
99+
}
98100
mem = realloc(ptr, size);
99101
if (!mem) {
100102
gc_gc();

lib/matrix.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#
33
# matrix.rb -
44
# $Release Version: 1.0$
5-
# $Revision: 1.4 $
6-
# $Date: 1998/07/08 06:39:13 $
5+
# $Revision: 1.5 $
6+
# $Date: 1998/07/14 14:35:18 $
77
# Original Version from Smalltalk-80 version
88
# on July 23, 1985 at 8:37:17 am
99
# by Keiju ISHITSUKA
@@ -180,8 +180,8 @@ module ExceptionForMatrix
180180
end
181181

182182
class Matrix
183-
@RCS_ID='-$Id: matrix.rb,v 1.4 1998/07/08 06:39:13 keiju Exp keiju $-'
184-
183+
@RCS_ID='-$Id: matrix.rb,v 1.5 1998/07/14 14:35:18 keiju Exp keiju $-'
184+
185185
include ExceptionForMatrix
186186

187187
# instance creations
@@ -857,7 +857,7 @@ def compare_by(elements)
857857
end
858858

859859
def clone
860-
Vector.elements(@rows)
860+
Vector.elements(@elements)
861861
end
862862

863863
def hash

lib/pstore.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def transaction
8989
catch(:pstore_abort_transaction) do
9090
value = yield(self)
9191
end
92+
rescue Exception
93+
@abort = true
94+
raise
9295
ensure
9396
unless @abort
9497
begin

0 commit comments

Comments
 (0)