summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-15 05:43:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-15 05:43:28 +0000
commit2631e080db1e1dde9603d6bfa6f2f6f21fd7c628 (patch)
tree4c4e8c773950d0e980c260123753b0a24d9cfc62 /error.c
parentc25084921670dfe33a0871ee7b94c102fea0ea3a (diff)
ruby 1.1b9_20
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/error.c b/error.c
index 937e497673..41578c9112 100644
--- a/error.c
+++ b/error.c
@@ -474,11 +474,29 @@ set_syserr(i, name)
int i;
char *name;
{
+#ifdef __BEOS__
+ VALUE *list;
+ int ix, offset;
+#endif
VALUE error = rb_define_class_under(mErrno, name, eSystemCallError);
rb_define_const(error, "Errno", INT2FIX(i));
+#ifdef __BEOS__
+ i -= B_GENERAL_ERROR_BASE;
+ ix = (i >> 12) & 0xf;
+ offset = (i >> 8) & 0xf;
+ if (offset < syserr_index[ix].n) {
+ ix = syserr_index[ix].ix;
+ if ((i & 0xff) < syserr_list[ix + offset].n) {
+ list = syserr_list[ix + offset].list;
+ list[i & 0xff] = error;
+ rb_global_variable(&list[i & 0xff]);
+ }
+ }
+#else
if (i <= sys_nerr) {
syserr_list[i] = error;
}
+#endif
return error;
}
@@ -707,12 +725,24 @@ rb_sys_fail(mesg)
static void
init_syserr()
{
+#ifdef __BEOS__
+ int i, ix, offset;
+#endif
eSystemCallError = rb_define_class("SystemCallError", eStandardError);
rb_define_method(eSystemCallError, "errno", syserr_errno, 0);
mErrno = rb_define_module("Errno");
+#ifdef __BEOS__
+ for (i = 0; syserr_index[i].n != 0; i++) {
+ ix = syserr_index[i].ix;
+ for (offset = 0; offset < syserr_index[i].n; offset++) {
+ MEMZERO(syserr_list[ix + offset].list, VALUE, syserr_list[ix + offset].n);
+ }
+ }
+#else
syserr_list = ALLOC_N(VALUE, sys_nerr+1);
MEMZERO(syserr_list, VALUE, sys_nerr+1);
+#endif
#ifdef EPERM
set_syserr(EPERM, "EPERM");