Esempio n. 1
0
double EXP_LVL1 CS_scalk (Const char *cs_nam,double ll [2])
{
	extern double cs_Mone;		/* -1.0 */

	struct cs_Csprm_ *cs_ptr;

	double kk;

	cs_ptr = CSbcclu (cs_nam);
	if (cs_ptr != NULL) kk = CS_cssck (cs_ptr,ll);
	else		    kk = cs_Mone;
	return (kk);
}
Esempio n. 2
0
int CStestC (bool verbose,long32_t duration)
{
	int err_cnt;

	unsigned sequencer;

	struct cs_Grptbl_ *tp;
	struct cs_Csgrplst_ *gp;
	struct cs_Csgrplst_ *grp_list;
	struct cs_Csprm_ *csprm;

	double ll [3];
	double xy [3];
	double falseOrg [2];
	double llAry [1][3];
	double xyAry [1][3];

	duration *= 10L;

	printf ("Trying very hard to produce a floating point exception.\n");

	/* Loop through the group table and fetch a linked list
	   for each group.  Count the number in the group and
	   add to the total in the group. */

	err_cnt = 0;
	csprm = NULL;
	for (tp = cs_CsGrptbl;tp->group [0] != 0;tp += 1)
	{
		if (csprm != NULL)
		{
			CS_free (csprm);
			csprm = NULL;
		}
		if (!CS_stricmp (tp->group,"LEGACY"))
		{
			continue;
		}
		CS_csgrp (tp->group,&grp_list);
		for (gp = grp_list;gp != NULL;gp = gp->next)
		{
			if (csprm != NULL)
			{
				CS_free (csprm);
				csprm = NULL;
			}
			if (verbose)
			{
				printf ("Trying to cause a floating exception using %s.\n",
							gp->key_nm);
			}
			else
			{
				printf ("%s               \r",gp->key_nm);
			}

			csprm = CS_csloc (gp->key_nm);
			if (csprm == NULL)
			{
				printf ("Couldn't setup coordinate system named %s.\n",gp->key_nm);
				err_cnt += 1;
				strcpy (cs_MeKynm,"???");
				continue;
			}
			cs_MeFlag = 0;
			strcpy (cs_MeKynm,csprm->csdef.key_nm);
			
			sequencer = 0;
			while (CStestLLH (ll,csprm->cent_mer,&sequencer) == 0)
			{
				cs_Coords [LNG] = ll [0];
				cs_Coords [LAT] = ll [1];
				cs_Coords [HGT] = ll [2];

				strcpy (cs_MeFunc,"CS_cssck");
				CS_cssck (csprm,ll);
				if (cs_MeFlag) break;
				strcpy (cs_MeFunc,"CS_cssch");
				CS_cssch (csprm,ll);
				if (cs_MeFlag) break;
				strcpy (cs_MeFunc,"CS_cscnv");
				CS_cscnv (csprm,ll);
				if (cs_MeFlag) break;
				strcpy (cs_MeFunc,"CS_ll2cs");
				CS_ll2cs (csprm,xy,ll);
				if (cs_MeFlag) break;

				llAry [0][0] = ll [0];		/* keep gcc compiler happy */
				llAry [0][1] = ll [1];
				llAry [0][2] = ll [2];
				strcpy (cs_MeFunc,"CS_llchk");
				CS_llchk (csprm,1,llAry);
				if (cs_MeFlag) break;
			}
			if (cs_MeFlag)
			{
				if (verbose)
				{
					printf ("\tLNG = %g, LAT = %g, HGT = %g     \n",ll [0],ll [1],ll [2]);
				}
				err_cnt += 1;
				continue;
			}

			sequencer = 0;
			falseOrg [0] = csprm->csdef.x_off;
			falseOrg [1] = csprm->csdef.y_off;
			while (CStestXYZ (xy,falseOrg,&sequencer) == 0)
			{
				cs_Coords [XX] = xy [XX];
				cs_Coords [YY] = xy [YY];
				cs_Coords [ZZ] = xy [ZZ];
				strcpy (cs_MeFunc,"CS_cs2ll");
				CS_cs2ll (csprm,ll,xy);
				if (cs_MeFlag) break;
				strcpy (cs_MeFunc,"CS_llchk");
				xyAry [0][0] = xy [0];		/* keep gcc compiler happy */
				xyAry [0][1] = xy [1];
				xyAry [0][2] = xy [2];
				CS_xychk (csprm,1,xyAry);
				if (cs_MeFlag) break;
			}
			if (cs_MeFlag)
			{
				if (verbose)
				{
					printf ("\tXX = %g, YY = %g, ZZ = %g          \n",xy [XX],xy [YY],xy [ZZ]);
				}
				err_cnt += 1;
				continue;
			}

			if (verbose)
			{
				printf ("                                                \r");
			}
			CS_free (csprm);
			csprm = NULL;
		}
		CS_csgrpf (grp_list);
	}
	printf ("                                 \r");
	return (err_cnt);
}