Example #1
0
void
endin_convertf( fields *endin, fields *info, int reftype, param *p, variants *all, int nall )
{
	newstr *d;
	int  i, level, n, process;
	char *newtag, *t;
	for ( i=0; i<endin->nfields; ++i ) {
		/* Ensure that data exists */
		d = &( endin->data[i] );
		if ( !(d->data) || d->len==0 ) continue;
		/*
		 * All refer format tags start with '%'.  If we have one
		 * that doesn't, assume that it comes from endx2xml
		 * and just copy and paste to output
		 */
		t = endin->tag[i].data;
		if ( t[0]!='%' ) {
			fields_add( info, t, d->data, endin->level[i] );
			continue;
		}
		n = process_findoldtag( t, reftype, all, nall );
		if ( n==-1 ) {
			endin_notag( p, t, d->data );
			continue;
		}
		process = ((all[reftype]).tags[n]).processingtype;
		if ( process == ALWAYS ) continue; /* add these later */
		level = ((all[reftype]).tags[n]).level;
		newtag = ((all[reftype]).tags[n]).newstr;
		if ( process==SIMPLE )
			fields_add( info, newtag, d->data, level );
		else if ( process==TYPE )
			addtype( info, d->data, level );
		else if ( process==TITLE )
			title_process( info, newtag, d->data, level );
		else if ( process==PERSON )
			name_add( info, newtag, d->data, level, &(p->asis), 
					&(p->corps) );
		else if ( process==DATE )
			adddate( info, t, newtag,d->data,level);
		else if ( process==PAGES )
			addpage( info, d->data, level );
		else if ( process==SERIALNO )
			addsn( info, d->data, level );
		else if ( process==NOTES )
			addnotes( info, newtag, d->data, level );
		else {
/*				fprintf(stderr,"%s: internal error -- illegal process %d\n", r->progname, process );
*/
		}
	}
}
Example #2
0
void handle_var_decl(ast_list* vars, char* type, char* expr)
{
	char* t;
	if (strcmp(type, "VOID") != 0)
		t = type;
	else 
		t = expr;

	ast_list* p = vars;
	while (p != NULL)
	{
		p->elem->type = t;
		addtype(p->elem->info.variable, t);
		p = p->next;
	}
}
Example #3
0
/*------------------------------------------------------------------*/
lib		*scanLLA(lib *l,char *s, int n)
{
	int		i,j=0;
	char	*ss[8];
	char	p[128];
	lib		*ll;

	strncpy(p,s,127);
	p[127]=0;
	i=strscan(p,ss,',',8);
	if(i<3)
	{
		strncpy(p,s,127);
		p[127]=0;
		i=strscan(p,ss,' ',8);
	}
	if(i<3)
		return(NULL);
 	if(!l)
	{
		l=makelib();
		copylib(LL,l);
	}
	if(!l->ltype)
	{
		l->ltype=addtype(TYPE_TG);
		l->txt=l->ltype->typtxt;
		auto_ntyp(&l);
	}
	if(i>3)
		j=*ss[3];
	if(n || !l->x || j=='+')
		AddCoord(l,0,0,0);

	l->xc->x=atof(ss[0]);
	l->xc->y=atof(ss[1]);
	l->xc->z=atof(ss[2]);
	if(coordtx)
		Utm2Lla(l,l);	
	else
	{
		l->xc->x *= M_PI/180.0;
		l->xc->y *= M_PI/180.0;
	}

	l->xc->t=Time;
	if(i==6)
	{
		l->xc->muzzle=atoi(ss[4]);
		l->xc->refp=atoi(ss[5]);
	}
	else
	{
		l->xc->muzzle=0;
		ll=copylib(l,ll=makelib());
		LlaToCorr(l,ll,OBP,NULL,EL_AZ_R);
		l->xc->refp = ScaleAngle(ll->xc->y + maxmils/2,maxmils,MR10,eof)+0.5;
		freelib(ll);
	}
	return(l);
	}