当前位置: 首页>>代码示例>>C++>>正文


C++ register_callback函数代码示例

本文整理汇总了C++中register_callback函数的典型用法代码示例。如果您正苦于以下问题:C++ register_callback函数的具体用法?C++ register_callback怎么用?C++ register_callback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了register_callback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(&notice_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


注:本文中的register_callback函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。