Пример #1
0
static COMMAND_FUNC( do_samp_image )
{
	Data_Obj *intens_dp, *image_dp, *coord_dp;

	intens_dp=pick_obj( "target list for sampled intensities" );
	image_dp=pick_obj( "source image for intensities" );
	coord_dp=pick_obj( "coordinate list" );
	if( intens_dp==NULL || image_dp==NULL || coord_dp==NULL )
		return;

	sample_image(QSP_ARG  intens_dp,image_dp,coord_dp);
}
Пример #2
0
static COMMAND_FUNC( do_render2 )
{
	Data_Obj *intens_dp, *image_dp, *coord_dp;

	image_dp=pick_obj( "target image" );
	intens_dp=pick_obj( "source list of sampled intensities" );
	coord_dp=pick_obj( "coordinate list" );
	if( intens_dp==NULL || image_dp==NULL || coord_dp==NULL )
		return;

	render_samples2(QSP_ARG  image_dp,coord_dp,intens_dp);
}
Пример #3
0
static COMMAND_FUNC( new_obj_list )
{
	int n;
	const char *s;
	List *lp;
	Node *np;

	s=NAMEOF("object name");

	n=how_many("number of objects in this list");
	lp=new_list();
	while(n--){
		Data_Obj *dp;

		dp = pick_obj("");
		if( dp != NULL ){
			np=mk_node(dp);
			addTail(lp,np);
		}
	}

	if( make_obj_list(s,lp) == NULL ){
		sprintf(ERROR_STRING,"error making object list %s");
		warn(ERROR_STRING);
	}
}
Пример #4
0
static COMMAND_FUNC( mksubvector )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	dimension_t rows;
	index_t yos;
	long cols;
	long xos;

	obj_name=NAMEOF("name for subvector");

	dp=pick_obj(PARENT_PROMPT);

	cols=(long) how_many("number of elements");
	rows=1;

	xos=(index_t)how_many("offset");
	yos=0;

	if( dp==NULL ) return;

	INSIST_POSITIVE_DIM(cols,"element","mksubvector")
	INSIST_NONNEGATIVE(xos,"x offset","mksubvector")

	newdp=mk_subimg(dp,(index_t)xos,yos,obj_name,rows,(dimension_t)cols);
	if( newdp == NULL )
		warn("couldn't create subvector");
}
Пример #5
0
static COMMAND_FUNC( do_relocate )
{
	Data_Obj *dp;
	long x,y,t;
	const char *obj_name;

	dp=pick_obj("subimage");
	x=(long) how_many("x offset");
	y=(long) how_many("y offset");
	t=(long) how_many("t offset");

	if( dp==NULL ) return;
	obj_name = OBJ_NAME(dp);
	INSIST_NONNEGATIVE(x,"x offset","relocate");
	INSIST_NONNEGATIVE(y,"y offset","relocate");
	INSIST_NONNEGATIVE(t,"t offset","relocate");

	if( OBJ_PARENT(dp) == NULL ){
		sprintf(ERROR_STRING,
	"relocate:  object \"%s\" is not a subimage",
			OBJ_NAME(dp));
		warn(ERROR_STRING);
		return;
	}
	relocate(dp,(index_t)x,(index_t)y,(index_t)t);
}
Пример #6
0
static COMMAND_FUNC( mkcast )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	long rows, cols, tdim;
	long xos, yos;

	obj_name=NAMEOF("name for cast");

	dp=pick_obj(PARENT_PROMPT);
	if( dp==NULL ) return;

	cols=(long) how_many("number of columns");
	rows=(long) how_many("number of rows");
	xos=(long) how_many("x offset");
	yos=(long) how_many("y offset");
	tdim=(long) how_many("type dimension");

	INSIST_POSITIVE_DIM(cols,"column","mkcast")
	INSIST_POSITIVE_DIM(rows,"row","mkcast")
	INSIST_POSITIVE_DIM(tdim,"component","mkcast")

	INSIST_NONNEGATIVE(xos,"x offset","mkcast")
	INSIST_NONNEGATIVE(yos,"y offset","mkcast")

	newdp=nmk_subimg(dp,(index_t)xos,(index_t)yos,obj_name,(dimension_t)rows,(dimension_t)cols,(dimension_t)tdim);
	if( newdp == NULL )
		warn("couldn't create subimage");
}
Пример #7
0
static COMMAND_FUNC( equivalence )
{
	const char *obj_name;
	Data_Obj *dp;
	Precision * prec_p;
	Dimension_Set ds1, *dsp=(&ds1);
	long ns,nf,nr,nc,nd;

	obj_name=NAMEOF("name for equivalent image");

	dp=pick_obj(PARENT_PROMPT);

	ns=(long) how_many("number of sequences");
	nf=(long) how_many("number of frames");
	nr=(long) how_many("number of rows");
	nc=(long) how_many("number of columns");
	nd=(long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( dp==NULL ) return;
	if( prec_p == NULL ) return;

	INSIST_POSITIVE_DIM(ns,"sequence","equivalence")
	INSIST_POSITIVE_DIM(nf,"frame","equivalence")
	INSIST_POSITIVE_DIM(nr,"row","equivalence")
	INSIST_POSITIVE_DIM(nc,"column","equivalence")
	INSIST_POSITIVE_DIM(nd,"component","equivalence")

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,nd);

	if( COMPLEX_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 complex component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( QUAT_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 quaternion component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( COLOR_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 color triple per pixel");
			return;
		}
advise("component dim 3 for color");
		//SET_DIMENSION(dsp,0,3);
	}

	if( make_equivalence(obj_name,dp,dsp,prec_p) == NULL )
		warn("error making equivalence");
}
Пример #8
0
static COMMAND_FUNC( do_delvec )
{
	Data_Obj *dp;

	dp=pick_obj("");
	if( dp==NULL ) return;
	delvec(dp);
}
Пример #9
0
Файл: glmenu.c Проект: nasa/QuIP
static COMMAND_FUNC( do_tex_image )
{
	Data_Obj *dp = pick_obj("image");
	//im_dim = HOW_MUCH("pixel dimension");

	if( dp == NULL ) return;

	set_texture_image(QSP_ARG  dp);
}
Пример #10
0
static COMMAND_FUNC( do_match_area )
{
	Data_Obj *dp;

	dp = pick_obj("object");
	if( dp == NULL ) return;

	curr_ap=OBJ_AREA(dp);
}
Пример #11
0
static COMMAND_FUNC( do_dobj_info )
{
	Data_Obj *dp;

	dp=pick_obj("");
	if( dp==NULL ) return;

	longlist(dp);
}
Пример #12
0
static COMMAND_FUNC( do_sel_lintbl )
{
	Data_Obj *lt_dp;

	lt_dp = pick_obj("name of linearization table");
	if( lt_dp == NULL ) return;

	CHECK_DPYP("do_sel_lintbl")
#ifdef HAVE_X11
	DPA_LINTBL_OBJ(current_dpyp) = lt_dp;
#endif /* HAVE_X11 */
}
Пример #13
0
Файл: glmenu.c Проект: nasa/QuIP
static COMMAND_FUNC( do_mul_mat )
{
	Data_Obj *dp;

	dp=pick_obj("matrix object");
	if( dp == NULL ) return;

	/* BUG check size & type here */

	if( debug & gl_debug ) advise("glMultMatrixf");
	glMultMatrixf((GLfloat *)OBJ_DATA_PTR(dp));
}
Пример #14
0
static COMMAND_FUNC( do_protect )
{
	Data_Obj *dp;

	dp=pick_obj("");
	if( dp == NULL ) return;
	if( IS_STATIC(dp) ){
		sprintf(ERROR_STRING,"do_protect:  Object %s is already static!?",OBJ_NAME(dp));
		warn(ERROR_STRING);
		return;
	}
	SET_OBJ_FLAG_BITS(dp,DT_STATIC);
}
Пример #15
0
static COMMAND_FUNC( do_gen_xpose )
{
	Data_Obj *dp;
	int d1,d2;

	dp = pick_obj("");
	d1=(int)how_many("dimension index #1");
	d2=(int)how_many("dimension index #2");

	if( dp == NULL ) return;

	gen_xpose(dp,d1,d2);
}
Пример #16
0
static COMMAND_FUNC(do_get_cams)
{
	Data_Obj *dp;

	dp = pick_obj("string table");
	if( dp == NULL ) return;

	/*
	if( get_spink_cam_names( dp ) < 0 )
		WARN("Error getting camera names!?");
		*/
	warn("get_spink_cam_names not implemented!?");
}
Пример #17
0
static COMMAND_FUNC( mksubsequence )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	index_t offsets[N_DIMENSIONS];
	Dimension_Set ds1, *dsp=(&ds1);
	long x_offset, y_offset, t_offset;
	long nr,nc,nf;

	obj_name=NAMEOF("name for subsequence");

	dp=pick_obj(PARENT_PROMPT);

	nc = (long) how_many("number of columns");
	nr = (long) how_many("number of rows");
	nf = (long) how_many("number of frames");

	x_offset=(long) how_many("x offset");
	y_offset=(long) how_many("y offset");
	t_offset=(long) how_many("t offset");

	if( dp==NULL ) return;

	INSIST_POSITIVE_DIM(nc,"column","mksubsequence");
	INSIST_POSITIVE_DIM(nr,"row","mksubsequence");
	INSIST_POSITIVE_DIM(nf,"frame","mksubsequence");

	INSIST_NONNEGATIVE(x_offset,"x offset","mksubsequence");
	INSIST_NONNEGATIVE(y_offset,"y offset","mksubsequence");
	INSIST_NONNEGATIVE(t_offset,"t offset","mksubsequence");

	offsets[0]=0;
	offsets[1]=(index_t)x_offset;
	offsets[2]=(index_t)y_offset;
	offsets[3]=(index_t)t_offset;
	offsets[4]=0;

	SET_DIMENSION(dsp,0,OBJ_COMPS(dp));
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,4,1);

	newdp=mk_subseq(obj_name,dp,offsets,dsp);
	if( newdp == NULL )
		warn("couldn't create subimage");
}
Пример #18
0
static COMMAND_FUNC(do_disp_chunk)
{
	Chunk_Data *cd_p;
	Data_Obj *dp;
	char buf[64];

	cd_p = pick_chunk_data("");
	dp = pick_obj("camera buffer");

	if( cd_p == NULL || dp == NULL ) return;

	fetch_chunk_data(cd_p,dp);
	format_chunk_data(buf,cd_p);

	sprintf(MSG_STR,"\t%s:  ",cd_p->cd_name);
	prt_msg_frag(MSG_STR);
	prt_msg(buf);
}
Пример #19
0
static COMMAND_FUNC(do_fetch_chunk)
{
	Chunk_Data *cd_p;
	Data_Obj *dp;
	const char *s;
	char buf[64];

	s = nameof("variable name");

	cd_p = pick_chunk_data("");
	dp = pick_obj("camera buffer");

	if( cd_p == NULL || dp == NULL ) return;

	fetch_chunk_data(cd_p,dp);
	//display_chunk_data(cd_p);
	format_chunk_data(buf,cd_p);
	assign_var(s,buf);
}
Пример #20
0
Файл: glmenu.c Проект: nasa/QuIP
static COMMAND_FUNC( do_sv_mv_mat )
{
	Data_Obj *dp;

	const char *matrix = NAMEOF("matrix type");
	dp=pick_obj("matrix object");
	if( dp == NULL ) return;

	/* BUG check size & type here */

	if((strcmp(matrix,"modelview"))&&(strcmp(matrix,"projection"))){
		advise("Valid types of matrices are:	'modelview'	'projection'");
		return;
	}

	if (!(strcmp(matrix, "modelview")))
		glGetFloatv(GL_MODELVIEW_MATRIX,(GLfloat *)OBJ_DATA_PTR(dp));
	if (!(strcmp(matrix, "projection")))
		glGetFloatv(GL_PROJECTION_MATRIX,(GLfloat *)OBJ_DATA_PTR(dp));
}
Пример #21
0
static COMMAND_FUNC( mksubstring )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	long len;
	long sos;

	obj_name=NAMEOF("name for substring");

	dp=pick_obj(PARENT_PROMPT);

	len=(long) how_many("number of characters");

	sos=(index_t)how_many("offset");

	if( dp==NULL ) return;

	INSIST_POSITIVE_DIM(len,"character","mksubstring")
	INSIST_NONNEGATIVE(sos,"x offset","mksubstring")

	newdp=mk_substring(dp,(index_t)sos,obj_name,(dimension_t)len);
	if( newdp == NULL )
		warn("couldn't create substring");
}
Пример #22
0
static COMMAND_FUNC( mksubscalar )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	index_t offsets[N_DIMENSIONS];
	Dimension_Set ds1, *dsp=(&ds1);
	long ncomps, comp_offset;

	obj_name=NAMEOF("name for subscalar");

	dp=pick_obj(PARENT_PROMPT);

	ncomps = (long) how_many("number of components");
	comp_offset = (long) how_many("component offset");

	if( dp==NULL ) return;

	INSIST_POSITIVE_DIM(ncomps,"component","mksubscalar");
	INSIST_NONNEGATIVE(comp_offset,"component offset","mksubscalar");

	SET_DIMENSION(dsp,0,ncomps);
	SET_DIMENSION(dsp,1,1);
	SET_DIMENSION(dsp,2,1);
	SET_DIMENSION(dsp,3,1);
	SET_DIMENSION(dsp,4,1);

	offsets[0]=(index_t)comp_offset;
	offsets[1]=0;
	offsets[2]=0;
	offsets[3]=0;
	offsets[4]=0;

	newdp=mk_subseq(obj_name,dp,offsets,dsp);
	if( newdp == NULL )
		warn("couldn't create subscalar");
}
Пример #23
0
static COMMAND_FUNC( mk_subsample )
{
	const char *obj_name;
	Data_Obj *dp;

	Dimension_Set ds1, *dsp=(&ds1);
	index_t offsets[N_DIMENSIONS];
	long l_offset[N_DIMENSIONS];
	incr_t incrs[N_DIMENSIONS];
	long size[N_DIMENSIONS];
	char pmpt[MAX_PMPT_LEN];
	int i;

	obj_name=NAMEOF("name for subsample object");

	dp=pick_obj(PARENT_PROMPT);

	/* We violate the rule of returning before getting
	 * all arguments, because the fields of dp are needed
	 * to determine what to prompt for!
	 */

	if( dp==NULL ) return;

	for(i=0;i<N_DIMENSIONS;i++){
		/* BUG? should we prompt for all dimensions, instead of just those > 1 ?
		 * If we did, then we could defer the return above...
		 */
		if( OBJ_TYPE_DIM(dp,i) > 1 ){
			if( i < (N_DIMENSIONS-1) )
				// BUG check length
				sprintf(pmpt,"number of %ss per %s",dimension_name[i], dimension_name[i+1]);
			else
				sprintf(pmpt,"number of %ss",dimension_name[i]);

			size[i]=(long) how_many(pmpt);

			sprintf(pmpt,"%s offset",dimension_name[i]);
			l_offset[i] = (long) how_many(pmpt);
			sprintf(pmpt,"%s increment",dimension_name[i]);
			incrs[i] =(incr_t)how_many(pmpt);	// this can be negative...
		} else {
			size[i] = 1;
			l_offset[i]=0;
			incrs[i]=1;
		}
	}
	for(i=0;i<N_DIMENSIONS;i++){
		char offset_descr[LLEN];
		INSIST_POSITIVE_DIM(size[i],dimension_name[i],"mk_subsample");
		sprintf(offset_descr,"%s offset",dimension_name[i]);
		INSIST_NONNEGATIVE(l_offset[i],offset_descr,"mk_subsample");
	}
	for(i=0;i<N_DIMENSIONS;i++){
		SET_DIMENSION(dsp,i,size[i]);
		offsets[i] = (index_t) l_offset[i];
	}

	// make_subsamp checks the increments...

	if( make_subsamp(obj_name,dp,dsp,offsets,incrs) == NULL )
		warn("error making subsamp object");
}
Пример #24
0
static void test_parport(void)
{
	int n,s;
	Data_Obj *dp;
	u_long *lp;
	FB_Info *fbip;
	pthread_attr_t attr1;
	VBoard_Info vbi1;
	PPort_Info ppti1;
	u_long l;

	pthread_attr_init(&attr1);	/* initialize to default values */
	pthread_attr_setinheritsched(&attr1,PTHREAD_INHERIT_SCHED);


	fbip = pick_fbi("frame buffer for VSYNC");
	dp = pick_obj("data vector for latencies");

	if( fbip == NULL || dp == NULL ) return;

	INSIST_RAM_OBJ(dp,"test_parport")

	if( OBJ_PREC(dp) != PREC_UDI ){
		sprintf(ERROR_STRING,"latency vector %s (%s) should have precision %s",
			OBJ_NAME(dp),PREC_NAME(OBJ_PREC_PTR(dp)),
				NAME_FOR_PREC_CODE(PREC_UDI));
		WARN(ERROR_STRING);
		return;
	}

	if( OBJ_COMPS(dp) != 2 ){
		sprintf(ERROR_STRING,"latency vector %s (%d) should have 2 components",
			OBJ_NAME(dp),OBJ_COMPS(dp));
		WARN(ERROR_STRING);
		return;
	}

	if( ! IS_CONTIGUOUS(dp) ){
		sprintf(ERROR_STRING,"latency vector %s should be contiguous",OBJ_NAME(dp));
		WARN(ERROR_STRING);
		return;
	}

	n = OBJ_N_MACH_ELTS(dp)/2;
	lp = (u_long *) OBJ_DATA_PTR(dp);

	vbi1.vbi_fbip = fbip;
	vbi1.vbi_buf = lp;
	vbi1.vbi_count = n;
	vbi1.vbi_inc = 2;
#ifdef THREAD_SAFE_QUERY
	vbi1.vbi_qsp = THIS_QSP;
#endif // THREAD_SAFE_QUERY

	lp ++;

	if( the_ppp == NULL ){
		the_ppp=open_parport(NULL);	/* use default */
		if( the_ppp == NULL ) return;
	}

	ppti1.ppti_ppp = the_ppp;
	ppti1.ppti_buf = lp;
	ppti1.ppti_count = n;
	ppti1.ppti_inc = 2;

	tvp = NULL;				/* force re-zero */

	s=read_til_transition(the_ppp,8);
	if( s==0 )
		s=read_til_transition(the_ppp,8);
	/* should now be in the one state */
	/* this is the end of the (negative) pulse */

	l = delta_usecs();	/* zero the clock */

	pthread_create(&vboard_thr,&attr1,vboard_daemon,&vbi1);
	pthread_create(&pport_thr,&attr1,pport_logger,&ppti1);

	/* should wait for threads here... */
	if( pthread_join(vboard_thr,NULL) != 0 ){
		perror("pthread_join");
		WARN("error joining video board thread");
	}
	if( pthread_join(pport_thr,NULL) != 0 ){
		perror("pthread_join");
		WARN("error joining parallel port thread");
	}
}