void piglit_init(int argc, char **argv) { bool pass = true; GetDebugMessageLog = GET_FUNC(glGetDebugMessageLog); DebugMessageInsert = GET_FUNC(glDebugMessageInsert); DebugMessageControl = GET_FUNC(glDebugMessageControl); PushDebugGroup = GET_FUNC(glPushDebugGroup); PopDebugGroup = GET_FUNC(glPopDebugGroup); piglit_require_extension("GL_KHR_debug"); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glEnable(GL_DEBUG_OUTPUT); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); /* clear_message_log */ while(fetch_one_log_message()) /* empty */ ; /* test message control and debug groups */ pass = test_push_pop_debug_group(); pass = test_push_pop_group_inheritance() && pass; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
/** * \ingroup python_interface_rng * \brief Sets the random number generator used by igraph. */ PyObject* igraph_rng_Python_set_generator(PyObject* self, PyObject* object) { igraph_i_rng_Python_state_t new_state, old_state; PyObject* func; if (object == Py_None) { /* Reverting to the default igraph random number generator instead * of the Python-based one */ igraph_rng_set_default(igraph_rng_default()); Py_RETURN_NONE; } #define GET_FUNC(name) {\ func = PyObject_GetAttrString(object, name); \ if (func == 0) \ return NULL; \ if (!PyCallable_Check(func)) {\ PyErr_SetString(PyExc_TypeError, name "attribute must be callable"); \ return NULL; \ } \ } GET_FUNC("randint"); new_state.randint_func = func; GET_FUNC("random"); new_state.random_func = func; GET_FUNC("gauss"); new_state.gauss_func = func; old_state = igraph_rng_Python_state; igraph_rng_Python_state = new_state; Py_XDECREF(old_state.randint_func); Py_XDECREF(old_state.random_func); Py_XDECREF(old_state.gauss_func); igraph_rng_set_default(&igraph_rng_Python); Py_RETURN_NONE; }
void piglit_init(int argc, char **argv) { bool pass = true; ObjectPtrLabel = GET_FUNC(glObjectPtrLabel); GetObjectPtrLabel = GET_FUNC(glGetObjectPtrLabel); ObjectLabel = GET_FUNC(glObjectLabel); GetObjectLabel = GET_FUNC(glGetObjectLabel); #ifdef PIGLIT_USE_OPENGL piglit_require_gl_version(15); #endif piglit_require_extension("GL_KHR_debug"); pass = test_object_label_types() && pass; pass = test_object_label() && pass; pass = test_get_object_label() && pass; /* Test only if is GLES 3.0 or GL 3.2 or has ARB_sync */ if ((piglit_is_gles() && piglit_get_gl_version() >= 30) || piglit_get_gl_version() >= 32 || piglit_is_extension_supported("GL_ARB_sync")) pass = test_object_ptr_label() && pass; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
static m64p_error plugin_connect_input(m64p_dynlib_handle plugin_handle) { /* attach the Input plugin function pointers */ if (plugin_handle != NULL) { m64p_plugin_type PluginType; int PluginVersion, APIVersion; if (l_InputAttached) return M64ERR_INVALID_STATE; if (!GET_FUNC(ptr_PluginGetVersion, input.getVersion, "PluginGetVersion") || !GET_FUNC(ptr_ControllerCommand, input.controllerCommand, "ControllerCommand") || !GET_FUNC(ptr_GetKeys, input.getKeys, "GetKeys") || !GET_FUNC(ptr_InitiateControllers, input.initiateControllers, "InitiateControllers") || !GET_FUNC(ptr_ReadController, input.readController, "ReadController") || !GET_FUNC(ptr_RomOpen, input.romOpen, "RomOpen") || !GET_FUNC(ptr_RomClosed, input.romClosed, "RomClosed") || !GET_FUNC(ptr_SDL_KeyDown, input.keyDown, "SDL_KeyDown") || !GET_FUNC(ptr_SDL_KeyUp, input.keyUp, "SDL_KeyUp")) { DebugMessage(M64MSG_ERROR, "broken Input plugin; function(s) not found."); plugin_disconnect_input(); return M64ERR_INPUT_INVALID; } /* check the version info */ (*input.getVersion)(&PluginType, &PluginVersion, &APIVersion, NULL, NULL); if (PluginType != M64PLUGIN_INPUT || (APIVersion & 0xffff0000) != (INPUT_API_VERSION & 0xffff0000)) { DebugMessage(M64MSG_ERROR, "incompatible Input plugin"); plugin_disconnect_input(); return M64ERR_INCOMPATIBLE; } if (APIVersion < 0x020001) { input.renderCallback = NULL; // not supported in earlier input plugins } else { if (!GET_FUNC(ptr_RenderCallback, input.renderCallback, "RenderCallback")) { DebugMessage(M64MSG_INFO, "input plugin did not specify a render callback; there will be no on screen display by the input plugin."); } } l_InputAttached = 1; } else plugin_disconnect_input(); return M64ERR_SUCCESS; }
int32 rp64 (int32 dev, int32 pulse, int32 dat) { int32 u, f, c, sb; UNIT *uptr; sb = pulse & 060; if (pulse & 01) { if (sb == 020) /* DPSN */ dat = IOT_SKP | dat; } if (pulse & 02) { if (sb == 000) { /* DPOU */ u = GET_UNIT (rp_sta); uptr = rp_dev.units + u; /* select unit */ dat = dat | uptr->CYL | ((uptr->flags & UNIT_RP03)? CCYL_RP03: 0); } else if (sb == 020) /* DPOA */ dat = dat | rp_da; else if (sb == 040) /* DPOC */ dat = dat | rp_ma; else if (sb == 060) /* DPOW */ dat = dat | rp_wc; } if (pulse & 04) { if (sb == 000) { /* DPCF */ rp_reset (&rp_dev); /* reset dev */ return dat; } if (rp_busy != 0) { /* others: busy? */ rp_updsta (0, STB_PGE); /* prog error */ return dat; } if (sb == 020) /* DPLZ */ rp_sta = rp_sta & (dat | ~STA_RW); else if (sb == 040) /* DPLO */ rp_sta = rp_sta | (dat & STA_RW); else if (sb == 060) /* DPLF */ rp_sta = (rp_sta & ~STA_RW) | (dat & STA_RW); u = GET_UNIT (rp_sta); /* get unit num */ uptr = rp_dev.units + u; /* select unit */ if ((rp_sta & STA_GO) && !sim_is_active (uptr)) { f = uptr->FUNC = GET_FUNC (rp_sta); /* get function */ rp_busy = 1; /* set ctrl busy */ rp_sta = rp_sta & ~STA_HNF; /* clear flag */ rp_stb = rp_stb & ~(STB_FME | STB_WPE | STB_LON | STB_WCE | STB_TME | STB_PGE | STB_EOP | (1 << (STB_V_ATT0 - u))); if (((uptr->flags & UNIT_ATT) == 0) || (f == FN_IDLE) || (f == FN_SEEK) || (f == FN_RECAL)) sim_activate (uptr, RP_MIN); /* short delay */ else { c = GET_CYL (rp_da, uptr->flags); c = abs (c - uptr->CYL) * rp_swait; /* seek time */ sim_activate (uptr, MAX (RP_MIN, c + rp_rwait)); rp_sta = rp_sta & ~STA_DON; /* clear done */ } } } rp_updsta (0, 0); return dat; }
/** * call the python function to intercept the handshake packet * * @return PROXY_SEND_QUERY to send the packet from the client * PROXY_NO_DECISION to pass the server packet unmodified */ static network_mysqld_python_stmt_ret proxy_python_read_handshake(network_mysqld_con *con) { network_mysqld_con_python_t *st = con->plugin_con_state; network_mysqld_python_stmt_ret ret = PROXY_NO_DECISION; if(!CHECK_FUNC(read_handshake)) return ret; PyObject *result = PyObject_CallFunctionObjArgs( GET_FUNC(read_handshake), st->proxy, NULL); GET_PYTHON_RESULT(read_handshake) switch(ret) { case PROXY_NO_DECISION: break; case PROXY_SEND_QUERY: g_warning("%s.%d: (read_handshake) return proxy.PROXY_SEND_QUERY is " "deprecated, use PROXY_SEND_RESULT instead", __FILE__, __LINE__); ret = PROXY_SEND_RESULT; case PROXY_SEND_RESULT: if(network_mysqld_con_python_handle_proxy_response(con, st->proxy)) network_mysqld_con_send_error(con->client, C("(python) handling " "proxy.response failed, check error-log")); break; default: ret = PROXY_NO_DECISION; break; } return ret; }
MystemFormsHandle* TSimpleLemmer::GetFormsHandleInner(TSymbol* text, int len, ui32 requiredRuleId) { MystemFormsHandle* f = NULL; MystemAnalysesHandle* analyses = GET_FUNC(Lib, MystemAnalyze)(text, len); size_t count = GET_FUNC(Lib, MystemAnalysesCount)(analyses); for (size_t i = 0; i != count; ++i) { MystemLemmaHandle* h = GET_FUNC(Lib, MystemLemma)(analyses, i); ui32 ruleId = GET_FUNC(Lib, MystemLemmaRuleId)(h); if (ruleId == requiredRuleId) { f = GET_FUNC(Lib, MystemGenerate)(h); ++i; if (i != count) { for(; i != count; ++i) { MystemLemmaHandle* h2 = GET_FUNC(Lib, MystemLemma)(analyses, i); ui32 ruleId = GET_FUNC(Lib, MystemLemmaRuleId)(h2); } } break; } } DeleteAnalyses(analyses); return f; }
void s3c_gpio_mode(unsigned gpio_mode) { unsigned group, func, bit, offset, gpio; uint32_t reg; group = GET_GROUP(gpio_mode); func = GET_FUNC(gpio_mode); bit = GET_BIT(gpio_mode); gpio = GET_GPIO_NO(gpio_mode); if (group == 0) { /* GPA is special */ switch (func) { case 0: /* GPIO input */ pr_debug("Cannot set GPA pin to GPIO input\n"); break; case 1: /* GPIO output */ gpio_direction_output(bit, GET_GPIOVAL(gpio_mode)); break; default: reg = readl(S3C_GPACON); reg |= 1 << bit; writel(reg, S3C_GPACON); break; } return; } offset = group_offset[group]; if (PU_PRESENT(gpio_mode)) { reg = readl(S3C_GPACON + offset + 8); if (GET_PU(gpio_mode)) reg |= (1 << bit); /* set means _disabled_ */ else reg &= ~(1 << bit); writel(reg, S3C_GPACON + offset + 8); } switch (func) { case 0: /* input */ gpio_direction_input(gpio); break; case 1: /* output */ gpio_direction_output(gpio, GET_GPIOVAL(gpio_mode)); break; case 2: /* function one */ case 3: /* function two */ reg = readl(S3C_GPACON + offset); reg &= ~(0x3 << (bit << 1)); reg |= func << (bit << 1); writel(reg, S3C_GPACON + offset); break; } }
CELL make_func(char *name, void *entry, LABEL receiver, int min_args, int max_args) { CELL cell = gc_alloc(FUNC); FUNC* p = GET_FUNC(cell); p->name = name; p->func_entry = entry; p->receiver = receiver; p->min_args = min_args; p->max_args = max_args; return cell; }
size_t TSimpleLemmer::AnalyzeWord(const TChar* word, size_t len, TWLemmaArray& out, TLangMask langmask, const docLanguage* doclangs, const TAnalyzeWordOpt& opt) { UNUSED(langmask); UNUSED(doclangs); UNUSED(opt); //Cerr << "AnalyzeWord: " << word << " " << len << Endl; TSymbol* w = const_cast<TSymbol*>(word); MystemAnalysesHandle* analyses = GET_FUNC(Lib, MystemAnalyze)(w, len); Wtroka src = Wtroka(word).substr(0, len); return CopyFromMystem(analyses, src, out); }
static m64p_error plugin_connect_rsp(m64p_dynlib_handle plugin_handle) { /* attach the RSP plugin function pointers */ if (plugin_handle != NULL) { m64p_plugin_type PluginType; int PluginVersion, APIVersion; if (l_RspAttached) return M64ERR_INVALID_STATE; if (!GET_FUNC(ptr_PluginGetVersion, rsp.getVersion, "PluginGetVersion") || !GET_FUNC(ptr_DoRspCycles, rsp.doRspCycles, "DoRspCycles") || !GET_FUNC(ptr_InitiateRSP, rsp.initiateRSP, "InitiateRSP") || !GET_FUNC(ptr_RomClosed, rsp.romClosed, "RomClosed")) { DebugMessage(M64MSG_ERROR, "broken RSP plugin; function(s) not found."); plugin_disconnect_rsp(); return M64ERR_INPUT_INVALID; } /* check the version info */ (*rsp.getVersion)(&PluginType, &PluginVersion, &APIVersion, NULL, NULL); if (PluginType != M64PLUGIN_RSP || (APIVersion & 0xffff0000) != (RSP_API_VERSION & 0xffff0000)) { DebugMessage(M64MSG_ERROR, "incompatible RSP plugin"); plugin_disconnect_rsp(); return M64ERR_INCOMPATIBLE; } l_RspAttached = 1; } else plugin_disconnect_rsp(); return M64ERR_SUCCESS; }
static network_mysqld_python_stmt_ret proxy_python_read_auth(network_mysqld_con *con) { network_mysqld_python_stmt_ret ret = PROXY_NO_DECISION; network_mysqld_con_python_t *st = con->plugin_con_state; if(!CHECK_FUNC(read_auth)) return ret; PyObject *result = PyObject_CallFunctionObjArgs( GET_FUNC(read_auth), st->proxy, NULL); GET_PYTHON_RESULT(read_auth) switch(ret) { case PROXY_NO_DECISION: break; case PROXY_SEND_RESULT: /* answer directly */ if (network_mysqld_con_python_handle_proxy_response(con, st->proxy)) network_mysqld_con_send_error(con->client, C("(python) handling " "proxy.response failed, check error-log")); break; case PROXY_SEND_QUERY: /* something is in the injection queue, pull it from there and replace * the content of original packet */ if (st->injected.queries->length) ret = PROXY_SEND_INJECTION; else ret = PROXY_NO_DECISION; break; default: ret = PROXY_NO_DECISION; break; } return ret; }
int TSimpleLemmer::GetFormTextLen(MystemFormHandle* h) { return GET_FUNC(Lib, MystemFormTextLen)(h); }
static m64p_error plugin_connect_gfx(m64p_dynlib_handle plugin_handle) { /* attach the Video plugin function pointers */ if (plugin_handle != NULL) { m64p_plugin_type PluginType; int PluginVersion, APIVersion; if (l_GfxAttached) return M64ERR_INVALID_STATE; /* set function pointers for required functions */ if (!GET_FUNC(ptr_PluginGetVersion, gfx.getVersion, "PluginGetVersion") || !GET_FUNC(ptr_ChangeWindow, gfx.changeWindow, "ChangeWindow") || !GET_FUNC(ptr_InitiateGFX, gfx.initiateGFX, "InitiateGFX") || !GET_FUNC(ptr_MoveScreen, gfx.moveScreen, "MoveScreen") || !GET_FUNC(ptr_ProcessDList, gfx.processDList, "ProcessDList") || !GET_FUNC(ptr_ProcessRDPList, gfx.processRDPList, "ProcessRDPList") || !GET_FUNC(ptr_RomClosed, gfx.romClosed, "RomClosed") || !GET_FUNC(ptr_RomOpen, gfx.romOpen, "RomOpen") || !GET_FUNC(ptr_ShowCFB, gfx.showCFB, "ShowCFB") || !GET_FUNC(ptr_UpdateScreen, gfx.updateScreen, "UpdateScreen") || !GET_FUNC(ptr_ViStatusChanged, gfx.viStatusChanged, "ViStatusChanged") || !GET_FUNC(ptr_ViWidthChanged, gfx.viWidthChanged, "ViWidthChanged") || !GET_FUNC(ptr_ReadScreen2, gfx.readScreen, "ReadScreen2") || !GET_FUNC(ptr_SetRenderingCallback, gfx.setRenderingCallback, "SetRenderingCallback") || !GET_FUNC(ptr_FBRead, gfx.fBRead, "FBRead") || !GET_FUNC(ptr_FBWrite, gfx.fBWrite, "FBWrite") || !GET_FUNC(ptr_FBGetFrameBufferInfo, gfx.fBGetFrameBufferInfo, "FBGetFrameBufferInfo")) { DebugMessage(M64MSG_ERROR, "broken Video plugin; function(s) not found."); plugin_disconnect_gfx(); return M64ERR_INPUT_INVALID; } /* set function pointers for optional functions */ gfx.resizeVideoOutput = (ptr_ResizeVideoOutput) osal_dynlib_getproc(plugin_handle, "ResizeVideoOutput"); /* check the version info */ (*gfx.getVersion)(&PluginType, &PluginVersion, &APIVersion, NULL, NULL); if (PluginType != M64PLUGIN_GFX || (APIVersion & 0xffff0000) != (GFX_API_VERSION & 0xffff0000)) { DebugMessage(M64MSG_ERROR, "incompatible Video plugin"); plugin_disconnect_gfx(); return M64ERR_INCOMPATIBLE; } /* handle backwards-compatibility */ if (APIVersion < 0x020100) { DebugMessage(M64MSG_WARNING, "Fallback for Video plugin API (%02i.%02i.%02i) < 2.1.0. Screenshots may contain On Screen Display text", VERSION_PRINTF_SPLIT(APIVersion)); // tell the video plugin to make its rendering callback to me (it's old, and doesn't have the bScreenRedrawn flag) gfx.setRenderingCallback(backcompat_videoRenderCallback); l_old1SetRenderingCallback = gfx.setRenderingCallback; // save this just for future use gfx.setRenderingCallback = (ptr_SetRenderingCallback) backcompat_setRenderCallbackIntercept; } if (APIVersion < 0x20200 || gfx.resizeVideoOutput == NULL) { DebugMessage(M64MSG_WARNING, "Fallback for Video plugin API (%02i.%02i.%02i) < 2.2.0. Resizable video will not work", VERSION_PRINTF_SPLIT(APIVersion)); gfx.resizeVideoOutput = dummyvideo_ResizeVideoOutput; } l_GfxAttached = 1; } else plugin_disconnect_gfx(); return M64ERR_SUCCESS; }
static m64p_error plugin_connect_audio(m64p_dynlib_handle plugin_handle) { /* attach the Audio plugin function pointers */ if (plugin_handle != NULL) { m64p_plugin_type PluginType; int PluginVersion, APIVersion; if (l_AudioAttached) return M64ERR_INVALID_STATE; if (!GET_FUNC(ptr_PluginGetVersion, audio.getVersion, "PluginGetVersion") || !GET_FUNC(ptr_AiDacrateChanged, audio.aiDacrateChanged, "AiDacrateChanged") || !GET_FUNC(ptr_AiLenChanged, audio.aiLenChanged, "AiLenChanged") || !GET_FUNC(ptr_InitiateAudio, audio.initiateAudio, "InitiateAudio") || !GET_FUNC(ptr_ProcessAList, audio.processAList, "ProcessAList") || !GET_FUNC(ptr_RomOpen, audio.romOpen, "RomOpen") || !GET_FUNC(ptr_RomClosed, audio.romClosed, "RomClosed") || !GET_FUNC(ptr_SetSpeedFactor, audio.setSpeedFactor, "SetSpeedFactor") || !GET_FUNC(ptr_VolumeUp, audio.volumeUp, "VolumeUp") || !GET_FUNC(ptr_VolumeDown, audio.volumeDown, "VolumeDown") || !GET_FUNC(ptr_VolumeGetLevel, audio.volumeGetLevel, "VolumeGetLevel") || !GET_FUNC(ptr_VolumeSetLevel, audio.volumeSetLevel, "VolumeSetLevel") || !GET_FUNC(ptr_VolumeMute, audio.volumeMute, "VolumeMute") || !GET_FUNC(ptr_VolumeGetString, audio.volumeGetString, "VolumeGetString")) { DebugMessage(M64MSG_ERROR, "broken Audio plugin; function(s) not found."); plugin_disconnect_audio(); return M64ERR_INPUT_INVALID; } /* check the version info */ (*audio.getVersion)(&PluginType, &PluginVersion, &APIVersion, NULL, NULL); if (PluginType != M64PLUGIN_AUDIO || (APIVersion & 0xffff0000) != (AUDIO_API_VERSION & 0xffff0000)) { DebugMessage(M64MSG_ERROR, "incompatible Audio plugin"); plugin_disconnect_audio(); return M64ERR_INCOMPATIBLE; } l_AudioAttached = 1; } else plugin_disconnect_audio(); return M64ERR_SUCCESS; }
void internal_generic_output(FILE* fp, CELL cell, int strict, int tab) { switch(GET_TYPE(cell)) { case T_VOID: fputs("#<void>", fp); break; case T_NULL: fputs("()", fp); break; case T_UNDEFINED: fputs("#<undefined>", fp); break; case T_EMPTY: fputs("#<empty>", fp); break; case T_BOOL: fputs(GET_BOOL(cell) ? "#t" : "#f", fp); break; case T_CHAR: { CHAR ch = GET_CHAR(cell); if (strict) { switch(ch) { case ' ': fputs("#\\space", fp); break; case 0: fputs("#\\nul", fp); break; case 27: fputs("#\\escape", fp); break; case 127: fputs("#\\rubout", fp); break; case '\a': fputs("#\\alarm", fp); break; case '\b': fputs("#\\backspace", fp); break; case '\f': fputs("#\\page", fp); break; case '\n': fputs("#\\newline", fp); break; case '\r': fputs("#\\return", fp); break; case '\t': fputs("#\\tab", fp); break; case '\v': fputs("#\\vtab", fp); break; default: fprintf(fp, "#\\%c", ch); break; } } else { fputc(ch, fp); } } break; case T_INT: fprintf(fp, "%d", GET_INT(cell)); break; case T_BIGINT: fprintf(fp, "%lld", GET_BIGINT(cell)); break; case T_FLOAT: fprintf(fp, "%f", GET_FLOAT(cell)); break; case T_STRING: { STRING* p = GET_STRING(cell); size_t len = p->len; char* data = p->data; if (strict) { // FIXME -- make this more efficient, and escape other special chars? fputc('"', fp); while(len--) { char ch = *data++; if (ch == '"' || ch == '\\') { fputc('\\', fp); } fputc(ch, fp); } fputc('"', fp); } else { fwrite(data, 1, len, fp); } } break; case T_NAME: { NAME* p = GET_NAME(cell); if (p->gensym) { fprintf(fp, "#_%d", p->gensym); } else { fwrite(GET_NAME(cell)->data, 1, GET_NAME(cell)->len, fp); } } break; case T_KEYWORD: { KEYWORD* p = GET_KEYWORD(cell); fwrite(p->data, 1, p->len, fp); fputc(':', fp); } break; case T_SLOT: fprintf(fp, "#<slot:%d>", GET_SLOT(cell)); break; // FIXME - arbitrary recursion case T_CONS: fputc('(', fp); if (tab) ++tab; int did = 0; while(1) { int pair = CONSP(CAR(cell)); if (!did && tab && pair && !CONSP(CAR(CAR(cell)))) { fprintf(fp, "\n%*s", (tab-1)*2, ""); } internal_generic_output(fp, CAR(cell), strict, tab); cell = CDR(cell); if (NULLP(cell)) { break; } did = (tab && pair); if (did) { fprintf(fp, "\n%*s", (tab-1)*2, ""); } else fputc(' ', fp); if (!CONSP(cell)) { fputs(". ", fp); internal_generic_output(fp, cell, strict, tab); break; } } fputc(')', fp); break; // FIXME - arbitrary recursion case T_VECTOR: { VECTOR *vec = GET_VECTOR(cell); fputs("#(", fp); if (vec->len > 0) { int i = 0; internal_generic_output(fp, vec->data[i++], strict, tab); while(i < vec->len) { fputc(' ', fp); internal_generic_output(fp, vec->data[i++], strict, tab); } } fputc(')', fp); break; } case T_FUNC: fprintf(fp, "#<primitive:%s>", GET_FUNC(cell)->name); break; case T_COMPILED_LAMBDA: fprintf(fp, "#<compiled-lambda:0x%08x>", AS_LITERAL(cell)); break; { if (tab) ++tab; COMPILED_LAMBDA *l = GET_COMPILED_LAMBDA(cell); fprintf(fp, "#<%s %d%s:%d/%d", l->is_macro ? "macro" : "lambda", l->argc, l->rest ? "+" : "", l->depth, l->max_slot); if (tab) { fprintf(fp, "\n%*s", (tab-1)*2, ""); } else { fputc(' ', fp); } internal_generic_output(fp, l->body, strict, tab); fputc('>', fp); } break; case T_CLOSURE: fprintf(fp, "#<closure:0x%08x>", AS_LITERAL(cell)); break; { if (tab) ++tab; CLOSURE *c = GET_CLOSURE(cell); fprintf(fp, "#<closure "); if (tab) { fprintf(fp, "\n%*s", (tab-1)*2, ""); } internal_print_env(fp, c->env); if (tab) { fprintf(fp, "\n%*s", (tab-1)*2, ""); } fputc(' ', fp); internal_generic_output(fp, c->compiled_lambda, strict, tab); fputc('>', fp); } break; case T_EXCEPTION: fputs("#<exception:", fp); fwrite(GET_EXCEPTION(cell)->data, 1, GET_EXCEPTION(cell)->len, fp); fputc('>', fp); break; case T_REIFIED_CONTINUATION: fprintf(fp, "#<continuation:0x%08x>", (int)GET_REIFIED_CONTINUATION(cell)->cont); break; case T_STACK_FRAME: { STACK_FRAME* p = GET_STACK_FRAME(cell); fputs("#<stack-frame [", fp); int i; for(i = 0; i < p->len; ++i) { if (i) fputc(' ', fp); fprintf(fp, "0x%08x", (int)p->cells[i]); } fputs("]>", fp); } break; case T_ENV: fprintf(fp, "#<env:count=%d>", GET_ENV(cell)->count); break; case T_RELOC: fprintf(fp, "#<reloc:0x%08x>", (int)GET_RELOC(cell)); break; case T_PORT: fprintf(fp, "#<port:%s>", GET_PORT(cell)->data); break; case T_DB_CONNECTION: fprintf(fp, "#<db-connection>"); break; case T_DB_RESULT: fprintf(fp, "#<db-result>"); break; case T_RECORD: fprintf(fp, "#<record>"); break; default: fprintf(fp, "#<%s-%02x:%08x>", IS_LITERAL(cell) ? "literal" : "pointer", GET_TYPE(cell), AS_LITERAL(cell) ); break; } }
/** * @param[in] m One pin define per call from iomux-mx23.h/iomux-mx28.h */ void imx_gpio_mode(uint32_t m) { uint32_t reg; unsigned gpio_pin, reg_offset; gpio_pin = GET_GPIO_NO(m); /* configure the pad to its function (always) */ reg_offset = calc_mux_reg(gpio_pin); reg = readl(IMX_IOMUXC_BASE + reg_offset) & ~(0x3 << ((gpio_pin % 16) << 1)); reg |= GET_FUNC(m) << ((gpio_pin % 16) << 1); writel(reg, IMX_IOMUXC_BASE + reg_offset); /* some pins are disabled when configured for GPIO */ if ((gpio_pin > MAX_GPIO_NO) && (GET_FUNC(m) == IS_GPIO)) { printf("Cannot configure pad %u to GPIO\n", gpio_pin); return; } if (SE_PRESENT(m)) { reg_offset = calc_strength_reg(gpio_pin); reg = readl(IMX_IOMUXC_BASE + reg_offset) & ~(0x3 << ((gpio_pin % 8) << 2)); reg |= GET_STRENGTH(m) << ((gpio_pin % 8) << 2); writel(reg, IMX_IOMUXC_BASE + reg_offset); } if (VE_PRESENT(m)) { reg_offset = calc_strength_reg(gpio_pin); if (GET_VOLTAGE(m) == 1) writel(0x1 << (((gpio_pin % 8) << 2) + 2), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_SET); else writel(0x1 << (((gpio_pin % 8) << 2) + 2), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); } if (PE_PRESENT(m)) { reg_offset = calc_pullup_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + (GET_PULLUP(m) == 1 ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); } if (BK_PRESENT(m)) { reg_offset = calc_pullup_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + (GET_BITKEEPER(m) == 1 ? STMP_OFFSET_REG_CLR : STMP_OFFSET_REG_SET)); } if (GET_FUNC(m) == IS_GPIO) { if (GET_GPIODIR(m) == 1) { /* first set the output value */ reg_offset = calc_output_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + (GET_GPIOVAL(m) == 1 ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); /* then the direction */ reg_offset = calc_output_enable_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_SET); } else { /* then the direction */ reg_offset = calc_output_enable_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); } } }
/** * DLL のメインエントリポイント。 * 設定ファイルから内容の読み出しを行っている。 */ BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { hInst = (HINSTANCE)hModule; switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { // 設定ファイルから内容を読み出す char *work = getMacroDir(); std::string iniFilePath = work; #ifdef _DEBUG std::string logFilePath = work; logFilePath += "\\HidemaruMailSearch.log"; fopen_s(&logFile, logFilePath.c_str(), "w"); #endif free(work); iniFilePath += "\\HidemaruMailSearch.ini"; iniFile = new IniFile(iniFilePath.c_str()); for (int i = 0; i < MAX_HISTORY; i++) { std::string key = "history"; char num[3] = {0}; _itoa_s(i, num, 10); key += num; char *temp = iniFile->read("History", key.c_str()); if (temp != NULL) { if (strlen(temp) != 0) { std::string value = temp; history.push_back(value); } free(temp); } } work = iniFile->read("Config", "radio"); if (strcmp(work, "1") == 0) { selectedRadioButton = IDC_RADIO1; } else if (strcmp(work, "2") == 0) { selectedRadioButton = IDC_RADIO2; } else if (strcmp(work, "3") == 0) { selectedRadioButton = IDC_RADIO3; } else if (strcmp(work, "4") == 0) { selectedRadioButton = IDC_RADIO4; } else { selectedRadioButton = IDC_RADIO1; } if (work != NULL) { free(work); } work = iniFile->read("Config", "check"); if (strcmp(work, "TRUE") == 0) { selectedCheckBox = TRUE; } else { selectedCheckBox = FALSE; } if (work != NULL) { free(work); } // TKInfo.dll の初期化とエクスポート関数の取得 char *hidemaruMailDir = (char *)get_reg_value(HIDEMARU_MAIL_DIR_KEY, NULL); std::string tkInfo = hidemaruMailDir; free(hidemaruMailDir); tkInfo += "TKInfo.dll"; hInstDLL = LoadLibrary(tkInfo.c_str()); GET_FUNC(HidemaruMailVersion); GET_FUNC(StartDoGrep); GET_FUNC(SetFindPack); GET_FUNC(CurrentAccount); GET_FUNC(CurrentFolder); GET_FUNC(YenEncode); GET_FUNC(ExecAtMain); GET_FUNC(SetQuietMode); GET_FUNC(IsHidemaruMail); GET_FUNC(IsHidemaruMailMain); GET_FUNC(IsHidemaruMailGrep); GET_FUNC(MainWnd); GET_FUNC(PushFindPack); break; } case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: if (iniFile != NULL) { delete iniFile; } #ifdef _DEBUG fclose(logFile); #endif break; } return TRUE; }
Robot::Robot() { me = this; // Coolest statement ever GetWatchdog().SetEnabled(false); speedMultiplier = 1.0; shotModifierX = 0; // start with a count of left/right adjustment in .01 increments shotModifierZ = 0; // start with a count of distance adjustments in 6" increments Logger* logger = new Logger("/ni-rt/system/logs/robot.txt"); Singleton<Logger>::SetInstance(logger); vision = new Vision(new SquareFinder); vision->setEnabled(true); //Don't process without button. vision->start(); Singleton<DriveTrain>::SetInstance(new DriveTrain); Singleton<Collector>::SetInstance(new Collector); Singleton<Collector>::GetInstance().Start(); Singleton<Shooter>::SetInstance(new Shooter); // The order in which lines are reserved dictates the order // in which lines are displayed on the LCD. this->primaryDisplay.Reserve(1); COLLECTOR.reservePrimaryLines(); SHOOTER.reservePrimaryLines(); DRIVETRAIN.ReservePrimaryLines(); VISION.reservePrimaryLines(); SQUAREFINDER.reservePrimaryLines(); // There is some additional information, secondary information, // that comes after all of the primary information. this->secondaryDisplay.Reserve(7); COLLECTOR.reserveSecondaryLines(); SHOOTER.reserveSecondaryLines(); DRIVETRAIN.ReserveSecondaryLines(); VISION.reserveSecondaryLines(); SQUAREFINDER.reserveSecondaryLines(); Singleton<Logger>::GetInstance().Logf("Starting the Robot class."); operatorControlTask = new Task("2502OC", (FUNCPTR)OperatorControlLoop); //balanceAccelerometer = new AccelPID_Wrapper(new ADXL345_I2C(1)); //Takes ownership of ADXL345 //balancePID = new PIDController(0.1,.01,0.0,balanceAccelerometer,&Singleton<DriveTrain>::GetInstance()); //\todo Tune these! No D. //balancePID->Disable(); //gyro = new Gyro(1); //gyro->Reset(); joystick1 = new JoystickWrapper(1, Extreme3DPro); //joystick2 = new JoystickWrapper(2, Attack3); joystickCallbackHandler = new JoystickCallback<Robot>(joystick1,this); joystickCallbackHandler->SetHeldCallback(RAMP_DOWN_BUTTON, GET_FUNC(RampDown)); joystickCallbackHandler->SetHeldCallback(RAMP_UP_BUTTON, GET_FUNC(RampUp)); joystickCallbackHandler->SetHeldCallback(EJECT_BALLS_BUTTON, GET_FUNC(CollectorEject)); joystickCallbackHandler->SetUpCallback(RAMP_DOWN_BUTTON, GET_FUNC(RampOff)); joystickCallbackHandler->SetUpCallback(RAMP_UP_BUTTON, GET_FUNC(RampOff)); joystickCallbackHandler->SetTriggerDownCallback(GET_FUNC(ShootBasketTeleoperated)); joystickCallbackHandler->SetHeldCallback(TURRET_BUTTON, GET_FUNC(MoveTurret)); joystickCallbackHandler->SetUpCallback(TURRET_BUTTON, GET_FUNC(TurretOff)); //joystickCallbackHandler->SetHeldCallback(9, GET_FUNC(RatioDown)); //joystickCallbackHandler->SetHeldCallback(10, GET_FUNC(RatioUp)); // Change Ball Count joystickCallbackHandler->SetDownCallback(COLLECTOR_ADD_BALL_BUTTON, GET_FUNC(CollectorIncBall)); joystickCallbackHandler->SetDownCallback(COLLECTOR_SUB_BALL_BUTTON, GET_FUNC(CollectorDecBall)); joystickCallbackHandler->SetHeldCallback(9, GET_FUNC(MediumSpeedOn)); joystickCallbackHandler->SetHeldCallback(11, GET_FUNC(SlowSpeedOn)); joystickCallbackHandler->SetUpCallback(9, GET_FUNC(NormalSpeed)); joystickCallbackHandler->SetUpCallback(11, GET_FUNC(NormalSpeed)); joystickCallbackHandler->SetHeldCallback(4, GET_FUNC(forceDriveOn)); //joystickCallbackHandler->SetDownCallback(BalanceRobot,GET_FUNC(BalanceRobotOn)); //joystickCallbackHandler->SetUpCallback(BalanceRobot,GET_FUNC(BalanceRobotOff)); }
int TSimpleLemmer::GetLemmaQuality(MystemLemmaHandle* h) { return GET_FUNC(Lib, MystemLemmaQuality)(h); }
size_t TSimpleLemmer::CopyFromMystem(MystemAnalysesHandle* analyses, const Wtroka& src, TWLemmaArray& out) { size_t count = GET_FUNC(Lib, MystemAnalysesCount)(analyses); out.clear(); out.resize(count); for (size_t i = 0; i != count; ++i) { MystemLemmaHandle* lemma = GET_FUNC(Lib, MystemLemma)(analyses, i); NLemmerAux::TSimpleLemmaSetter setter(out[i]); setter.SetLemma(GET_FUNC(Lib, MystemLemmaText)(lemma), GET_FUNC(Lib, MystemLemmaTextLen)(lemma), GET_FUNC(Lib, MystemLemmaForm)(lemma), GET_FUNC(Lib, MystemLemmaFormLen)(lemma), GET_FUNC(Lib, MystemLemmaStemGram)(lemma), GET_FUNC(Lib, MystemLemmaFlexGram)(lemma), GET_FUNC(Lib, MystemLemmaFlexGramNum)(lemma), GET_FUNC(Lib, MystemLemmaFlexLen)(lemma), GET_FUNC(Lib, MystemLemmaRuleId)(lemma), GET_FUNC(Lib, MystemLemmaQuality)(lemma), src); } DeleteAnalyses(analyses); return count; }
int TSimpleLemmer::GetFormsCount(MystemFormsHandle* h) { return GET_FUNC(Lib, MystemFormsCount)(h); }
/********************************************************************** * create_driver * * Allocate and fill the driver structure for a given module. */ static struct graphics_driver *create_driver( HMODULE module ) { struct graphics_driver *driver; if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL; driver->next = NULL; driver->prev = NULL; driver->module = module; driver->count = 1; /* fill the function table */ if (module) { #define GET_FUNC(name) driver->funcs.p##name = (void*)GetProcAddress( module, #name ) GET_FUNC(AbortDoc); GET_FUNC(AbortPath); GET_FUNC(AlphaBlend); GET_FUNC(AngleArc); GET_FUNC(Arc); GET_FUNC(ArcTo); GET_FUNC(BeginPath); GET_FUNC(BitBlt); GET_FUNC(ChoosePixelFormat); GET_FUNC(Chord); GET_FUNC(CloseFigure); GET_FUNC(CreateBitmap); GET_FUNC(CreateDC); GET_FUNC(CreateDIBSection); GET_FUNC(DeleteBitmap); GET_FUNC(DeleteDC); GET_FUNC(DescribePixelFormat); GET_FUNC(DeviceCapabilities); GET_FUNC(Ellipse); GET_FUNC(EndDoc); GET_FUNC(EndPage); GET_FUNC(EndPath); GET_FUNC(EnumDeviceFonts); GET_FUNC(ExcludeClipRect); GET_FUNC(ExtDeviceMode); GET_FUNC(ExtEscape); GET_FUNC(ExtFloodFill); GET_FUNC(ExtSelectClipRgn); GET_FUNC(ExtTextOut); GET_FUNC(FillPath); GET_FUNC(FillRgn); GET_FUNC(FlattenPath); GET_FUNC(FrameRgn); GET_FUNC(GdiComment); GET_FUNC(GetBitmapBits); GET_FUNC(GetCharWidth); GET_FUNC(GetDCOrgEx); GET_FUNC(GetDIBColorTable); GET_FUNC(GetDIBits); GET_FUNC(GetDeviceCaps); GET_FUNC(GetDeviceGammaRamp); GET_FUNC(GetNearestColor); GET_FUNC(GetPixel); GET_FUNC(GetPixelFormat); GET_FUNC(GetSystemPaletteEntries); GET_FUNC(GetTextExtentExPoint); GET_FUNC(GetTextMetrics); GET_FUNC(IntersectClipRect); GET_FUNC(InvertRgn); GET_FUNC(LineTo); GET_FUNC(MoveTo); GET_FUNC(ModifyWorldTransform); GET_FUNC(OffsetClipRgn); GET_FUNC(OffsetViewportOrg); GET_FUNC(OffsetWindowOrg); GET_FUNC(PaintRgn); GET_FUNC(PatBlt); GET_FUNC(Pie); GET_FUNC(PolyBezier); GET_FUNC(PolyBezierTo); GET_FUNC(PolyDraw); GET_FUNC(PolyPolygon); GET_FUNC(PolyPolyline); GET_FUNC(Polygon); GET_FUNC(Polyline); GET_FUNC(PolylineTo); GET_FUNC(RealizeDefaultPalette); GET_FUNC(RealizePalette); GET_FUNC(Rectangle); GET_FUNC(ResetDC); GET_FUNC(RestoreDC); GET_FUNC(RoundRect); GET_FUNC(SaveDC); GET_FUNC(ScaleViewportExt); GET_FUNC(ScaleWindowExt); GET_FUNC(SelectBitmap); GET_FUNC(SelectBrush); GET_FUNC(SelectClipPath); GET_FUNC(SelectFont); GET_FUNC(SelectPalette); GET_FUNC(SelectPen); GET_FUNC(SetArcDirection); GET_FUNC(SetBitmapBits); GET_FUNC(SetBkColor); GET_FUNC(SetBkMode); GET_FUNC(SetDCBrushColor); GET_FUNC(SetDCOrg); GET_FUNC(SetDCPenColor); GET_FUNC(SetDIBColorTable); GET_FUNC(SetDIBits); GET_FUNC(SetDIBitsToDevice); GET_FUNC(SetDeviceClipping); GET_FUNC(SetDeviceGammaRamp); GET_FUNC(SetMapMode); GET_FUNC(SetMapperFlags); GET_FUNC(SetPixel); GET_FUNC(SetPixelFormat); GET_FUNC(SetPolyFillMode); GET_FUNC(SetROP2); GET_FUNC(SetRelAbs); GET_FUNC(SetStretchBltMode); GET_FUNC(SetTextAlign); GET_FUNC(SetTextCharacterExtra); GET_FUNC(SetTextColor); GET_FUNC(SetTextJustification); GET_FUNC(SetViewportExt); GET_FUNC(SetViewportOrg); GET_FUNC(SetWindowExt); GET_FUNC(SetWindowOrg); GET_FUNC(SetWorldTransform); GET_FUNC(StartDoc); GET_FUNC(StartPage); GET_FUNC(StretchBlt); GET_FUNC(StretchDIBits); GET_FUNC(StrokeAndFillPath); GET_FUNC(StrokePath); GET_FUNC(SwapBuffers); GET_FUNC(WidenPath); #undef GET_FUNC } else memset( &driver->funcs, 0, sizeof(driver->funcs) ); /* add it to the list */ driver->prev = NULL; if ((driver->next = first_driver)) driver->next->prev = driver; first_driver = driver; return driver; }
/*! * \brief This function initializes libMPSSE * * This function is called once when the library is loaded. It initializes all the modules in the * library. This function initializes all the variables and data structures that are required to be * initialized once only during loading. * * \param[in] none * \param[out] none * \return none * \sa * \note May individually call Ftdi_I2C_Module_Init, Ftdi_SPI_Module_Init, Ftdi_Mid_Module_Init, * Ftdi_Common_Module_Init, etc if required. This function should be called by the OS specific * function(eg: DllMain for windows) that is called by the OS automatically during startup. * \warning */ FTDI_API void Init_libMPSSE(void) { //FT_STATUS status; FN_ENTER; /* Load D2XX dynamic library */ #ifdef __linux hdll_d2xx = dlopen("libftd2xx.so",RTLD_LAZY); CHECK_NULL(hdll_d2xx); #else hdll_d2xx = LoadLibraryA("ftd2xx.dll"); CHECK_NULL(hdll_d2xx); #endif varFunctionPtrLst.p_FT_GetLibraryVersion = (pfunc_FT_GetLibraryVersion)GET_FUNC(hdll_d2xx, "FT_GetLibraryVersion"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_GetLibraryVersion); /*FunctionPointer for FT_CreateDeviceInfoList*/ varFunctionPtrLst.p_FT_GetNumChannel = (pfunc_FT_GetNumChannel)GET_FUNC(hdll_d2xx,"FT_CreateDeviceInfoList"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_GetNumChannel); /*function Pointer for FT_GetDeviceInfoList */ varFunctionPtrLst.p_FT_GetDeviceInfoList = \ (pfunc_FT_GetDeviceInfoList)GET_FUNC(hdll_d2xx,"FT_GetDeviceInfoList"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_GetDeviceInfoList); /*open*/ varFunctionPtrLst.p_FT_Open = (pfunc_FT_Open)GET_FUNC(hdll_d2xx,"FT_Open"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_Open); /*close*/ varFunctionPtrLst.p_FT_Close = (pfunc_FT_Close)GET_FUNC(hdll_d2xx,"FT_Close"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_Close); /*Reset*/ varFunctionPtrLst.p_FT_ResetDevice = (pfunc_FT_ResetDevice)GET_FUNC(hdll_d2xx, "FT_ResetDevice"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_ResetDevice); /*Purge*/ varFunctionPtrLst.p_FT_Purge = (pfunc_FT_Purge)GET_FUNC(hdll_d2xx,"FT_Purge"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_Purge); /*SetUSBParameters*/ varFunctionPtrLst.p_FT_SetUSBParameters = (pfunc_FT_SetUSBParameters)GET_FUNC(hdll_d2xx,"FT_SetUSBParameters"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_SetUSBParameters); /*SetChars*/ varFunctionPtrLst.p_FT_SetChars = (pfunc_FT_SetChars)GET_FUNC(hdll_d2xx,"FT_SetChars"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_SetChars); /*SetTimeouts*/ varFunctionPtrLst.p_FT_SetTimeouts = (pfunc_FT_SetTimeouts)GET_FUNC(hdll_d2xx,"FT_SetTimeouts"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_SetTimeouts); /*SetLatencyTimer*/ varFunctionPtrLst.p_FT_SetLatencyTimer = (pfunc_FT_SetLatencyTimer)GET_FUNC(hdll_d2xx,"FT_SetLatencyTimer"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_SetLatencyTimer); /*SetBitmode*/ varFunctionPtrLst.p_FT_SetBitmode = (pfunc_FT_SetBitmode)GET_FUNC(hdll_d2xx,"FT_SetBitMode"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_SetBitmode); /*FT_GetQueueStatus*/ varFunctionPtrLst.p_FT_GetQueueStatus = (pfunc_FT_GetQueueStatus)GET_FUNC(hdll_d2xx,"FT_GetQueueStatus"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_GetQueueStatus); /*FT_Read*/ varFunctionPtrLst.p_FT_Read = (pfunc_FT_Read)GET_FUNC(hdll_d2xx,"FT_Read"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_Read); /*FT_Write*/ varFunctionPtrLst.p_FT_Write = (pfunc_FT_Write)GET_FUNC(hdll_d2xx,"FT_Write"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_Write); /*FT_GetDeviceInfo*/ varFunctionPtrLst.p_FT_GetDeviceInfo = (pfunc_FT_GetDeviceInfo)GET_FUNC(hdll_d2xx,"FT_GetDeviceInfo"); CHECK_SYMBOL(varFunctionPtrLst.p_FT_GetDeviceInfo); /*Call module specific initialization functions from here(if at all they are required) Example: Top_Init(); //This may be a function in ftdi_common.c // Inside this function we may have macros (eg: #ifdef(_I2C)) Mid_Init(); */ FN_EXIT; }
TChar* TSimpleLemmer::GetFormText(MystemFormHandle* h) { return GET_FUNC(Lib, MystemFormText)(h); }
MystemFormHandle* TSimpleLemmer::GetFormHandle(MystemFormsHandle* h, int i) { return GET_FUNC(Lib, MystemForm)(h, i); }
int32 rk (int32 IR, int32 AC) { int32 i; UNIT *uptr; switch (IR & 07) { /* decode IR<9:11> */ case 0: /* unused */ return (stop_inst << IOT_V_REASON) + AC; case 1: /* DSKP */ return (rk_sta & (RKS_DONE + RKS_ERR))? /* skip on done, err */ IOT_SKP + AC: AC; case 2: /* DCLR */ rk_sta = 0; /* clear status */ switch (AC & 03) { /* decode AC<10:11> */ case RKX_CLS: /* clear status */ if (rk_busy != 0) rk_sta = rk_sta | RKS_BUSY; case RKX_CLSA: /* clear status alt */ break; case RKX_CLC: /* clear control */ rk_cmd = rk_busy = 0; /* clear registers */ rk_ma = rk_da = 0; for (i = 0; i < RK_NUMDR; i++) sim_cancel (&rk_unit[i]); break; case RKX_CLD: /* reset drive */ if (rk_busy != 0) rk_sta = rk_sta | RKS_BUSY; else rk_go (RKC_SEEK, 0); /* seek to 0 */ break; } /* end switch AC */ break; case 3: /* DLAG */ if (rk_busy != 0) rk_sta = rk_sta | RKS_BUSY; else { rk_da = AC; /* load disk addr */ rk_go (GET_FUNC (rk_cmd), GET_CYL (rk_cmd, rk_da)); } break; case 4: /* DLCA */ if (rk_busy != 0) rk_sta = rk_sta | RKS_BUSY; else rk_ma = AC; /* load curr addr */ break; case 5: /* DRST */ uptr = rk_dev.units + GET_DRIVE (rk_cmd); /* selected unit */ rk_sta = rk_sta & ~(RKS_HMOV + RKS_NRDY); /* clear dynamic */ if ((uptr->flags & UNIT_ATT) == 0) rk_sta = rk_sta | RKS_NRDY; if (sim_is_active (uptr)) rk_sta = rk_sta | RKS_HMOV; return rk_sta; case 6: /* DLDC */ if (rk_busy != 0) rk_sta = rk_sta | RKS_BUSY; else { rk_cmd = AC; /* load command */ rk_sta = 0; /* clear status */ } break; case 7: /* DMAN */ break; } /* end case pulse */ RK_INT_UPDATE; /* update int req */ return 0; /* clear AC */ }
int TSimpleLemmer::GetFormFlexGramNum(MystemFormHandle* h) { return GET_FUNC(Lib, MystemFormFlexGramNum)(h); }
void TSimpleLemmer::DeleteAnalyses(MystemAnalysesHandle *analyses) { GET_FUNC(Lib, MystemDeleteAnalyses)(analyses); }
static network_mysqld_python_stmt_ret proxy_python_read_query_result(network_mysqld_con *con) { network_socket *send_sock = con->client; network_socket *recv_sock = con->server; injection *inj = NULL; network_mysqld_con_python_t *st = con->plugin_con_state; network_mysqld_python_stmt_ret ret = PROXY_NO_DECISION; GString *packet; /** * check if we want to forward the statement to the client * if not, clean the send-queue */ if (0 == st->injected.queries->length) return PROXY_NO_DECISION; if(!CHECK_FUNC(read_query_result)) return ret; inj = g_queue_pop_head(st->injected.queries); inj->result_queue = con->server->recv_queue->chunks; PyObject * injection_obj = Injection_New(inj); if(!injection_obj){ PyErr_Print(); network_mysqld_con_send_error(con->client, C("PyProxy: Failed to create injection object.")); con->state = CON_STATE_SEND_ERROR; return PROXY_SEND_RESULT; } PyObject *result = PyObject_CallFunctionObjArgs( GET_FUNC(read_query_result), st->proxy, injection_obj, NULL); Py_DECREF(injection_obj); GET_PYTHON_RESULT(read_query_result) if (!con->resultset_is_needed && (PROXY_NO_DECISION != ret)) { g_critical("%s: read_query_result() in %s tries to modify the resultset, " "but hasn't asked to buffer it in proxy.query.append(..., True). " "We ignore the change to the result-set.", G_STRLOC, con->config->python_script); ret = PROXY_NO_DECISION; } switch (ret) { case PROXY_SEND_RESULT: /* we can only replace the result, if we buffer it */ g_assert_cmpint(con->resultset_is_needed, ==, TRUE); while ((packet = g_queue_pop_head(recv_sock->recv_queue->chunks))) g_string_free(packet, TRUE); if (network_mysqld_con_python_handle_proxy_response(con, st->proxy)) if (!st->injected.sent_resultset) network_mysqld_con_send_error(con->client, C("(python) handling" " proxy.response failed, check error-log")); /* fall through */ case PROXY_NO_DECISION: if (!st->injected.sent_resultset) { // make sure we send only one result-set per client-query while ((packet = g_queue_pop_head(recv_sock->recv_queue->chunks))) network_mysqld_queue_append_raw(send_sock, send_sock->send_queue, packet); st->injected.sent_resultset++; break; } g_critical("%s.%d: got asked to send a resultset, but ignoring it as " "we already have sent %d resultset(s). injection-id: %d", __FILE__, __LINE__, st->injected.sent_resultset, inj->id); st->injected.sent_resultset++; /* fall through */ case PROXY_IGNORE_RESULT: /* trash the packets for the injection query */ if (!con->resultset_is_needed) { g_critical("%s: we tried to send more than one resultset to the " "client, but didn't had them buffered. Now the client " "is out of sync may have closed the connection on us. " "Please use proxy.queries.append(..., True) to fix this.", G_STRLOC); break; } while ((packet = g_queue_pop_head(recv_sock->recv_queue->chunks))) g_string_free(packet, TRUE); break; default: /* invalid return code */ g_message("%s.%d: return-code for read_query_result() was neither " "PROXY_SEND_RESULT or PROXY_IGNORE_RESULT, will ignore the result", __FILE__, __LINE__); while ((packet = g_queue_pop_head(send_sock->send_queue->chunks))) g_string_free(packet, TRUE); break; } injection_free(inj); return ret; }