static void operation (long long value, char oper) { /* uses globals par[], id.error[], op[], val[] * operation executed if the next one is on same or lower level */ /* something to calc? */ if(id.valid == true) { /* add new items to stack */ PUSH(op, oper); PUSH(val, value); /* more than 1 operator */ if(op.idx > par.opx[par.idx]) { /* but only one value */ if(val.idx == par.vax[par.idx]) { apply_prefix(); } else { /* evaluate all possible operations */ eval_stack(); } } /* next a number needed */ id.valid = false; } else { /* pre- or post-operators instead of in-betweens? */ unary(oper); } }
VALUE throw_exc(VALUE self, int argc, VALUE *argv) { /* argv[0] == VALUE string descrip; argv[1] == optional exception class being thrown (default `Exception') */ int i, len; VALUE buf, thr, ret, exc_type; VALUE exc; thr = cur_thr; exc = THREAD(thr)->excobj; while (!TEST(exc) && TEST(thr)) { thr = THREAD(thr)->up; if (TEST(thr)) exc = THREAD(thr)->excobj; else exc = Qnil; } if (!TEST(exc)) { if ( (argc > 0) && argv[0] && (TYPE(argv[0]) == T_STRING) ) fail(str2cstr(argv[0])); else fail("unhandled exception"); } if ((argc > 0) && (argv[0]) && TEST(argv[0])) EXCEPTION(exc)->strerror = argv[0]; else EXCEPTION(exc)->strerror = string_new("(details of exception unspecified)"); if (argc > 1) exc_type = argv[1]; else exc_type = cException; if (!TEST(exc) || !kind_of_p(exc, exc_type)) fail("uncaught exception"); if (TEST(EXCEPTION(exc)->rescue_thr)) { thr = cur_thr; cur_thr = EXCEPTION(exc)->rescue_thr; eval_stack( THREAD(EXCEPTION(exc)->rescue_thr)->stack ); ret = Qbreak; cur_thr = thr; } else { ret = THREAD(cur_thr)->last; cur_thr = EXCEPTION(exc)->thr; } return ret; }