- Fixed a crash coming from velo.c

- Improved saving of reflection lists
- The other changes are mostly whitespace
This commit is contained in:
koennecke
2009-10-30 13:49:37 +00:00
parent cb0e4ea434
commit 2e873e3059
13 changed files with 79 additions and 14 deletions

View File

@ -9,6 +9,8 @@
copyright: see file COPYRIGHT
Mark Koennecke, June 2003
added addto. Mark Koennecke, August 2009
----------------------------------------------------------------------*/
#include <stdio.h>
#include <assert.h>
@ -424,6 +426,7 @@ static int divideSicsData(pSICSData self, SicsInterp * pSics,
return 1;
}
/*------------------------------------------------------------------*/
static int scaleSicsData(pSICSData self, SicsInterp * pSics,
SConnection * pCon, float scale)
@ -442,6 +445,24 @@ static int scaleSicsData(pSICSData self, SicsInterp * pSics,
}
return 1;
}
/*------------------------------------------------------------------*/
static int addToSicsData(pSICSData self, SicsInterp * pSics,
SConnection *pCon, float val)
{
int i;
float div;
for (i = 0; i < self->dataUsed; i++) {
div = getDataPos(self, i);
div += val;
if (self->dataType[i] == INTTYPE) {
self->data[i] = (int) fabsf(div);
} else {
memcpy(&self->data[i], &div, sizeof(float));
}
}
return 1;
}
/*-------------------------------------------------------------------*/
static int copyScanCounts(pSICSData self, int argc, char *argv[],
@ -938,7 +959,7 @@ int SICSDataAction(SConnection * pCon, SicsInterp * pSics, void *pData,
pSICSData self = NULL;
char pBueffel[132];
int pos;
float scale;
float scale, val;
self = (pSICSData) pData;
assert(self);
@ -992,6 +1013,12 @@ int SICSDataAction(SConnection * pCon, SicsInterp * pSics, void *pData,
return 0;
}
return scaleSicsData(self, pSics, pCon, atof(argv[2]));
} else if (strcmp(argv[1], "addto") == 0) {
if (argc < 3) {
SCWrite(pCon, "ERROR: need a value to add", eError);
return 0;
}
return addToSicsData(self, pSics, pCon, atof(argv[2]));
} else if (strcmp(argv[1], "copydata") == 0) {
return copyData(self, pSics, pCon, argc, argv);
} else if (strcmp(argv[1], "putint") == 0) {