mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
3bd7404423
commit
3a202ff2b4
4 changed files with 19 additions and 19 deletions
|
@ -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>
|
||||
|
||||
* ext/dl: Add dl.txt instead of README and README.html.
|
||||
|
|
26
ext/dl/ptr.c
26
ext/dl/ptr.c
|
@ -549,7 +549,7 @@ rb_dlptr_define_data_type(int argc, VALUE argv[], VALUE self)
|
|||
return Qnil;
|
||||
}
|
||||
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));
|
||||
ptr = (char *)ptr + sizeof(short);
|
||||
default:
|
||||
raise(rb_eDLTypeError, "unsupported type '%c'", t);
|
||||
rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
|
||||
};
|
||||
return elem;
|
||||
};
|
||||
|
@ -723,7 +723,7 @@ cary2ary(void *ptr, char t, int len)
|
|||
elem = INT2NUM(*((short*)ptr));
|
||||
ptr = (char *)ptr + sizeof(short);
|
||||
default:
|
||||
raise(rb_eDLTypeError, "unsupported type '%c'", t);
|
||||
rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
|
||||
};
|
||||
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 ){
|
||||
VALUE pass[] = {num};
|
||||
VALUE pass[1];
|
||||
pass[0] = num;
|
||||
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);
|
||||
break;
|
||||
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]);
|
||||
};
|
||||
switch( data->stype[i] ){
|
||||
case 'I':
|
||||
case 'i':
|
||||
offset += sizeof(int) * data->ssize[i];
|
||||
break;
|
||||
case 'L':
|
||||
case 'l':
|
||||
offset += sizeof(long) * data->ssize[i];
|
||||
break;
|
||||
case 'P':
|
||||
case 'p':
|
||||
offset += sizeof(void*) * data->ssize[i];
|
||||
break;
|
||||
case 'F':
|
||||
case 'f':
|
||||
offset += sizeof(float) * data->ssize[i];
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
offset += sizeof(double) * data->ssize[i];
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
offset += sizeof(char) * data->ssize[i];
|
||||
break;
|
||||
case 'H':
|
||||
case 'h':
|
||||
offset += sizeof(short) * data->ssize[i];
|
||||
break;
|
||||
default:
|
||||
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
|
||||
rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
@ -918,7 +912,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
|
|||
DLALIGN(data->ptr,offset,SHORT_ALIGN);
|
||||
break;
|
||||
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);
|
||||
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];
|
||||
break;
|
||||
default:
|
||||
raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
|
||||
rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
|
||||
};
|
||||
};
|
||||
return val;
|
||||
|
@ -985,7 +979,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
|
|||
memsize = sizeof(short) * data->ssize[i];
|
||||
break;
|
||||
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);
|
||||
memcpy(data->ptr, memimg, memsize);
|
||||
|
|
|
@ -410,7 +410,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
|
|||
}
|
||||
else{
|
||||
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);
|
||||
};
|
||||
|
@ -418,7 +418,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
|
|||
break;
|
||||
case 's':
|
||||
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));
|
||||
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"]
|
||||
lval = get_val[][0]
|
||||
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) unless (Fixnum === :-)
|
||||
ptr["l"] = 200
|
||||
|
|
Loading…
Add table
Reference in a new issue