aboutsummaryrefslogtreecommitdiff
path: root/generic/OverlapMan.c
diff options
context:
space:
mode:
authorlecoanet2003-04-16 09:49:22 +0000
committerlecoanet2003-04-16 09:49:22 +0000
commit3261805fee19e346b4d1f84b23816daa1628764a (patch)
tree63ca1d7e4b0a3d9ae49cc0888e58033c3ef3fe22 /generic/OverlapMan.c
parenteed2656db0adae2c234c3d74af0913746ed5c444 (diff)
downloadtkzinc-3261805fee19e346b4d1f84b23816daa1628764a.zip
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.gz
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.bz2
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.xz
Update from the Windows port and general cleanup/restructure
Diffstat (limited to 'generic/OverlapMan.c')
-rw-r--r--generic/OverlapMan.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/generic/OverlapMan.c b/generic/OverlapMan.c
index 75b5158..29f872f 100644
--- a/generic/OverlapMan.c
+++ b/generic/OverlapMan.c
@@ -40,14 +40,25 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#include "OverlapMan.h"
+#include "malloc.h"
+#include "private.h"
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
#include <math.h>
+
#define signe(a) ((a) < (0) ? (-1) : (1))
#define abs(a) ((a) < (0) ? -(a) : (a))
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338327
+#endif
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923
+#endif
+#ifndef M_PI_4
+#define M_PI_4 0.78539816339744830962
+#endif
#define DegreesToRadian(angle) \
(M_PI * (double) (angle) / 180.0)
#define RadianToDegrees(angle) \
@@ -249,11 +260,7 @@ AllocW(void *w,
if (NBzincs == NBalloc_zincs) {
NBalloc_zincs += NB_ALLOC;
- /*
- * Don't use ZnRealloc it creates dependencies on
- * Tcl even if ptk is used instead.
- */
- wr = (ZINCS *) realloc((void *) wr, sizeof(ZINCS) * NBalloc_zincs);
+ wr = realloc(wr, sizeof(ZINCS) * NBalloc_zincs);
}
for (i = NBzincs-1; i >= pos; i--) {
@@ -330,9 +337,15 @@ OmInit()
*/
void
OmRegister(void *w,
- void *(*_fnext_track)(),
- void (*_fset_label_angle)(),
- void (*_fquery_label_pos)())
+ void *(*_fnext_track)(void *, void *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *),
+ void (*_fset_label_angle)(void *, void *, int, int),
+ void (*_fquery_label_pos)(void *, void *, int,
+ int *, int *, int *, int *) __unused)
{
int iw=0;
BOOLEAN found=FALSE;
@@ -428,12 +441,11 @@ FindPosId(int iw,
***************************************************************************
*/
static void
-SetTrackInitValues(int iw,
- int pos)
+SetTrackInitValues()
{
info1.alpha = ProjToAngle(info1.vv_dx, info1.vv_dy) - 3.0 * M_PI_4;
- info1.dx = (int) info1.rho * cos(info1.alpha);
- info1.dy = (int) info1.rho * sin(info1.alpha);
+ info1.dx = (int) (info1.rho * cos(info1.alpha));
+ info1.dy = (int) (info1.rho * sin(info1.alpha));
info1.alpha_point = 0.0;
}
@@ -477,8 +489,8 @@ PutTrackLoaded(int iw)
*/
if (wr[iw].NBinfos == wr[iw].NBalloc_infos) {
wr[iw].NBalloc_infos += NB_ALLOC;
- wr[iw].infos = (INFOS *) realloc((void *) wr[iw].infos,
- sizeof(INFOS)*wr[iw].NBalloc_infos);
+ wr[iw].infos = realloc((void *) wr[iw].infos,
+ sizeof(INFOS)*wr[iw].NBalloc_infos);
}
if (pos < wr[iw].NBinfos) {
@@ -539,8 +551,8 @@ ReadTracks(int iw)
&trash1,&trash1,&trash1))) {
info1.alpha = (ProjToAngle(info1.vv_dx, info1.vv_dy ) - M_PI_2 -
DegreesToRadian(info1.theta));
- info1.dx = (int) info1.rho * cos(info1.alpha);
- info1.dy = (int) info1.rho * sin(info1.alpha);
+ info1.dx = (int) (info1.rho * cos(info1.alpha));
+ info1.dy = (int) (info1.rho * sin(info1.alpha));
info1.Refresh = TRUE;
/* printf("OverlapMan(Om): ReadTracks id[%-10d], x[%4.4i], y[%4.4i], \
vv_dx[%4.4i], vv_dy[%4.4i], rho[%-3.3d], theta[%-3.3d], visi[%d]\n",
@@ -586,7 +598,7 @@ OmSetNParam(char *name, /* parameter's name */
/* a parameter named name has been found */
if (OmParamAccess[accessid].rw) {
memcpy(OmParamAccess[accessid].data, value,
- OmParamAccess[accessid].size);
+ (unsigned int) OmParamAccess[accessid].size);
status = 1;
break;
}
@@ -619,7 +631,7 @@ OmGetNParam(char *name, /* parameter's name */
if (!strcmp(name, OmParamAccess[accessid].name)) {
/* a parameter named "name" has been found */
memcpy(ptvalue, OmParamAccess[accessid].data,
- OmParamAccess[accessid].size);
+ (unsigned int) OmParamAccess[accessid].size);
status = 1;
break;
};
@@ -1045,7 +1057,7 @@ void
OmProcessOverlap(void *zinc,
int width,
int height,
- double scale)
+ double scale __unused)
{
double acceleration = 0.0;
int ip, iw;