raise() -> rb_raise(). (Thanks Tetsuya Watanabe)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ttate 2002-04-11 09:38:26 +00:00
Родитель 3bd7404423
Коммит 3a202ff2b4
4 изменённых файлов: 19 добавлений и 19 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Thu Apr 11 09:31:19 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
* ext/dl/ptr.c: raise() -> rb_raise(). (Thanks Tetsuya Watanabe)
* ext/dl/sym.c: ditto.
Thu Apr 11 07:02:31 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp> Thu Apr 11 07:02:31 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
* ext/dl: Add dl.txt instead of README and README.html. * ext/dl: Add dl.txt instead of README and README.html.

Просмотреть файл

@ -549,7 +549,7 @@ rb_dlptr_define_data_type(int argc, VALUE argv[], VALUE self)
return Qnil; return Qnil;
} }
else{ else{
raise(rb_eArgError, "wrong arguments"); rb_raise(rb_eArgError, "wrong arguments");
}; };
}; };
@ -687,7 +687,7 @@ cary2ary(void *ptr, char t, int len)
elem = INT2NUM(*((short*)ptr)); elem = INT2NUM(*((short*)ptr));
ptr = (char *)ptr + sizeof(short); ptr = (char *)ptr + sizeof(short);
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", t); rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
}; };
return elem; return elem;
}; };
@ -723,7 +723,7 @@ cary2ary(void *ptr, char t, int len)
elem = INT2NUM(*((short*)ptr)); elem = INT2NUM(*((short*)ptr));
ptr = (char *)ptr + sizeof(short); ptr = (char *)ptr + sizeof(short);
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", t); rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
}; };
rb_ary_push(ary, elem); rb_ary_push(ary, elem);
}; };
@ -746,7 +746,8 @@ rb_dlptr_aref(int argc, VALUE argv[], VALUE self)
}; };
if( TYPE(key) == T_FIXNUM || TYPE(key) == T_BIGNUM ){ if( TYPE(key) == T_FIXNUM || TYPE(key) == T_BIGNUM ){
VALUE pass[] = {num}; VALUE pass[1];
pass[0] = num;
return rb_dlptr_to_str(1, pass, rb_dlptr_plus(self, key)); return rb_dlptr_to_str(1, pass, rb_dlptr_plus(self, key));
}; };
@ -782,41 +783,34 @@ rb_dlptr_aref(int argc, VALUE argv[], VALUE self)
DLALIGN(data->ptr,offset,SHORT_ALIGN); DLALIGN(data->ptr,offset,SHORT_ALIGN);
break; break;
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
}; };
return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]); return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]);
}; };
switch( data->stype[i] ){ switch( data->stype[i] ){
case 'I': case 'I':
case 'i':
offset += sizeof(int) * data->ssize[i]; offset += sizeof(int) * data->ssize[i];
break; break;
case 'L': case 'L':
case 'l':
offset += sizeof(long) * data->ssize[i]; offset += sizeof(long) * data->ssize[i];
break; break;
case 'P': case 'P':
case 'p':
offset += sizeof(void*) * data->ssize[i]; offset += sizeof(void*) * data->ssize[i];
break; break;
case 'F': case 'F':
case 'f':
offset += sizeof(float) * data->ssize[i]; offset += sizeof(float) * data->ssize[i];
break; break;
case 'D': case 'D':
case 'd':
offset += sizeof(double) * data->ssize[i]; offset += sizeof(double) * data->ssize[i];
break; break;
case 'C': case 'C':
case 'c':
offset += sizeof(char) * data->ssize[i]; offset += sizeof(char) * data->ssize[i];
break; break;
case 'H': case 'H':
case 'h':
offset += sizeof(short) * data->ssize[i]; offset += sizeof(short) * data->ssize[i];
break; break;
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
}; };
}; };
break; break;
@ -918,7 +912,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
DLALIGN(data->ptr,offset,SHORT_ALIGN); DLALIGN(data->ptr,offset,SHORT_ALIGN);
break; break;
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
}; };
memimg = ary2cary(data->stype[i], val, &memsize); memimg = ary2cary(data->stype[i], val, &memsize);
memcpy((char *)data->ptr + offset, memimg, memsize); memcpy((char *)data->ptr + offset, memimg, memsize);
@ -954,7 +948,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
offset += sizeof(short) * data->ssize[i]; offset += sizeof(short) * data->ssize[i];
break; break;
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
}; };
}; };
return val; return val;
@ -985,7 +979,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
memsize = sizeof(short) * data->ssize[i]; memsize = sizeof(short) * data->ssize[i];
break; break;
default: default:
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
}; };
memimg = ary2cary(data->stype[i], val, NULL); memimg = ary2cary(data->stype[i], val, NULL);
memcpy(data->ptr, memimg, memsize); memcpy(data->ptr, memimg, memsize);

Просмотреть файл

@ -410,7 +410,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
} }
else{ else{
if( TYPE(argv[i]) != T_STRING ){ if( TYPE(argv[i]) != T_STRING ){
raise(rb_eDLError, "#%d must be a string",i); rb_raise(rb_eDLError, "#%d must be a string",i);
}; };
ANY2S(args[i]) = DLSTR(RSTRING(argv[i])->ptr); ANY2S(args[i]) = DLSTR(RSTRING(argv[i])->ptr);
}; };
@ -418,7 +418,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
break; break;
case 's': case 's':
if( TYPE(argv[i]) != T_STRING ){ if( TYPE(argv[i]) != T_STRING ){
raise(rb_eDLError, "#%d must be a string",i); rb_raise(rb_eDLError, "#%d must be a string",i);
}; };
ANY2S(args[i]) = DLSTR(dlmalloc(RSTRING(argv[i])->len + 1)); ANY2S(args[i]) = DLSTR(dlmalloc(RSTRING(argv[i])->len + 1));
memcpy((char*)(ANY2S(args[i])), RSTRING(argv[i])->ptr, RSTRING(argv[i])->len + 1); memcpy((char*)(ANY2S(args[i])), RSTRING(argv[i])->ptr, RSTRING(argv[i])->len + 1);

Просмотреть файл

@ -237,7 +237,7 @@ set_val = h["test_set_long_value","0"]
get_val = h["test_get_long_value","L"] get_val = h["test_get_long_value","L"]
lval = get_val[][0] lval = get_val[][0]
ptr = h["internal_long_value"] ptr = h["internal_long_value"]
ptr.struct!("l", :l) ptr.struct!("L", :l)
assert("get value", :must, ptr["l"] == lval) assert("get value", :must, ptr["l"] == lval)
assert("get value", :must, ptr[:l] == lval) unless (Fixnum === :-) assert("get value", :must, ptr[:l] == lval) unless (Fixnum === :-)
ptr["l"] = 200 ptr["l"] = 200