Пример #1
0
Файл: xplot.c Проект: E-LLP/QuIP
void xp_fill_polygon(int num_points,
			float* x_vals, float* y_vals)
{
	int *xp,*yp;
	int i;
	float fx,fy;

	if( plot_vp == NO_VIEWER ) return;

	/* BUG should scale the points */
	xp = (int *) getbuf( num_points * sizeof(int) );
	yp = (int *) getbuf( num_points * sizeof(int) );

	for(i=0;i<num_points;i++){
		fx=x_vals[i]; fy=y_vals[i];
		scale_fxy(plot_vp,&fx,&fy);
		xp[i] = (int) nearbyintf(fx);
		yp[i] = (int) nearbyintf(fy);
	}

	_xp_fill_polygon(plot_vp, num_points, xp, yp);

	givbuf(xp);
	givbuf(yp);
}
Пример #2
0
static void _del_picks( QSP_ARG_DECL  Screen_Obj *sop )
{
	int i, n_cyl;
	void *p;

	n_cyl = SOB_N_CYLINDERS(sop);
	assert( n_cyl >= 1 );

	for(i=0;i<n_cyl;i++){
		p = SOB_SELECTORS_AT_IDX(sop, i );
		givbuf(p);
		// these counts and pointers will be release later anyway
		//SET_SOB_N_SELECTORS_AT_IDX(sop, i, 0);
		//SET_SOB_SELECTORS_AT_IDX(sop, i, NULL );
	}

	p=SOB_SELECTOR_TBL(sop);
	givbuf(p);
	p=SOB_COUNT_TBL(sop);
	givbuf(p);

	SET_SOB_N_CYLINDERS(sop, 0 );
	SET_SOB_COUNT_TBL(sop,NULL);
	SET_SOB_SELECTOR_TBL(sop,NULL);
}
Пример #3
0
void _cpu_mem_free(QSP_ARG_DECL  void *ptr)
{
#ifdef HAVE_POSIX_MEMALIGN
	givbuf(free);
#else // ! HAVE_POSIX_MEMALIGN
	givbuf(ptr);
#endif // ! HAVE_POSIX_MEMALIGN
}
Пример #4
0
static void add_choice_to_picker(QSP_ARG_DECL  Screen_Obj *sop, const char *s)
{
	const char **new_selectors;
	int i, n;

	assert( SOB_TYPE(sop) == SOT_PICKER );
	if( insist_one_component(sop, "add_choice_to_picker") < 0 ) return;

	if( insist_choice_not_present(SOB_SELECTORS_AT_IDX(sop,0),SOB_N_SELECTORS_AT_IDX(sop,0),s,
			SOB_NAME(sop),"add_choice_to_picker") < 0 )
		return;

	n = 1 + SOB_N_SELECTORS_AT_IDX( sop, 0 );
	new_selectors = (const char **)getbuf( n * sizeof(char **) );

	i=0;
	if( SOB_N_SELECTORS_AT_IDX(sop,0) > 0 ){
		assert( SOB_SELECTORS_AT_IDX(sop,0) != NULL );
		for(;i<SOB_N_SELECTORS_AT_IDX(sop,0);i++)
			new_selectors[i] = SOB_SELECTOR_AT_IDX(sop,0,i);
		givbuf(SOB_SELECTORS_AT_IDX(sop,0));
	} else {
		assert( SOB_SELECTORS_AT_IDX(sop,0) == NULL );
	}

	new_selectors[i] = savestr(s);
	SET_SOB_N_SELECTORS_AT_IDX( sop, 0, n );
	SET_SOB_SELECTORS_AT_IDX(sop, 0, new_selectors );
}
Пример #5
0
static inline void add_choice_to_chooser(QSP_ARG_DECL  Screen_Obj *sop, const char *s)
{
	int i, n;
	const char **new_string_arr;
	
	assert( SOB_N_SELECTORS(sop) >= 0 );

	// first make sure that this choice is not already present...
	if( insist_choice_not_present(SOB_SELECTORS(sop),SOB_N_SELECTORS(sop),s,SOB_NAME(sop),"add_choice_to_chooser") < 0 )
		return;

	n = SOB_N_SELECTORS(sop) + 1;
	new_string_arr = getbuf( n * sizeof(char *) );

	i=0;
	if( SOB_N_SELECTORS(sop) > 0 ){
		assert( SOB_SELECTORS(sop) != NULL );
		for(;i<SOB_N_SELECTORS(sop);i++)
			new_string_arr[i] = SOB_SELECTORS(sop)[i];
		givbuf(SOB_SELECTORS(sop));	// release old string table
	} else {
		assert( SOB_SELECTORS(sop) == NULL );
	}
		
	new_string_arr[i] = savestr(s);
	SET_SOB_N_SELECTORS(sop,n);
	SET_SOB_SELECTORS(sop,new_string_arr);
}
Пример #6
0
static void _get_picker_strings(QSP_ARG_DECL  Screen_Obj *sop, int n_cyl )
{
	int *count_tbl;
	int i, j, n_max;
	const char **string_arr;
	int n;	// set by get_strings?

	SET_SOB_SELECTOR_TBL(sop, (const char ***)getbuf( n_cyl * sizeof(char **) ));
	SET_SOB_N_CYLINDERS(sop, n_cyl );
	count_tbl = getbuf( n_cyl * sizeof(int) );
	SET_SOB_COUNT_TBL(sop,count_tbl);

	n_max=0;
	for(i=0;i<n_cyl;i++){
		const char **selectors;
		n=get_strings(sop,&string_arr);
		if( n < 0 ) return;	// BUG clean up!
		else if( n > 0 ){
			SET_SOB_N_SELECTORS_AT_IDX(sop, i, n);
			selectors = (const char **)getbuf( n * sizeof(char **) );
			SET_SOB_SELECTORS_AT_IDX(sop, i, selectors );

			for(j=0;j<n;j++){
				SET_SOB_SELECTOR_AT_IDX(sop,i,j,string_arr[j]);
			}
			givbuf(string_arr);
			if( n > n_max ) n_max = n;
		} else {
			assert(string_arr == NULL);
		}
	}
}
Пример #7
0
static int _read_format_chunk(QSP_ARG_DECL  Image_File *ifp, Wav_Chunk_Hdr *wch_p)
{
	int n_mandatory, n_extra;
	char *b;
	int status = 0;

	HDR_P(ifp)->wh_fhc.fhc_wch = *wch_p;	// copy chunk header

	n_mandatory = sizeof(Wav_Fmt_Data);
fprintf(stderr,"format chunk has %d mandatory bytes (should be 16?)\n",
n_mandatory);
	if( fread(&(HDR_P(ifp)->wh_fhc.fhc_wfd),sizeof(Wav_Fmt_Data),1,ifp->if_fp) != 1 ){
		wav_fatal_error("Error reading format data",ifp);
		return -1;
	}
display_fmt_chunk(HDR_P(ifp));
	n_extra = wch_p->wch_size - n_mandatory;
	if( n_extra == 0 ) return 0;

	if( n_extra < 0 ){
		wav_error("Bad WAV format chunk size",ifp);
		return -1;
	}

fprintf(stderr,"format chunk has %d extra bytes???\n",n_extra);
	b = getbuf(n_extra);
	if( fread(b,1,n_extra,ifp->if_fp) != n_extra ){
		wav_error("Error reading extra format data",ifp);
		status = -1;
	}
	givbuf(b);	// just throw away for now...

	return status;
}
Пример #8
0
int pick_framerate(QSP_ARG_DECL  PGR_Cam *pgcp,const char *pmpt)
{
	int i;
	int j;
	dc1394framerates_t	framerates;
	const char **choices;
	const char *s;

	if( pgcp == NULL ) return -1;

	// format7 doesn't have a framerate!?
	if( mode_is_format7(pgcp) ){
		WARN("Can't specify framerate for format7 video mode...");
		// eat the argument
		s = NAMEOF("dummy argument");
		return -1;
	}

	if ( dc1394_video_get_supported_framerates( pgcp->pc_cam_p, pgcp->pc_video_mode, &framerates )
			!= DC1394_SUCCESS )
		return -1;

	choices = (const char **) getbuf( framerates.num * sizeof(char *) );
	j=0;
	for(i=0;i<framerates.num;i++){
		s=name_for_framerate(framerates.framerates[i]);
		if( s != NULL ){
			choices[j] = s;
			j++;
		}
	}
	i=WHICH_ONE(pmpt,j,choices);
	givbuf(choices);
	return(i);
}
Пример #9
0
Файл: motif.c Проект: E-LLP/QuIP
Nav_Group *create_nav_group(QSP_ARG_DECL  Nav_Panel *np_p, const char *name)
{
	Nav_Group *ng_p;
	int n;
	char *s;

	ng_p = new_nav_group(QSP_ARG  name);
	if( ng_p == NO_NAV_GROUP ){
		sprintf(ERROR_STRING,
"create_nav_group:  error creating nav_group \"%s\"!?",name);
		WARN(ERROR_STRING);
		return NO_NAV_GROUP;
	}

	// BUG initialize other stuff here...
	

	// need to init item context...
	Item_Context *icp;
	//icp = create_navgrp_context(QSP_ARG  name );
	
	// The context name needs to include the panel name,
	// so that group names can be repeated on different panels
	n = strlen(NAVP_NAME(np_p))+strlen(name)+2;
	s = getbuf(n);
	sprintf(s,"%s.%s",NAVP_NAME(np_p),name);

	icp = create_navitm_context(QSP_ARG  s );

	givbuf(s);

	SET_NAVGRP_ITEM_CONTEXT(ng_p,icp);

	return ng_p;
} // create_nav_group
Пример #10
0
static COMMAND_FUNC( do_test_clock )
{
	int i,n;
	struct timeval *tv_tbl;

	n = (int)HOW_MANY("number of times to read the clock");

	tv_tbl = (struct timeval *) getbuf(n*sizeof(struct timeval));

	/* We've observed on poisson that vblank loops have gaps of around 80 msec which double the elapsed time!?
	 * Can we observe this effect with a simple clock read?
	 * The number of values we have to store depends on the time per read...
	 * If it's 1 usec, then we need 100k reads to take 100 msec...
	 */
	for(i=0;i<n;i++){
		gettimeofday(&tv_tbl[i],NULL);
	}
	/* Now show */
	for(i=0;i<n;i++){
		sprintf(msg_str,"%ld\t%ld",(long)tv_tbl[i].tv_sec,(long)tv_tbl[i].tv_usec);
		prt_msg(msg_str);
	}

	givbuf(tv_tbl);
}
Пример #11
0
Screen_Obj *_mk_menu(QSP_ARG_DECL  Screen_Obj *mip)
{
	Screen_Obj *mp;

	char buf[BUF_LEN];

	mp=dup_so(QSP_ARG  mip);
	givbuf((void *)SOB_NAME(mp));

	/* append colon to name */
	strcpy(buf,SOB_NAME(mip));
	strcat(buf,COL_STR);
	SET_SOB_NAME(mp,buf);

#ifdef QUIP_DEBUG
if( debug ) fprintf(stderr,"Making menu \"%s\"\n",SOB_NAME(mp));
#endif /* QUIP_DEBUG */

	make_menu(QSP_ARG  mp,mip);

	get_menu_items(mp);

#ifdef QUIP_DEBUG
if( debug ) fprintf(stderr,"make_menu:  back from get_menu_items (menu %s)\n",
SOB_NAME(mp));
#endif /* QUIP_DEBUG */
	SET_SOB_TYPE(mp, SOT_MENU);
	return(mp);
}
Пример #12
0
static void del_po(QSP_ARG_DECL  Panel_Obj *po)
{
	/* should deallocate any window system stuff first */
	free_wsys_stuff(po);

	del_panel_obj(po);
	givbuf((void *)PO_NAME(po));
}
Пример #13
0
void bitrev_init(dimension_t len)
{
	if( bitrev_size > 0 ){
		givbuf(bitrev_data);
	}
	bitrev_data = (dimension_t *)getbuf( sizeof(*bitrev_data) * len );
	mk_bitrev(len);
}
Пример #14
0
Файл: rbtree.c Проект: nasa/QuIP
static void release_rb_branch(qrb_node *np)
{
	assert( np != NULL );

	if( np->left != NULL ) release_rb_branch(np->left);
	if( np->right != NULL ) release_rb_branch(np->right);
	// eventually we might want to put this on a free list instead of returning to heap...
	givbuf(np);
}
Пример #15
0
void general_mod(QSP_ARG_DECL Trial_Class * tc_p)
{
	const char *s;

	s=NAMEOF("stimulus command string");
	assert( tc_p != NULL );

	if( CLASS_CMD(tc_p) != NULL )
		givbuf((void *) CLASS_CMD(tc_p) );
	SET_CLASS_CMD( tc_p, savestr(s) );
}
Пример #16
0
dc1394video_mode_t pick_fmt7_mode(QSP_ARG_DECL  PGR_Cam *pgcp,const char *pmpt)
{
	int i;
	int j,k;
	dc1394video_modes_t	video_modes;
	const char **choices;
	dc1394video_mode_t *	modelist;
	dc1394video_mode_t	m;

	if( pgcp == NULL ) return BAD_VIDEO_MODE;

	if ( dc1394_video_get_supported_modes( pgcp->pc_cam_p, &video_modes ) != DC1394_SUCCESS )
		return BAD_VIDEO_MODE;

	choices = (const char **)getbuf( video_modes.num * sizeof(char *) );
	modelist = (dc1394video_mode_t *) getbuf( video_modes.num * sizeof(dc1394video_mode_t) );
	j=0;
	for(i=0;i<video_modes.num;i++){
		k=index_of_video_mode(video_modes.modes[i]);	/* get index into our table... */
								/* could probably get this by subtraction if
								 * our table is in the correct order...
								 */
		if( k >= 0 && video_modes.modes[i] >= DC1394_VIDEO_MODE_FORMAT7_0
			   && video_modes.modes[i] <= DC1394_VIDEO_MODE_FORMAT7_7 ){
			choices[j] = all_video_modes[k].nvm_name;
			modelist[j] = all_video_modes[k].nvm_mode;
			j++;
		}
	}
	i=WHICH_ONE(pmpt,j,choices);
	givbuf(choices);
	if( i >= 0 )
		m=modelist[i];
	else
		m=BAD_VIDEO_MODE;
	givbuf(modelist);

	return(m);
}
Пример #17
0
static void init_stamps(uint32_t n_frames)
{
	if( ts_array != NULL ){
		if( ts_array_size == n_frames ){
			n_stored_times=0;
			return;
		}
		givbuf( ts_array );
	}

	ts_array = (TS_Data *) getbuf( sizeof(TS_Data) * n_frames );
	ts_array_size = n_frames;
	n_stored_times=0;
}
Пример #18
0
static COMMAND_FUNC( do_xp_fill_polygon )
{
    float* x_vals=NULL, *y_vals = NULL;
    int num_points;
    int i;

    num_points = (int)HOW_MANY("number of polygon points");
    x_vals = (float *) getbuf(sizeof(float) * num_points);
    y_vals = (float *) getbuf(sizeof(float) * num_points);

    for (i=0; i < num_points; i++) {
        char s[100];
        sprintf(s, "point %d x value", i+1);
        x_vals[i] = (float)HOW_MUCH(s);
        sprintf(s, "point %d y value", i+1);
        y_vals[i] = (float)HOW_MUCH(s);
    }

    xp_fill_polygon(num_points, x_vals, y_vals);

    givbuf(x_vals);
    givbuf(y_vals);
}
Пример #19
0
dc1394video_mode_t pick_video_mode(QSP_ARG_DECL  PGR_Cam *pgcp,const char *pmpt)
{
	int i;
	int j,k;
	const char **choices;
	dc1394video_mode_t *	modelist;
	dc1394video_mode_t	m;

	if( pgcp == NULL ) return BAD_VIDEO_MODE;

	choices = (const char **)getbuf( pgcp->pc_video_modes.num * sizeof(char *) );
	modelist = (dc1394video_mode_t *)
		getbuf( pgcp->pc_video_modes.num * sizeof(dc1394video_mode_t) );
	j=0;
	for(i=0;i<pgcp->pc_video_modes.num;i++){
		/* get index into our table... */
		/* could probably get this by subtraction if
		 * our table is in the correct order...
		 */
		k=index_of_video_mode(pgcp->pc_video_modes.modes[i]);
		if( k >= 0 ){
			choices[j] = all_video_modes[k].nvm_name;
			modelist[j] = all_video_modes[k].nvm_mode;
			j++;
		}
	}
	i=WHICH_ONE(pmpt,j,choices);
	givbuf(choices);
	if( i >= 0 )
		m=modelist[i];
	else
		m=BAD_VIDEO_MODE;
	givbuf(modelist);

	return(m);
}
Пример #20
0
size_t _encrypt_char_buf(QSP_ARG_DECL  const char *in_buf, size_t in_len, uint8_t *out_buf, size_t out_len)
{
	gcry_error_t status;
	size_t padded_len, n_blocks;
	char *pad_buf;
	int bs;

	if( my_cipher_handle == NULL )
		init_gcrypt_subsystem();

	/* gcrypt doesn't seem to offer padding, so the input
	 * must be an integral number of blocks...
	 */
	bs=encryption_block_size();
	if( bs <= 0 ) return 0;	// when lib not present?

	n_blocks = in_len/bs;
	if( (in_len % bs) != 0 ){
		int i;
		n_blocks++;
		padded_len = n_blocks * bs;
		pad_buf = getbuf(padded_len);
		memcpy(pad_buf,in_buf,in_len);
		i=in_len;
		while(i<padded_len)
			pad_buf[i++] = 0;
	} else {
		pad_buf = (char *)in_buf;
		padded_len=in_len;
	}
	if( out_len < padded_len ){
		warn("encrypt_char_buf:  output buffer too small for pad!?");
		return 0;
	}

	status = gcry_cipher_encrypt(my_cipher_handle,
			out_buf,out_len,pad_buf,padded_len);
	CHECK_STATUS(encrypt_char_buf,gcry_cipher_encrypt)
	// how do we know how many chars actually written?

	status = gcry_cipher_reset(my_cipher_handle);
	CHECK_STATUS(encrypt_char_buf,gcry_cipher_reset)

	// if we allocated a buffer, then free it.
	if( pad_buf != in_buf ) givbuf(pad_buf);

	return padded_len;
}
Пример #21
0
static int _ignore_chunk(QSP_ARG_DECL  Image_File *ifp, Wav_Chunk_Hdr *wch_p)
{
	int nb;
	char *buf;
	int status=0;

	nb = wch_p->wch_size;
fprintf(stderr,"ignore_chunk:  size is %d\n",nb);
	buf = getbuf(nb);
	if( fread(buf,1,nb,ifp->if_fp) != nb ){
		wav_fatal_error("Error reading ignored chunk data",ifp);
		status = -1;
	}
	givbuf(buf);
	return status;
}
Пример #22
0
Файл: motif.c Проект: E-LLP/QuIP
static void push_widget_context(QSP_ARG_DECL  Screen_Obj *sop)
{

	int n;
	Item_Context *icp;
	char *ctx_name;

	icp = current_scrnobj_context(SINGLE_QSP_ARG);
	assert( icp != NULL );
	n = 2 + strlen( CTX_NAME(icp) ) + strlen( SOB_NAME(sop) );
	ctx_name = getbuf(n);
	sprintf(ctx_name,"%s.%s",CTX_NAME(icp),SOB_NAME(sop) );
	icp = create_scrnobj_context(QSP_ARG  ctx_name );
	givbuf(ctx_name);
	push_scrnobj_context(QSP_ARG  icp);
}
Пример #23
0
static inline void delete_choice_from_chooser(QSP_ARG_DECL  Screen_Obj *sop, const char *s)
{
	const char **new_string_arr;

	assert( SOB_TYPE(sop) == SOT_CHOOSER );

	// first make sure that this choice is already present...
	if( insist_choice_present(SOB_SELECTORS(sop),SOB_N_SELECTORS(sop),s,SOB_NAME(sop),"delete_choice_from_chooser") < 0 )
		return;

	new_string_arr = new_selector_table_less_one(s,SOB_SELECTORS(sop),SOB_N_SELECTORS(sop));
	// can return NULL if table empty or item not found

	givbuf(SOB_SELECTORS(sop));	// release old string table
	SET_SOB_N_SELECTORS(sop,SOB_N_SELECTORS(sop)-1);
	SET_SOB_SELECTORS(sop,new_string_arr);
	reload_chooser(sop);
}
Пример #24
0
static inline void delete_choice_from_picker(QSP_ARG_DECL  Screen_Obj *sop, const char *s)
{
	const char **new_string_arr;

	assert( SOB_TYPE(sop) == SOT_PICKER );
	if( insist_one_component(sop, "add_choice_to_picker") < 0 ) return;

	if( insist_choice_present(SOB_SELECTORS_AT_IDX(sop,0),SOB_N_SELECTORS_AT_IDX(sop,0),s,SOB_NAME(sop),"delete_choice_from_picker") < 0 )
		return;

	new_string_arr = new_selector_table_less_one(s,SOB_SELECTORS_AT_IDX(sop,0),SOB_N_SELECTORS_AT_IDX(sop,0));
	// can return NULL if table empty or item not found

	givbuf(SOB_SELECTORS_AT_IDX(sop,0));	// release old string table
	SET_SOB_N_SELECTORS_AT_IDX(sop,0,SOB_N_SELECTORS_AT_IDX(sop,0)-1);
	SET_SOB_SELECTORS_AT_IDX(sop,0,new_string_arr);
	reload_chooser(sop);
}
Пример #25
0
Файл: ocl.c Проект: nasa/QuIP
static void init_ocl_platform(QSP_ARG_DECL  cl_platform_id platform_id)
{
	Compute_Platform *cpp;
	cl_int status;
	//char param_data[MAX_PARAM_SIZE];
	char *platform_str;
	size_t ret_size;

	GET_PLATFORM_STRING(CL_PLATFORM_NAME)
	cpp = creat_platform(QSP_ARG  platform_str, PLATFORM_OPENCL);
	givbuf(platform_str);

	GET_PLATFORM_STRING(CL_PLATFORM_PROFILE)
	SET_OCLPF_PROFILE(cpp,platform_str);

	GET_PLATFORM_STRING(CL_PLATFORM_VERSION)
	SET_OCLPF_VERSION(cpp,platform_str);

	GET_PLATFORM_STRING(CL_PLATFORM_VENDOR)
	SET_OCLPF_VENDOR(cpp,platform_str);

	GET_PLATFORM_STRING(CL_PLATFORM_EXTENSIONS)
	SET_OCLPF_EXTENSIONS(cpp,platform_str);

	SET_OCLPF_ID(cpp,platform_id);

	SET_PLATFORM_FUNCTIONS(cpp,ocl)

	SET_PF_FUNC_TBL(cpp,ocl_vfa_tbl);

	// BUG need to set vfa_tbl here too!

	//icp = create_item_context(QSP_ARG  pfdev_itp, PLATFORM_NAME(cpp) );
	//push_item_context(QSP_ARG  pfdev_itp, icp );
	push_pfdev_context(QSP_ARG  PF_CONTEXT(cpp) );
	init_ocl_devices(QSP_ARG  cpp);
	if( pop_pfdev_context(SINGLE_QSP_ARG) == NULL )
		error1("init_ocl_platform:  Failed to pop platform device context!?");
}
Пример #26
0
void transpose(QSP_ARG_DECL  Data_Obj *dpto,Data_Obj *dpfr)
{
	/* new version using gen_xpose */

	Data_Obj *tmp_dp;
	Vec_Obj_Args oa1, *oap=&oa1;

	// BUG use a macro for this...
	tmp_dp=NEW_DOBJ;

	OBJ_COPY_FROM(tmp_dp,dpfr);
	// after the copy, the shape pointer is the same as the parent's...
	DUP_OBJ_SHAPE(tmp_dp,dpfr);

	gen_xpose(tmp_dp,1,2);		/* switch rows, cols */

	setvarg2(oap,dpto,tmp_dp);
	perf_vfunc(QSP_ARG  FVMOV,oap);

	// tmp_dp has no resources except is shape...
	rls_shape( OBJ_SHAPE(tmp_dp) );
	givbuf(tmp_dp);
}
Пример #27
0
Файл: ocl.c Проект: nasa/QuIP
static Platform_Device * create_ocl_device(QSP_ARG_DECL  cl_device_id dev_id, Compute_Platform *cpp)
{
	char *name;
	//size_t psize;
	const char *name_p;
#define SCRATCH_LEN	128
	char scratch[SCRATCH_LEN];
	Platform_Device *pdp;

	name = get_ocl_device_name(QSP_ARG  dev_id);
	if( name == NULL ) return NULL;
	replace_spaces(name,'_');

	/* We might have two of the same devices installed in a single system.
	 * In this case, we can't use the device name twice, because there will
	 * be a conflict.  The first one gets the name, then we have to check and
	 * make sure that the name is not in use already.  If it is, then we append
	 * a number to the string...
	 */
	name_p = available_ocl_device_name(QSP_ARG  name,scratch,SCRATCH_LEN);	// use cname as scratch string
	pdp = new_pfdev(name_p);

	givbuf(name);

	// initialize all the fields?

	assert( pdp != NULL );

	if( pdp != NULL ){
		SET_PFDEV_PLATFORM(pdp,cpp);
		// allocate the memory for the platform-specific data
		SET_PFDEV_ODI(pdp,getbuf(sizeof(*PFDEV_ODI(pdp))));
		SET_PFDEV_OCL_DEV_ID(pdp,dev_id);
	}

	return pdp;
}
Пример #28
0
Файл: mpeg.c Проект: E-LLP/QuIP
void mpeg_close(Image_File *ifp)
{
	/* First do the mpeg library cleanup */
	if( IS_READABLE(ifp) ){

		if( ifp->hdr->idp != NULL ) 
			free(ifp->hdr->idp);
	} else {
		
		/* Create MPEG end sequences and close output file. */
		if( !MPEGe_close(ifp->hdr->enc_opts) ) {
			sprintf(error_string,"ERROR: %s", ifp->hdr->enc_opts->error);
			advise(error_string);
		}

		if( ifp->hdr->enc_opts != NULL )
			free(ifp->hdr->enc_opts);
	}
	
	if( ifp->hdr != NULL )
		givbuf(ifp->hdr);

	GENERIC_IMGFILE_CLOSE(ifp);
}
Пример #29
0
void _cpu_obj_free(QSP_ARG_DECL  Data_Obj *dp)
{
	givbuf(dp->dt_unaligned_ptr);
}
Пример #30
0
static void hash_tbl_release_enum(Enumerator *ep)
{
	rls_hash_tbl_enumerator(ep->e_p.htep);
	givbuf(ep);
}