Skip to content

Commit

Permalink
1.1b9_25
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/v1_1r@238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jun 11, 1998
1 parent 2ce6fde commit d961940
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 70 deletions.
50 changes: 50 additions & 0 deletions ChangeLog
@@ -1,7 +1,57 @@
Thu Jun 11 18:19:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* experimental release 1.1b9_25.

* eval.c (dvar_add_compiling): register dyna_var at compile time.

* regex.c (re_compile_pattern): RE_DUP_MAX iteration is too big.

Wed Jun 10 15:12:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* io.c (io_eof): do not block other threads.

* signal.c (trap): reserve SIGALRM for thread.

* eval.c (thread_create): use ITIMER_REAL also to avoid system
call blocking.

* io.c (f_syscall): add TRAP_BEG, TRAP_END around system calls.

* io.c (io_ctl): add TRAP_BEG, TRAP_END around system calls.

* enum.c (enum_collect): did not collect false values.

* array.c (ary_new2): forgot to initialize capa field.

Tue Jun 9 18:36:15 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>

* string.c (str_split_method): split dumped core for "\xff".

Tue Jun 9 16:22:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* experimental release 1.1b9_24.

Tue Jun 9 16:04:07 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>

* ext/kconv/kconv.c (kconv_guess): more precise decision for EUC,
using jless algorithm (3 sequential EUC hiragana characters).

Tue Jun 9 15:12:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* ext/kconv/kconv.c (kconv_guess): wrong guess for EUC as SJIS in
some cases (0xe0 - 0xef).

* gc.c (xmalloc): insert size check for big (negative in signed)
allocation size.

Tue Jun 9 02:54:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* lib/parsedate.rb: wday moved to the last in the return values.

Mon Jun 8 10:40:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* string.c (str_split_method): split dumped core for "\0".

Sat Jun 6 22:50:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>

* regex.c (calculate_must_string): wrong condition for
Expand Down
4 changes: 2 additions & 2 deletions README.EXT
Expand Up @@ -191,8 +191,8 @@ Ruby

Creates an n-elements array from C array.

ary_push(VALUE ary)
ary_pop(VALUE ary, VALUE val)
ary_push(VALUE ary, VALUE val)
ary_pop(VALUE ary)
ary_shift(VALUE ary)
ary_unshift(VALUE ary, VALUE val)
ary_entry(VALUE ary, int idx)
Expand Down
4 changes: 2 additions & 2 deletions README.EXT.jp
Expand Up @@ -203,8 +203,8 @@ Ruby

�����Ϳ����n���Ǥ�������������롥

ary_push(VALUE ary)
ary_pop(VALUE ary, VALUE val)
ary_push(VALUE ary, VALUE val)
ary_pop(VALUE ary)
ary_shift(VALUE ary)
ary_unshift(VALUE ary, VALUE val)
ary_entry(VALUE ary, int idx)
Expand Down
38 changes: 27 additions & 11 deletions array.c
Expand Up @@ -63,14 +63,17 @@ ary_new2(len)
NEWOBJ(ary, struct RArray);
OBJSETUP(ary, cArray, T_ARRAY);

if (len < 0) {
ArgError("negative array size (or size too big)");
}
if (len > 0 && len*sizeof(VALUE) <= 0) {
ArgError("array size too big");
}
ary->len = 0;
ary->capa = len;
if (len == 0)
ary->ptr = 0;
else {
ary->ptr = ALLOC_N(VALUE, len);
memclear(ary->ptr, len);
}
ary->ptr = 0;
ary->ptr = ALLOC_N(VALUE, len);
memclear(ary->ptr, len);

return (VALUE)ary;
}
Expand Down Expand Up @@ -162,7 +165,19 @@ ary_s_new(argc, argv, klass)

