Exemplo n.º 1
0
Arquivo: acquire.c Projeto: nasa/QuIP
void convert_polh_vector(Data_Obj *flt_dp,Data_Obj *polh_dp)
{
	uint32_t i,j;
	short *rpdp;
	float *cvt_p;
	Fmt_Pt fp1;
	int station;

	if( OBJ_PREC(flt_dp) != PREC_SP ){
		sprintf(ERROR_STRING,"convert_polh_data:  object %s has precision %s, should be %s",
				OBJ_NAME(flt_dp),PREC_NAME(OBJ_PREC_PTR(flt_dp)),PREC_NAME(prec_for_code(PREC_SP)));
		warn(ERROR_STRING);
		return;
	}
	if( OBJ_COLS(flt_dp) != OBJ_COLS(polh_dp) ){
		sprintf(ERROR_STRING,"convert_polh_data:  vectors %s (%d) and %s (%d) do not have the same number of columns",
				OBJ_NAME(flt_dp),OBJ_COLS(flt_dp),OBJ_NAME(polh_dp),OBJ_COLS(polh_dp));
		warn(ERROR_STRING);
		return;
	}
	/* BUG should make sure that tdim of flt_dp is correct! */

	/* assume that the object has already been checked for proper dim, type... */

	if( n_active_stations == 2 )
		station=0;
	else if(n_active_stations < 1 ){
		warn("format_polh_vector:  no active stations!?");
		return;
	} else
		station=curr_station_idx;

	rpdp = (short *) OBJ_DATA_PTR(polh_dp);

	for(i=0;i<OBJ_COLS(polh_dp);i++){
		Polh_Record_Format *prfp;

		cvt_p = ((float *) OBJ_DATA_PTR(flt_dp)) + i * OBJ_PXL_INC(flt_dp);

		prfp = &station_info[station].sd_multi_prf;
		format_polh_data(&fp1,rpdp,prfp);
		for(j=0;j<prfp->rf_n_data;j++){
			Polh_Output_Type type;
			type = prfp->rf_output[j];
			convert_chunk(cvt_p,&fp1,type);
			cvt_p += od_tbl[type].od_strings;	/* BUG not the right variable?... */
		}
		rpdp += prfp->rf_n_words;
		if( n_active_stations == 2 )
			station ^= 1;
	}
}
Exemplo n.º 2
0
Arquivo: acquire.c Projeto: nasa/QuIP
static int parse_polh_reading( QSP_ARG_DECL  Data_Obj *dp, char * s )
{
	char str[32];
	float *f_p;

#ifdef QUIP_DEBUG
if( debug & debug_polhemus ){
sprintf(ERROR_STRING,"parse_polh_reading \"%s\"",show_printable(DEFAULT_QSP_ARG  s));
advise(ERROR_STRING);
}
#endif /* QUIP_DEBUG */

	if( OBJ_PREC(dp) != PREC_SP ){
		sprintf(ERROR_STRING,"Object %s has %s precision, should be %s",
			OBJ_NAME(dp),
			PREC_NAME(OBJ_PREC_PTR(dp)),
			PREC_NAME(prec_for_code(PREC_SP)) );
		warn(ERROR_STRING);
		return(-1);
	}
	if( ! IS_CONTIGUOUS(dp) ){
		sprintf(ERROR_STRING,"Object %s should be contiguous",OBJ_NAME(dp));
		warn(ERROR_STRING);
		return(-1);
	}
	if( OBJ_N_MACH_ELTS(dp) < 6 ){
		sprintf(ERROR_STRING,"Object %s should have at least 6 elements",OBJ_NAME(dp));
		warn(ERROR_STRING);
		return(-1);
	}

	f_p = OBJ_DATA_PTR(dp);

	if( sscanf(s,"%s %f %f %f %f %f %f",str,
		f_p+0,
		f_p+1,
		f_p+2,
		f_p+3,
		f_p+4,
		f_p+5
		) != 7 ){
		sprintf(ERROR_STRING,"Error scanning polhemus data string");
		warn(ERROR_STRING);
		sprintf(ERROR_STRING,"String:  \"%s\"",show_printable(DEFAULT_QSP_ARG  s));
		advise(ERROR_STRING);
		return(-1);
	}
	return(0);
}
Exemplo n.º 3
0
void newmtrx(QSP_ARG_DECL  const char *s,int dim)
{
	Data_Obj *mp;

	if( dim <= 1 ){
		WARN("bad dimension");
		return;
	}
	mp=dobj_of(QSP_ARG  s);
	if( mp!=(NO_OBJ) ){
		WARN("name in use already");
		return;
	}
	mp=make_obj(QSP_ARG  s,1,dim,dim,1,prec_for_code(PREC_SP));
	if( mp == NO_OBJ ){
		WARN("couldn't create new matrix");
		return;
	}
	unity(mp);
}
Exemplo n.º 4
0
static void _vf_info(QSP_ARG_DECL  Vector_Function *vfp)
{
	int i;
	int n_printed=0;

	sprintf(msg_str,"Vector function %s:",VF_NAME(vfp));
	prt_msg(msg_str);

#define MAX_PER_LINE	4

	prt_msg_frag("\tallowable precisions:");
	for(i=0;i<N_MACHINE_PRECS;i++){
		if( VF_PRECMASK(vfp) & (1<<i) ){
			/* BUG?  is 0 a legal precision code? it is PREC_NONE... */
			sprintf(msg_str,"%s%s",
			(n_printed>=MAX_PER_LINE?",\n\t\t\t": (n_printed>0?", ":"")),
			PREC_NAME(prec_for_code(i)) );
			prt_msg_frag(msg_str);
			if( n_printed >= MAX_PER_LINE ) n_printed=0;
			n_printed++;
		}
	}
	prt_msg("");
	prt_msg_frag("\tallowable types:");
	n_printed=0;
	for(i=0;i<N_ARGSET_TYPES;i++){
		if( VF_TYPEMASK(vfp) & VL_TYPE_MASK(i) ){
			sprintf(msg_str,"%s%s",
			n_printed>0?", ":"",
			number_type_name[i]);
			prt_msg_frag(msg_str);
			n_printed++;
		}
	}
	prt_msg("");
}