std::string jevois::getPythonExceptionString(boost::python::error_already_set &) { // Get some info from the python exception: PyObject *t, *v, *tb; try { PyErr_Fetch(&t, &v, &tb); PyErr_NormalizeException(&t, &v, &tb); } catch (...) { return "Internal error trying to fetch exception data from Python"; } try { boost::python::object objtype = ::ptr_to_obj(t); boost::python::object objvalue = ::ptr_to_obj(v); boost::python::object objtraceback = ::ptr_to_obj(tb); std::string const type = extract_exception_type(objtype); std::string const message = (type == "SyntaxError") ? make_syntax_error_message(objvalue) : extract_message(objvalue); traceback const traceback = extract_traceback(objtraceback); PyErr_Restore(t, v, tb); clear_exception(); return generate_message(type, message, traceback); } catch (...) { PyErr_Restore(t, v, tb); clear_exception(); return "Internal error trying to fetch exception data from Python"; } }
static void l2_restart_multi(struct FsmInst *fi, int event, void *arg) { struct layer2 *l2 = fi->userdata; struct sk_buff *skb = arg; int est = 0; send_uframe(l2, skb, UA | get_PollFlag(l2, skb), RSP); l2mgr(l2, MDL_ERROR_IND, (void *) 'F'); if (l2->vs != l2->va) { skb_queue_purge(&l2->i_queue); est = 1; } clear_exception(l2); l2->vs = 0; l2->va = 0; l2->vr = 0; l2->sow = 0; mISDN_FsmChangeState(fi, ST_L2_7); stop_t200(l2, 3); mISDN_FsmRestartTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3); if (est) l2up_create(l2, DL_ESTABLISH_IND, 0, NULL); /* mISDN_queue_data(&l2->inst, l2->inst.id | MSG_BROADCAST, * MGR_SHORTSTATUS | INDICATION, SSTATUS_L2_ESTABLISHED, * 0, NULL, 0); */ if (skb_queue_len(&l2->i_queue) && cansend(l2)) mISDN_FsmEvent(fi, EV_L2_ACK_PULL, NULL); }
static void l2_restart_multi(struct FsmInst *fi, int event, void *arg) { struct PStack *st = fi->userdata; struct sk_buff *skb = arg; int est = 0, state; state = fi->state; send_uframe(st, UA | get_PollFlagFree(st, skb), RSP); st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'F'); if (st->l2.vs != st->l2.va) { skb_queue_purge(&st->l2.i_queue); est = 1; } clear_exception(&st->l2); st->l2.vs = 0; st->l2.va = 0; st->l2.vr = 0; st->l2.sow = 0; FsmChangeState(fi, ST_L2_7); stop_t200(st, 3); FsmRestartTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 3); if (est) st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL); if ((ST_L2_7==state) || (ST_L2_8 == state)) if (!skb_queue_empty(&st->l2.i_queue) && cansend(st)) st->l2.l2l1(st, PH_PULL | REQUEST, NULL); }
static void l2_restart_multi(struct FsmInst *fi, int event, void *arg) { layer2_t *l2 = fi->userdata; msg_t *msg = arg; int est = 0; send_uframe(l2, msg, UA | get_PollFlag(l2, msg), RSP); l2mgr(l2, MDL_ERROR | INDICATION, (void *) 'F'); if (l2->vs != l2->va) { msg_queue_purge(&l2->i_queue); est = 1; } clear_exception(l2); l2->vs = 0; l2->va = 0; l2->vr = 0; l2->sow = 0; FsmChangeState(fi, ST_L2_7); stop_t200(l2, 3); FsmRestartTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3); if (est) l2up_create(l2, DL_ESTABLISH | INDICATION, CES(l2), 0, NULL); if (msg_queue_len(&l2->i_queue) && cansend(l2)) FsmEvent(fi, EV_L2_ACK_PULL, NULL); }
static void __attribute__((noreturn)) vm_exit(int status) { clear_exception(); vm_call_method(vm_java_lang_System_exit, status); if (exception_occurred()) vm_print_exception(exception_occurred()); error("System.exit() returned"); }
void semantics_instr(char* input, unsigned int in_size, char** output, unsigned int* out_size) { clear_exception(); #ifdef GDSL_X86 struct options options; options_init(&options); #endif state_t state = gdsl_init(); gdsl_set_code(state, input, in_size, 0); if(setjmp(*gdsl_err_tgt(state))) { snprintf(error_message, sizeof(error_message), "decode failed: %s", gdsl_get_error_message(state)); set_exception(); goto cleanup; } #ifdef GDSL_X86 int_t config = 0; config |= gdsl_config_mode64(state)*options.mode64; config |= gdsl_config_default_opnd_sz_32(state)*options.default_opnd_sz_32; obj_t insn = gdsl_decode(state, config); #else obj_t insn = gdsl_decode(state, gdsl_config_default(state)); #endif gdsl_get_ip(state); string_t fmt = gdsl_merge_rope(state, gdsl_pretty(state, insn)); /* string_t is a typedef for char* */ if(setjmp(*gdsl_err_tgt(state))) { snprintf(error_message, sizeof(error_message), "translate failed: %s", gdsl_get_error_message(state)); set_exception(); goto cleanup; } obj_t rreil = gdsl_translate(state, insn); fmt = gdsl_merge_rope(state, gdsl_rreil_pretty(state, rreil)); size_t outputSize = strlen(fmt)+1; *output = malloc(outputSize); strncpy(*output, fmt, outputSize); *out_size = outputSize - 1; // Python expects size without null... cleanup: gdsl_reset_heap(state); gdsl_destroy(state); }
static void establishlink(struct FsmInst *fi) { struct layer2 *l2 = fi->userdata; u_char cmd; clear_exception(l2); l2->rc = 0; cmd = (test_bit(FLG_MOD128, &l2->flag) ? SABME : SABM) | 0x10; send_uframe(l2, NULL, cmd, CMD); mISDN_FsmDelTimer(&l2->t203, 1); restart_t200(l2, 1); test_and_clear_bit(FLG_PEND_REL, &l2->flag); freewin(l2); mISDN_FsmChangeState(fi, ST_L2_5); }
static void establishlink(struct FsmInst *fi) { struct PStack *st = fi->userdata; u_char cmd; clear_exception(&st->l2); st->l2.rc = 0; cmd = (test_bit(FLG_MOD128, &st->l2.flag) ? SABME : SABM) | 0x10; send_uframe(st, cmd, CMD); FsmDelTimer(&st->l2.t203, 1); restart_t200(st, 1); test_and_clear_bit(FLG_PEND_REL, &st->l2.flag); freewin(st); FsmChangeState(fi, ST_L2_5); }
static void l2_start_multi(struct FsmInst *fi, int event, void *arg) { struct PStack *st = fi->userdata; struct sk_buff *skb = arg; send_uframe(st, UA | get_PollFlagFree(st, skb), RSP); clear_exception(&st->l2); st->l2.vs = 0; st->l2.va = 0; st->l2.vr = 0; st->l2.sow = 0; FsmChangeState(fi, ST_L2_7); FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 3); st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL); }
SWIGEXPORT void JNICALL Java_drawerControllib_DrawerControlJNI_openDrawer(JNIEnv *jenv, jclass jcls) { (void)jenv; (void)jcls; { char *err; clear_exception(); openDrawer(); err = check_exception(); if (err!=NULL) { { SWIG_JavaException(jenv, SWIG_IOError, err); return ; }; } } }
static void l2_start_multi(struct FsmInst *fi, int event, void *arg) { struct layer2 *l2 = fi->userdata; struct sk_buff *skb = arg; l2->vs = 0; l2->va = 0; l2->vr = 0; l2->sow = 0; clear_exception(l2); send_uframe(l2, NULL, UA | get_PollFlag(l2, skb), RSP); mISDN_FsmChangeState(fi, ST_L2_7); mISDN_FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3); skb_trim(skb, 0); l2up(l2, DL_ESTABLISH_IND, skb); if (l2->tm) l2_tei(l2, MDL_STATUS_UP_IND, 0); }
static void l2_start_multi(struct FsmInst *fi, int event, void *arg) { layer2_t *l2 = fi->userdata; msg_t *msg = arg; send_uframe(l2, NULL, UA | get_PollFlag(l2, msg), RSP); clear_exception(l2); l2->vs = 0; l2->va = 0; l2->vr = 0; l2->sow = 0; FsmChangeState(fi, ST_L2_7); FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3); msg_trim(msg, 0); msg_push(msg, mISDNUSER_HEAD_SIZE); if (l2up(l2, DL_ESTABLISH | INDICATION, CES(l2), msg)) free_msg(msg); }
SWIGEXPORT jint JNICALL Java_drawerControllib_DrawerControlJNI_getStatus(JNIEnv *jenv, jclass jcls) { jint jresult = 0 ; Status result; (void)jenv; (void)jcls; { char *err; clear_exception(); result = (Status)getStatus(); err = check_exception(); if (err!=NULL) { { SWIG_JavaException(jenv, SWIG_IOError, err); return 0; }; } } jresult = (jint)result; return jresult; }