rb_scan_args(argc, argv, "01", &size);
ary->len = 0;
ary->capa = NIL_P(size)?ARY_DEFAULT_SIZE:NUM2INT(size);
ary->ptr = 0;
if (NIL_P(size)) {
ary->capa = ARY_DEFAULT_SIZE;
}
else {
ary->capa = NUM2INT(size);
if (ary->capa < 0) {
ArgError("negative array size");
}
if (ary->capa*sizeof(VALUE) < 0) {
ArgError("array size too big");
}
}
ary->ptr = ALLOC_N(VALUE, ary->capa);
memclear(ary->ptr, ary->capa);
obj_call_init((VALUE)ary);
Expand Down Expand Up @@ -986,13 +1001,14 @@ ary_times(ary, times)
return ary_join(ary, times);
}

len = NUM2INT(times) * RARRAY(ary)->len;
ary2 = ary_new2(len);
RARRAY(ary2)->len = len;

len = NUM2INT(times);
if (len < 0) {
ArgError("negative argument");
}
len *= RARRAY(ary)->len;

ary2 = ary_new2(len);
RARRAY(ary2)->len = len;

for (i=0; i<len; i+=RARRAY(ary)->len) {
MEMCPY(RARRAY(ary2)->ptr+i, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
Expand Down
7 changes: 1 addition & 6 deletions enum.c
Expand Up @@ -125,12 +125,7 @@ static VALUE
collect_i(i, tmp)
VALUE i, tmp;
{
VALUE retval;

retval = rb_yield(i);
if (RTEST(retval)) {
ary_push(tmp, retval);
}
ary_push(tmp, rb_yield(i));
return Qnil;
}

Expand Down
51 changes: 45 additions & 6 deletions eval.c
Expand Up @@ -450,6 +450,17 @@ new_dvar(id, value)
vars->id = id;
vars->val = value;
vars->next = the_dyna_vars;

return vars;
}

static struct RVarmap*
push_dvar(id, value)
ID id;
VALUE value;
{
struct RVarmap* vars = new_dvar(id, value);

if (the_dyna_vars) {
vars->next = the_dyna_vars->next;
the_dyna_vars->next = vars;
Expand Down Expand Up @@ -491,21 +502,42 @@ dyna_var_ref(id)
return Qnil;
}

VALUE
dyna_var_asgn(id, value)
static void
dvar_add_compiling(id)
ID id;
VALUE value;
{
struct RVarmap *vars = the_dyna_vars;

while (vars) {
if (vars->id == 0) break;
if (vars->id == id) {
vars->val = value;
return value;
return;
}
vars = vars->next;
}
new_dvar(id, value);
the_dyna_vars = new_dvar(id, 0);
}

VALUE
dyna_var_asgn(id, value)
ID id;
VALUE value;
{
if (id == 0) {
dvar_add_compiling((ID)value);
}
else {
struct RVarmap *vars = the_dyna_vars;

while (vars) {
if (vars->id == id) {
vars->val = value;
return value;
}
vars = vars->next;
}
push_dvar(id, value);
}
return value;
}

Expand Down Expand Up @@ -6159,15 +6191,22 @@ thread_create(fn, arg)

#ifdef POSIX_SIGNAL
posix_signal(SIGVTALRM, catch_timer);
posix_signal(SIGALRM, catch_timer);
#else
signal(SIGVTALRM, catch_timer);
posix_signal(SIGALRM, catch_timer);
#endif

tval.it_interval.tv_sec = 0;
tval.it_interval.tv_usec = 100000;
tval.it_value = tval.it_interval;
setitimer(ITIMER_VIRTUAL, &tval, NULL);

tval.it_interval.tv_sec = 2; /* unblock system calls */
tval.it_interval.tv_usec = 0;
tval.it_value = tval.it_interval;
setitimer(ITIMER_REAL, &tval, NULL);

init = 1;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion ext/Setup
Expand Up @@ -9,5 +9,5 @@
#md5
#socket
#tkutil
#tcltklib
tcltklib
#gtk
2 changes: 2 additions & 0 deletions ext/extmk.rb.in
Expand Up @@ -413,6 +413,7 @@ def extmake(target)
end
end
if $static
$extlibs = "" unless $extlibs
$extlibs += " " + $LDFLAGS if $LDFLAGS
$extlibs += " " + $local_libs if $local_libs
$extlibs += " " + $libs if $libs
Expand Down Expand Up @@ -481,6 +482,7 @@ if $extlist.size > 0
\tInit_%s();\n\
\trb_provide(\"%s.o\");\n\
", t, t)
$extobjs = "" unless $extobjs
$extobjs += "ext/"
$extobjs += f
$extobjs += " "
Expand Down
38 changes: 28 additions & 10 deletions ext/kconv/kconv.c
Expand Up @@ -1893,8 +1893,22 @@ kconv_guess(obj, src)
{
unsigned char *p = RSTRING(src)->ptr;
unsigned char *pend = p + RSTRING(src)->len;

#define INCR {p++;if (p==pend) return INT2FIX(_UNKNOWN);}
int sequence_counter = 0;

#define INCR do {\
p++;\
if (p==pend) return INT2FIX(_UNKNOWN);\
sequence_counter++;\
if (sequence_counter % 2 == 1 && *p != 0xa4)\
sequence_counter = 0;\
if (6 <= sequence_counter) {\
sequence_counter = 0;\
return INT2FIX(_EUC);\
}\
} while (0)

if (*p == 0xa4)
sequence_counter = 1;

while (p<pend) {
if (*p == '\033') {
Expand All @@ -1908,37 +1922,41 @@ kconv_guess(obj, src)
if (0x81 <= *p && *p <= 0x8d) {
return INT2FIX(_SJIS);
}
if (*p == 0x8e) {
if (0x8f <= *p && *p <= 0x9f) {
return INT2FIX(_SJIS);
}
if (*p == 0x8e) { /* SS2 */
INCR;
if ((0x40 <= *p && *p <= 0x7e) ||
(0x80 <= *p && *p <= 0xa0) ||
(0xe0 <= *p && *p <= 0xfc))
return INT2FIX(_SJIS);
}
if (0xa1 <= *p && *p <= 0xdf) {
else if (0xa1 <= *p && *p <= 0xdf) {
INCR;
if (0xf0 <= *p && *p <= 0xfe)
return INT2FIX(_EUC);
if (0xe0 <= *p && *p <= 0xef) {
while (*p >= 0x40) {
while (p < pend && *p >= 0x40) {
if (*p >= 0x81) {
if (0x8d <= *p || (0x8f <= *p && *p <= 0x9f)) {
if (*p <= 0x8d || (0x8f <= *p && *p <= 0x9f)) {
return INT2FIX(_SJIS);
}
else if (0xfd <= *p && *p <= 0xfe) {
return INT2FIX(_EUC);
}
}
INCR;
}
}
if (*p <= 0x9f) {
else if (*p <= 0x9f) {
return INT2FIX(_SJIS);
}
}
if (0xf0 <= *p && *p <= 0xfe) {
else if (0xf0 <= *p && *p <= 0xfe) {
return INT2FIX(_EUC);
}
if (0xe0 <= *p && *p <= 0xef) {
else if (0xe0 <= *p && *p <= 0xef) {
INCR;
if ((0x40 <= *p && *p <= 0x7e) ||
(0x80 <= *p && *p <= 0xa0)) {
Expand All @@ -1948,7 +1966,7 @@ kconv_guess(obj, src)
return INT2FIX(_EUC);
}
}
p++;
INCR;
}
return INT2FIX(_UNKNOWN);
}
Expand Down
12 changes: 9 additions & 3 deletions gc.c
Expand Up @@ -47,10 +47,13 @@ static unsigned long malloc_memories = 0;

void *
xmalloc(size)
unsigned long size;
int size;
{
void *mem;

if (size < 0) {
ArgError("negative allocation size (or too big)");
}
if (size == 0) size = 1;
#if 0
malloc_memories += size;
Expand All @@ -71,7 +74,7 @@ xmalloc(size)

void *
xcalloc(n, size)
unsigned long n, size;
int n, size;
{
void *mem;

Expand All @@ -84,10 +87,13 @@ xcalloc(n, size)
void *
xrealloc(ptr, size)
void *ptr;
unsigned long size;
int size;
{
void *mem;

if (size < 0) {
ArgError("negative re-allocation size");
}
if (!ptr) return xmalloc(size);
mem = realloc(ptr, size);
if (!mem) {
Expand Down

0 comments on commit d961940

Please sign in to comment.