本文整理汇总了C++中register_callback函数的典型用法代码示例。如果您正苦于以下问题:C++ register_callback函数的具体用法?C++ register_callback怎么用?C++ register_callback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_callback函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: plugin_init
__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
{
int i;
const char * const plugin_name = plugin_info->base_name;
const int argc = plugin_info->argc;
const struct plugin_argument * const argv = plugin_info->argv;
PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER);
if (!plugin_default_version_check(version, &gcc_version)) {
error_gcc_version(version);
return 1;
}
for (i = 0; i < argc; ++i) {
if (!strcmp(argv[i].key, "log_file")) {
has_log_file = true;
continue;
}
error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
}
register_callback(plugin_name, PLUGIN_START_UNIT,
&cyc_complexity_start_unit, NULL);
register_callback (plugin_name, PLUGIN_FINISH_UNIT,
&cyc_complexity_finish_unit, NULL);
register_callback(plugin_name, PLUGIN_INFO, NULL,
&cyc_complexity_plugin_info);
register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
&cyc_complexity_pass_info);
return 0;
}
开发者ID:ephox-gcc-plugins,项目名称:cyclomatic_complexity,代码行数:34,代码来源:cyc_complexity_plugin.c
示例2: module_init
/* module initialization and will be executed automatically when loading. */
void module_init(){
shutdown = malloc(sizeof(shutdown_config_t));
register_callback(max_insn_callback, Step_callback);
register_callback(write_shutdown_callback, Bus_write_callback);
if(register_option("shutdown_device", do_shutdown_option, "Used to stop machine by writing a special address or set the max executed instruction number.") != No_exp)
fprintf(stderr,"Can not register shutdown_device option\n");
}
开发者ID:comealong,项目名称:skyeye-plus,代码行数:8,代码来源:shutdown_module.c
示例3: plugin_init
int
plugin_init (struct plugin_name_args* info, struct plugin_gcc_version* ver)
{
struct register_pass_info pass;
int i;
if (strcmp (ver->basever, gcc_version.basever) != 0)
{
printf ("tsan: invalid gcc version (expected/actual: %s/%s)\n",
gcc_version.basever, ver->basever);
exit(1);
}
flag_tsan = 1;
for (i = 0; i < info->argc; i++)
{
if (strcmp (info->argv[i].key, "ignore") == 0)
flag_tsan_ignore = xstrdup (info->argv[i].value);
}
pass.pass = &pass_tsan.pass;
pass.reference_pass_name = "loop";
pass.ref_pass_instance_number = 1;
pass.pos_op = PASS_POS_INSERT_BEFORE;
register_callback(info->base_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass);
register_callback(info->base_name, PLUGIN_ALL_PASSES_END, finish_unit, NULL);
return 0;
}
开发者ID:AbramBock,项目名称:data-race-test,代码行数:28,代码来源:tsan.c
示例4: plugin_init
int plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
register_callback ("finish_unit", PLUGIN_FINISH_UNIT, &finish_unit_callback, NULL);
return 0;
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:7,代码来源:start_unit_plugin.c
示例5: plugin_init
int plugin_init(struct plugin_name_args *info, struct plugin_gcc_version *ver)
{
if (strncmp(ver->basever, myplugin_ver.basever, strlen("X.Y"))) {
fprintf(stderr, "Your compiler: %s\n", ver->basever);
fprintf(stderr, "Sorry, you need to use GCC 4.7.\n");
return -1;
}
#ifdef DEBUG
fprintf(stderr, "Initializing plugin\n");
#endif
struct register_pass_info pass;
pass.pass = &instrument_assignments_plugin_pass.pass;
pass.reference_pass_name = "ssa";
pass.ref_pass_instance_number = 1;
pass.pos_op = PASS_POS_INSERT_AFTER;
// Tell gcc we want to be called after the first SSA pass
register_callback("instrument_plugin", PLUGIN_PASS_MANAGER_SETUP, NULL, &pass);
register_callback("instrument_plugin", PLUGIN_INFO, NULL, &instrument_assignments_plugin_info);
register_callback("instrument_plugin", PLUGIN_ATTRIBUTES, register_attributes, NULL);
return 0;
}
开发者ID:GaloisInc,项目名称:ivory-rtverification,代码行数:25,代码来源:instrument_plugin.c
示例6: init_substitute_passes
void init_substitute_passes(const char* plugin_name)
{
// Check if j_out has already been created
j_tmp = cJSON_GetObjectItem(j_ini, "input_file");
if (j_tmp==NULL)
{
printf("Alchemist error: input_filename is not defined in ini file\n");
exit(1);
}
strcpy(alc_input_file, j_tmp->valuestring);
j_in=openme_load_json_file(alc_input_file);
if (j_in==NULL)
{
printf("Alchemist error: problem loading input file %s ...\n", alc_input_file);
exit(1);
}
j_in=openme_get_obj(j_in, ALC_PASSES);
if (j_in==NULL)
{
printf("Alchemist error: can't find id '%s' in input file ...\n", ALC_PASSES);
exit(1);
}
register_callback(plugin_name, PLUGIN_ALL_PASSES_START, &substitute_passes, NULL);
register_callback(plugin_name, PLUGIN_ALL_PASSES_END, &substitute_passes_end, NULL);
register_callback(plugin_name, PLUGIN_PASS_EXECUTION, &view_pass_execution, NULL);
}
开发者ID:gfursin,项目名称:cm-ctuning-code-source,代码行数:30,代码来源:alchemist_substitute_passes.c
示例7: _modinit
void
_modinit(void)
{
mod_add_cmd(&privmsg_msgtab);
mod_add_cmd(¬ice_msgtab);
client_message = register_callback("client_message", NULL);
channel_message = register_callback("channel_message", NULL);
}
开发者ID:asterIRC,项目名称:hamsterbox,代码行数:8,代码来源:m_message.c
示例8: bus_log_init
/* some initialization for log functionality */
int bus_log_init() {
exception_t exp;
/* register callback function */
register_callback(log_bus_callback, Bus_read_callback);
register_callback(log_bus_callback, Bus_write_callback);
/* add corresponding command */
add_command("log-bus", com_log_bus, "record every bus access to log file.\n");
}
开发者ID:manasdas17,项目名称:skyeye,代码行数:9,代码来源:bus_log.c
示例9: plugin_init
__visible int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
const char * const plugin_name = plugin_info->base_name;
const int argc = plugin_info->argc;
const struct plugin_argument *argv = plugin_info->argv;
int tso = 0;
int i;
if (!plugin_default_version_check(version, &gcc_version)) {
error(G_("incompatible gcc/plugin versions"));
return 1;
}
for (i = 0; i < argc; ++i) {
if (!strcmp(argv[i].key, "disable"))
return 0;
/* all remaining options require a value */
if (!argv[i].value) {
error(G_("no value supplied for option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
return 1;
}
if (!strcmp(argv[i].key, "tso")) {
tso = atoi(argv[i].value);
continue;
}
if (!strcmp(argv[i].key, "offset")) {
canary_offset = atoi(argv[i].value);
continue;
}
error(G_("unknown option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
return 1;
}
/* create the mask that produces the base of the stack */
sp_mask = ~((1U << (12 + tso)) - 1);
PASS_INFO(arm_pertask_ssp_rtl, "expand", 1, PASS_POS_INSERT_AFTER);
register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP,
NULL, &arm_pertask_ssp_rtl_pass_info);
#if BUILDING_GCC_VERSION >= 9000
register_callback(plugin_info->base_name, PLUGIN_START_UNIT,
arm_pertask_ssp_start_unit, NULL);
#endif
return 0;
}
开发者ID:avagin,项目名称:linux,代码行数:54,代码来源:arm_ssp_per_task_plugin.c
示例10: plugin_init
int
plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
const char *plugin_name = plugin_info->base_name;
register_callback (plugin_name, PLUGIN_PRE_GENERICIZE,
handle_pre_generic, NULL);
register_callback (plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
return 0;
}
开发者ID:MaxKellermann,项目名称:gcc,代码行数:11,代码来源:attribute_plugin.c
示例11: cov_state_on
static void cov_state_on(char *arg)
{
if (cov_state == COV_START) { //run this function first time
cov_init(prof_start, prof_end);
register_callback(cov_readmem_callback, Mem_read_callback);
register_callback(cov_writemem_callback, Mem_write_callback);
register_callback(cov_execmem_callback, Step_callback);
}else
printf("code coverage state: on\n");
cov_state = COV_ON;
}
开发者ID:Jarvishappy,项目名称:tsinghua,代码行数:13,代码来源:code_cov.c
示例12: plugin_init
int
plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
const char *plugin_name = plugin_info->base_name;
register_callback (plugin_name, PLUGIN_START_PARSE_FUNCTION,
plugin_start_parse_function, NULL);
register_callback (plugin_name, PLUGIN_FINISH_PARSE_FUNCTION,
plugin_finish_parse_function, NULL);
return 0;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:13,代码来源:def_plugin.c
示例13: xen_pvmmu_arch_setup
/* Non auto translated PV domain, ie, it's not PVH. */
static __init void xen_pvmmu_arch_setup(void)
{
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_pae_extended_cr3);
if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
BUG();
xen_enable_sysenter();
xen_enable_syscall();
}
开发者ID:mbgg,项目名称:linux,代码行数:16,代码来源:setup.c
示例14: create_register_callback
static int create_register_callback (llist_t **list, /* {{{ */
const char *name, void *callback, user_data_t *ud)
{
callback_func_t *cf;
cf = (callback_func_t *) malloc (sizeof (*cf));
if (cf == NULL)
{
ERROR ("plugin: create_register_callback: malloc failed.");
return (-1);
}
memset (cf, 0, sizeof (*cf));
cf->cf_callback = callback;
if (ud == NULL)
{
cf->cf_udata.data = NULL;
cf->cf_udata.free_func = NULL;
}
else
{
cf->cf_udata = *ud;
}
return (register_callback (list, name, cf));
} /* }}} int create_register_callback */
开发者ID:cstenac,项目名称:collectd,代码行数:26,代码来源:plugin.c
示例15: luaL_newstate
/**
* \brief Load and parse the Lua file of the requested shader.
* \param path The path to the lua file, relative to the data folder.
*/
void Shader::load_lua_file(const std::string& path) {
lua_State* l = luaL_newstate();
luaL_openlibs(l); // FIXME don't open the libs
size_t size;
char* buffer;
FileTools::data_file_open_buffer(path, &buffer, &size);
int load_result = luaL_loadbuffer(l, buffer, size, path.c_str());
if (load_result != 0) {
// Syntax error in the lua file.
Debug::die(std::string("Failed to load ") + path + " : " + lua_tostring(l, -1));
}
else {
// Register the callback and send string parameters to the lua script.
register_callback(l);
lua_pushstring(l, Video::get_rendering_driver_name().c_str());
lua_pushstring(l, shading_language_version.c_str());
lua_pushstring(l, sampler_type.c_str());
if (lua_pcall(l, 3, 0, 0) != 0) {
// Runtime error.
Debug::die(std::string("Failed to parse ") + path + " : " + lua_tostring(l, -1));
lua_pop(l, 1);
}
}
FileTools::data_file_close_buffer(buffer);
lua_close(l);
}
开发者ID:kenygia,项目名称:solarus,代码行数:36,代码来源:Shader.cpp
示例16: xen_enable_nmi
void xen_enable_nmi(void)
{
#ifdef CONFIG_X86_64
if (register_callback(CALLBACKTYPE_nmi, nmi))
BUG();
#endif
}
开发者ID:cosmoecho,项目名称:linux,代码行数:7,代码来源:setup.c
示例17: plugin_init
int
plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
struct register_pass_info pass_info;
const char *plugin_name = plugin_info->base_name;
int argc = plugin_info->argc;
struct plugin_argument *argv = plugin_info->argv;
if (!plugin_default_version_check (version, &gcc_version))
return 1;
/* For now, tell the dc to expect ranges and thus to colorize the source
lines, not just the carets/underlines. This will be redundant
once the C frontend generates ranges. */
global_dc->colorize_source_p = true;
for (int i = 0; i < argc; i++)
{
if (0 == strcmp (argv[i].key, "color"))
force_show_locus_color = true;
}
pass_info.pass = make_pass_test_show_locus (g);
pass_info.reference_pass_name = "ssa";
pass_info.ref_pass_instance_number = 1;
pass_info.pos_op = PASS_POS_INSERT_AFTER;
register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
&pass_info);
return 0;
}
开发者ID:shabesoglu,项目名称:gcc,代码行数:32,代码来源:diagnostic_plugin_test_show_locus.c
示例18: throw
void ctsSocket::complete_state(DWORD _dwerror) throw()
{
LONG current_io_count = ::InterlockedCompareExchange(&this->io_count, 0, 0);
ctFatalCondition(
current_io_count != 0,
L"ctsSocket::complete_state is called with outstanding IO (%d)", current_io_count);
//
// *NOT* taking a ctsSocket lock before calling through io_pattern
// - as IOPattern can also initiate calls through ctsSocket, which can then deadlock
//
DWORD recorded_error = _dwerror;
auto ref_io_pattern(this->io_pattern);
if (ref_io_pattern) {
if ((ctsIOPatternStatusIORunning == this->get_last_error()) && (NO_ERROR == _dwerror)) {
recorded_error = ref_io_pattern->verify_io();
}
// no longer allow any more callbacks
ref_io_pattern->register_callback(nullptr);
}
// update last_error with those results
this->set_last_error(recorded_error);
auto ref_parent(this->parent.lock());
if (ref_parent) {
auto gle = this->get_last_error();
ref_parent->complete_state(gle);
}
}
开发者ID:tpn,项目名称:ctstraffic,代码行数:30,代码来源:ctsSocket.cpp
示例19: register_mein_pass
static void register_mein_pass(void)
{
/* from tree-pass.h */
struct opt_pass opt_pass;
struct register_pass_info pass_info;
opt_pass.type = GIMPLE_PASS;
opt_pass.name = "xkaapi_pass";
opt_pass.gate = NULL; /* execute always */
opt_pass.execute = on_execute_pass;
opt_pass.sub = NULL;
opt_pass.next = NULL;
opt_pass.tv_id = TV_NONE;
opt_pass.properties_required = PROP_gimple_any;
opt_pass.properties_provided = 0;
opt_pass.properties_destroyed = 0;
opt_pass.todo_flags_start = 0;
opt_pass.todo_flags_finish = TODO_dump_func;
/* before the first lowering pass, scope conserved... */
pass_info.pass = &opt_pass;
pass_info.reference_pass_name = "early_optimizations";
/* pass_info.reference_pass_name = "ssa"; */
pass_info.ref_pass_instance_number = 1;
pass_info.pos_op = PASS_POS_INSERT_BEFORE;
register_callback("xkaapi", PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
/* or: register_pass(&pass_info); */
}
开发者ID:texane,项目名称:xkaapi_gcc_plugin,代码行数:30,代码来源:xkaapi.c
示例20: init
void init()
{
WNDCLASS wc;
plist_api = (PPLAYLIST_MANAGER)create_api(&g_api, &playlist_manager);
pback_api = (PPLAYBACK_CONTROL)create_api(&g_api, &playback_control);
ptcomp_api = (PTITLEFORMAT_COMPILER)create_api(&g_api, &titleformat_compiler);
pplaycbackman = (PPLAY_CALLBACK_MANAGER)create_api(&g_api, &play_callback_manager);
memset(&wc, 0x00, sizeof(wc));
wc.lpfnWndProc = WndProc;
wc.hInstance = g_hIns;
wc.lpszClassName = FOO_REMOTE_WND_CLASS;
if(!RegisterClass(&wc))
{
MessageBox(0, "Error registering window class", FOO_REMOTE_WND_CLASS, MB_OK | MB_ICONERROR | MB_TOPMOST);
return;
}
p_hWnd=CreateWindow(FOO_REMOTE_WND_CLASS, 0, 0, 0, 0, 0, 0, 0, 0, g_hIns, 0);
if(!p_hWnd)
{
MessageBox(0, "Error creating window", FOO_REMOTE_WND_CLASS, MB_OK | MB_ICONERROR | MB_TOPMOST);
return;
}
register_callback(&pplaycbackman, &pplay_callback, flag_on_playback_all, FALSE);
SetTimer(p_hWnd, CLEAR_CALLBACK_TIMER, 5*60*1000, ClearCallback);
SendMessage(FindWindow("bbFooman", 0), WM_FOO_ACTIVATE, 0, 0); // used only for bbFooman plugin for blackbox
}
开发者ID:ejasiunas,项目名称:bbclean-xzero450,代码行数:29,代码来源:foo_control.c
注:本文中的register_callback函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论