示例#1
0
void assembler_init(const char *in_file)
{
	char *f_buffer = f_load_file(in_file);
	if (f_buffer == NULL) {
		printf("compiler error: error on opening input file ...\n");
		exit(EXIT_FAILURE);
	}
	ASM_DESCR.MAIN_FILE = f_process_file(f_buffer);
	fmt_init();
	tokenizer_init();
	parser_init();
	icl_init();
}
示例#2
0
int
camera_init(Camera *camera, GPContext *context)
{
	GPPortSettings settings;
	int ret = 0;

	/* First, set up all the function pointers */
	camera->functions->summary      = camera_summary;
        camera->functions->manual	= camera_manual;
	camera->functions->about        = camera_about;
	camera->functions->exit	    	= camera_exit;

	GP_DEBUG ("Initializing the camera\n");

	ret = gp_port_get_settings(camera->port,&settings);
	if (ret < 0) return ret;

	ret = gp_port_set_settings(camera->port,settings);
	if (ret < 0) return ret;

        /* Tell the CameraFilesystem where to get lists from */
	gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

	camera->pl = malloc (sizeof (CameraPrivateLibrary));
	if (!camera->pl) return GP_ERROR_NO_MEMORY;
	camera->pl->model = 0;
	camera->pl->catalog = NULL;
	camera->pl->nb_entries = 0;
	camera->pl->data_offset = -1;

	/* Connect to the camera */
	ret = icl_init (camera->port, camera->pl);
	if (ret != GP_OK) {
		free(camera->pl);
		return ret;
	}
	return GP_OK;
}