|
From: <kin...@us...> - 2023-07-07 21:38:55
|
Revision: 7044
http://sourceforge.net/p/teem/code/7044
Author: kindlmann
Date: 2023-07-07 21:38:52 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/limn/cam.c
teem/trunk/src/limn/envmap.c
teem/trunk/src/limn/io.c
teem/trunk/src/limn/lpuFlotsam.c
teem/trunk/src/limn/lpu_about.c
teem/trunk/src/limn/splineMethods.c
teem/trunk/src/limn/splineMisc.c
teem/trunk/src/limn/test/plot.c
teem/trunk/src/limn/test/tcamanim.c
Modified: teem/trunk/src/limn/cam.c
===================================================================
--- teem/trunk/src/limn/cam.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/cam.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -191,7 +191,7 @@
limnSplineTypeSpec *posType, limnSplineTypeSpec *distType,
limnSplineTypeSpec *viewType) {
static const char me[] = "limnCameraPathMake";
- char which[AIR_STRLEN_MED];
+ char which[AIR_STRLEN_MED + 1];
airArray *mop;
Nrrd *nquat, *nfrom, *natpt, *nupvc, *ndist, *nfova, *ntime, *nsample;
double fratVec[3], *quat, *from, *atpt, *upvc, *dist, *fova, W2V[9], N[3], fratDist;
Modified: teem/trunk/src/limn/envmap.c
===================================================================
--- teem/trunk/src/limn/envmap.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/envmap.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -134,7 +134,7 @@
}
if (!(3 == envMap->axis[0].size && 256 == envMap->axis[1].size
&& 256 == envMap->axis[2].size)) {
- char stmp[3][AIR_STRLEN_SMALL];
+ char stmp[3][AIR_STRLEN_SMALL + 1];
biffAddf(LIMN,
"%s: dimension should be 3x256x256, not "
"%s x %s x %s",
Modified: teem/trunk/src/limn/io.c
===================================================================
--- teem/trunk/src/limn/io.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/io.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -264,7 +264,7 @@
limnObjectReadOFF(limnObject *obj, FILE *file) {
static const char me[] = "limnObjectReadOFF";
double vert[6];
- char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */
+ char line[AIR_STRLEN_LARGE + 1]; /* HEY: bad Gordon */
int lineCount, lookIdx, partIdx, idxTmp, faceNum, faceGot, got;
unsigned int vertGot, vertNum;
unsigned int ibuff[1024]; /* HEY: bad Gordon */
@@ -289,7 +289,7 @@
got = 0;
lineCount = 0;
do {
- if (!airOneLine(file, line, AIR_STRLEN_LARGE)) {
+ if (!airOneLine(file, line, AIR_STRLEN_LARGE + 1)) {
biffAddf(LIMN, "%s: hit EOF before getting #vert #face #edge line", me);
airMopError(mop);
return 1;
@@ -308,7 +308,7 @@
vertBase[partIdx] = vertGot;
while (vertGot < vertNum) {
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -368,7 +368,7 @@
faceGot = 0;
while (faceGot < faceNum) {
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -454,7 +454,7 @@
int /* Biff: 1 */
limnPolyDataWriteLMPD(FILE *file, const limnPolyData *pld) {
static const char me[] = "limnPolyDataWriteLMPD";
- char infoS[AIR_STRLEN_MED];
+ char infoS[AIR_STRLEN_MED + 1];
unsigned int primIdx, infoNum, flag, bit;
Nrrd *nrrd;
airArray *mop;
@@ -581,7 +581,7 @@
int /* Biff: 1 */
limnPolyDataReadLMPD(limnPolyData *pld, FILE *file) {
static const char me[] = "limnPolyDataReadLMPD";
- char line[AIR_STRLEN_MED], name[AIR_STRLEN_MED], *tmp;
+ char line[AIR_STRLEN_MED + 1], name[AIR_STRLEN_MED + 1], *tmp;
unsigned int vertNum, indxNum, primNum, primIdx, lineLen, infoNum, infoIdx, info, flag;
Nrrd *nrrd;
airArray *mop;
@@ -593,7 +593,7 @@
}
sprintf(name, "magic");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -604,7 +604,7 @@
}
sprintf(name, "nums");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -621,7 +621,7 @@
}
sprintf(name, "info");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -638,7 +638,7 @@
}
flag = 0;
for (infoIdx = 0; infoIdx < infoNum; infoIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, infoIdx, infoNum);
return 1;
@@ -660,7 +660,7 @@
/* actually, caller owns pld, so we don't register it with mop */
sprintf(name, "type");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -671,7 +671,7 @@
return 1;
}
for (primIdx = 0; primIdx < primNum; primIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, primIdx, primNum);
return 1;
@@ -685,7 +685,7 @@
}
sprintf(name, "icnt");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -696,7 +696,7 @@
return 1;
}
for (primIdx = 0; primIdx < primNum; primIdx++) {
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, name, primIdx, primNum);
return 1;
@@ -709,7 +709,7 @@
}
sprintf(name, "indx");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -757,7 +757,7 @@
ungetc(tmpChar, file);
sprintf(name, "xyzw");
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line", me, name);
return 1;
@@ -800,7 +800,7 @@
}
} while (DEMARK_CHAR != tmpChar);
ungetc(tmpChar, file);
- lineLen = airOneLine(file, line, AIR_STRLEN_MED);
+ lineLen = airOneLine(file, line, AIR_STRLEN_MED + 1);
if (!lineLen) {
biffAddf(LIMN, "%s: didn't get %s line %u/%u", me, INFO_STR, infoIdx, infoNum);
return 1;
@@ -872,7 +872,7 @@
}
static int /* Biff: 1 */
-_limnHestPolyDataLMPDParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestPolyDataLMPDParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestPolyDataLMPDParse";
char *nerr;
limnPolyData **lpldP;
@@ -902,7 +902,7 @@
airMopAdd(mop, *lpldP, (airMopper)limnPolyDataNix, airMopOnError);
if (limnPolyDataReadLMPD(*lpldP, file)) {
airMopAdd(mop, nerr = biffGetDone(LIMN), airFree, airMopOnError);
- airStrcpy(err, AIR_STRLEN_HUGE, nerr);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
}
@@ -917,7 +917,7 @@
const hestCB *const limnHestPolyDataLMPD = &_limnHestPolyDataLMPD;
static int
-_limnHestPolyDataOFFParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestPolyDataOFFParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestPolyDataOFFParse";
char *nerr;
limnPolyData **lpldP;
@@ -947,7 +947,7 @@
airMopAdd(mop, *lpldP, (airMopper)limnPolyDataNix, airMopOnError);
if (limnPolyDataReadOFF(*lpldP, file)) {
airMopAdd(mop, nerr = biffGetDone(LIMN), airFree, airMopOnError);
- strncpy(err, nerr, AIR_STRLEN_HUGE - 1);
+ airStrcpy(err, AIR_STRLEN_HUGE + 1, nerr);
airMopError(mop);
return 1;
}
@@ -1054,7 +1054,7 @@
int /* Biff: 1 */
limnPolyDataReadOFF(limnPolyData *pld, FILE *file) {
static const char me[] = "limnPolyDataReadOFF";
- char line[AIR_STRLEN_LARGE]; /* HEY: bad Gordon */
+ char line[AIR_STRLEN_LARGE + 1]; /* HEY: bad Gordon */
unsigned int num[3], xyzwNum, xyzwGot, faceNum, faceGot, lineCount, got, lret;
if (!(pld && file)) {
@@ -1067,7 +1067,7 @@
got = 0;
lineCount = 0;
do {
- if (!airOneLine(file, line, AIR_STRLEN_LARGE)) {
+ if (!airOneLine(file, line, AIR_STRLEN_LARGE + 1)) {
biffAddf(LIMN, "%s: hit EOF before getting #vert #face #edge line", me);
return 1;
}
@@ -1088,7 +1088,7 @@
while (xyzwGot < xyzwNum) {
float *xyzw;
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
@@ -1113,7 +1113,7 @@
while (faceGot < faceNum) {
unsigned int *indx, indxSingle[4], indxNum;
do {
- lret = airOneLine(file, line, AIR_STRLEN_LARGE);
+ lret = airOneLine(file, line, AIR_STRLEN_LARGE + 1);
lineCount++;
} while (1 == lret);
if (!lret) {
Modified: teem/trunk/src/limn/lpuFlotsam.c
===================================================================
--- teem/trunk/src/limn/lpuFlotsam.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/lpuFlotsam.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -38,7 +38,7 @@
void
limnPuUsage(const char *me, hestParm *hparm) {
unsigned int i, maxlen, len, c;
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_LARGE + 1];
maxlen = 0;
for (i = 0; limnPuCmdList[i]; i++) {
Modified: teem/trunk/src/limn/lpu_about.c
===================================================================
--- teem/trunk/src/limn/lpu_about.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/lpu_about.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -25,7 +25,7 @@
static int
limnPu_aboutMain(int argc, const char **argv, const char *me, hestParm *hparm) {
- char buff[AIR_STRLEN_LARGE], fmt[AIR_STRLEN_MED];
+ char buff[AIR_STRLEN_LARGE + 1], fmt[AIR_STRLEN_MED + 1];
char par1[] = "\t\t\t\t"
"\"lpu\" is a complete hack.\n";
char par2[] = "\t\t\t\t"
Modified: teem/trunk/src/limn/splineMethods.c
===================================================================
--- teem/trunk/src/limn/splineMethods.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/splineMethods.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -128,7 +128,7 @@
unsigned int size;
airArray *mop;
Nrrd *nin;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (airEnumValCheck(limnSplineInfo, info)) {
biffAddf(LIMN, "%s: info %d not a valid limnSplineInfo", me, info);
@@ -253,7 +253,7 @@
unsigned int wantSize;
Nrrd *ntmpA, *ntmpB;
airArray *mop;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (!(nout && nin)) {
biffAddf(LIMN, "%s: got NULL pointer", me);
@@ -422,7 +422,7 @@
limnSplineUpdate(limnSpline *spline, Nrrd *_ncpt) {
static const char me[] = "limnSplineUpdate";
Nrrd *ntmp;
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(spline && _ncpt)) {
biffAddf(LIMN, "%s: got NULL pointer", me);
Modified: teem/trunk/src/limn/splineMisc.c
===================================================================
--- teem/trunk/src/limn/splineMisc.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/splineMisc.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -365,7 +365,7 @@
** <splineType>[:B,C]
*/
static int
-_limnHestSplineTypeSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestSplineTypeSpecParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestSplineTypeSpecParse";
char *err2;
limnSplineTypeSpec **specP;
@@ -379,7 +379,7 @@
if (!(*specP = limnSplineTypeSpecParse(str))) {
err2 = biffGetDone(LIMN);
sprintf(err, "%s: couldn't parse \"%s\":\n", me, str);
- strncat(err, err2, AIR_STRLEN_HUGE - 1 - strlen(err));
+ strncat(err, err2, AIR_STRLEN_HUGE - strlen(err));
free(err2);
return 1;
}
@@ -399,7 +399,7 @@
** <nrrdFileName>:<splineInfo>:<splineType>[:B,C]
*/
static int
-_limnHestSplineParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE]) {
+_limnHestSplineParse(void *ptr, const char *str, char err[AIR_STRLEN_HUGE + 1]) {
static const char me[] = "_limnHestSplineParse";
char *err2;
limnSpline **splineP;
@@ -419,7 +419,7 @@
if (!(*splineP = limnSplineParse(str))) {
err2 = biffGetDone(LIMN);
sprintf(err, "%s: couldn't parse \"%s\":\n", me, str);
- strncat(err, err2, AIR_STRLEN_HUGE - 1 - strlen(err));
+ strncat(err, err2, AIR_STRLEN_HUGE - strlen(err));
free(err2);
return 1;
}
Modified: teem/trunk/src/limn/test/plot.c
===================================================================
--- teem/trunk/src/limn/test/plot.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/test/plot.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../limn.h"
const char *info = ("Plot!");
@@ -31,7 +30,7 @@
int nobg;
double bgColor[3];
- double maxX, maxY; /* set by plotPreamble */
+ double maxX, maxY; /* set by plotPreamble */
} plotPS;
typedef struct {
@@ -53,21 +52,19 @@
#define PPS_X(x) AIR_AFFINE(pps->bbox[0], (x), pps->bbox[2], 0, pps->maxX)
#define PPS_Y(y) AIR_AFFINE(pps->bbox[1], (y), pps->bbox[3], 0, pps->maxY)
-#define PPS_S(s) AIR_DELTA(pps->bbox[1], (s), pps->bbox[3], 0, pps->maxY)
+#define PPS_S(s) AIR_DELTA(pps->bbox[1], (s), pps->bbox[3], 0, pps->maxY)
void
plotPreamble(plotPS *pps, plotParm *pparm) {
AIR_UNUSED(pparm);
- pps->maxX = pps->psc*(pps->bbox[2] - pps->bbox[0]);
- pps->maxY = pps->psc*(pps->bbox[3] - pps->bbox[1]);
+ pps->maxX = pps->psc * (pps->bbox[2] - pps->bbox[0]);
+ pps->maxY = pps->psc * (pps->bbox[3] - pps->bbox[1]);
fprintf(pps->file, "%%!PS-Adobe-2.0 EPSF-2.0\n");
fprintf(pps->file, "%%%%Creator: plot\n");
fprintf(pps->file, "%%%%Pages: 1\n");
- fprintf(pps->file, "%%%%BoundingBox: 0 0 %d %d\n",
- (int)(pps->maxX),
- (int)(pps->maxY));
+ fprintf(pps->file, "%%%%BoundingBox: 0 0 %d %d\n", (int)(pps->maxX), (int)(pps->maxY));
fprintf(pps->file, "%%%%EndComments\n");
fprintf(pps->file, "%%%%EndProlog\n");
fprintf(pps->file, "%%%%Page: 1 1\n");
@@ -78,8 +75,8 @@
fprintf(pps->file, "0 %g lineto\n", pps->maxY);
fprintf(pps->file, "closepath\n");
if (!pps->nobg) {
- fprintf(pps->file, "gsave %g %g %g setrgbcolor fill grestore\n",
- pps->bgColor[0], pps->bgColor[1], pps->bgColor[2]);
+ fprintf(pps->file, "gsave %g %g %g setrgbcolor fill grestore\n", pps->bgColor[0],
+ pps->bgColor[1], pps->bgColor[2]);
}
fprintf(pps->file, "clip\n");
fprintf(pps->file, "gsave newpath\n");
@@ -102,7 +99,7 @@
plotWidth(plotPS *pps, plotParm *pparm, double width) {
AIR_UNUSED(pparm);
- fprintf(pps->file, "%g W\n", pps->psc*width);
+ fprintf(pps->file, "%g W\n", pps->psc * width);
return;
}
@@ -115,8 +112,7 @@
}
void
-plotLine(plotPS *pps, plotParm *pparm,
- double x0, double y0, double x1, double y1) {
+plotLine(plotPS *pps, plotParm *pparm, double x0, double y0, double x1, double y1) {
AIR_UNUSED(pparm);
fprintf(pps->file, "%g %g M\n", PPS_X(x0), PPS_Y(y0));
@@ -125,8 +121,7 @@
}
void
-plotLabel(plotPS *pps, plotParm *pparm, int centered,
- double x, double y, char *str) {
+plotLabel(plotPS *pps, plotParm *pparm, int centered, double x, double y, char *str) {
fprintf(pps->file, "gsave\n");
plotWidth(pps, pparm, 0);
@@ -133,11 +128,11 @@
if (centered) {
fprintf(pps->file,
"0 0 M (%s) false charpath pathbbox\n"
- "exch 4 1 roll sub 2 div 3 1 roll sub -2 div\n" /* don't ask */
+ "exch 4 1 roll sub 2 div 3 1 roll sub -2 div\n" /* don't ask */
"newpath %g add exch %g add M (%s) show\n",
str, PPS_X(x), PPS_Y(y), str);
} else {
- fprintf(pps->file, "%g %g M (%s) show\n", PPS_X(x), PPS_Y(y), str);
+ fprintf(pps->file, "%g %g M (%s) show\n", PPS_X(x), PPS_Y(y), str);
}
fprintf(pps->file, "grestore\n");
return;
@@ -146,39 +141,35 @@
void
plotAxes(plotPS *pps, plotParm *pparm, Nrrd *ndata) {
double axX, axY, xx, yy, toff;
- char buff[AIR_STRLEN_SMALL];
+ char buff[AIR_STRLEN_SMALL + 1];
int ti;
AIR_UNUSED(ndata);
- axX = AIR_AFFINE(pparm->dbox[0], pparm->axisOrig[0], pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- axY = AIR_AFFINE(pparm->dbox[1], pparm->axisOrig[1], pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
+ axX = AIR_AFFINE(pparm->dbox[0], pparm->axisOrig[0], pparm->dbox[2], pps->bbox[0],
+ pps->bbox[2]);
+ axY = AIR_AFFINE(pparm->dbox[1], pparm->axisOrig[1], pparm->dbox[3], pps->bbox[1],
+ pps->bbox[3]);
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->axisThick);
- plotLine(pps, pparm,
- axX, pps->bbox[1], axX, pps->bbox[3]);
- plotLine(pps, pparm,
- pps->bbox[0], axY, pps->bbox[2], axY);
+ plotLine(pps, pparm, axX, pps->bbox[1], axX, pps->bbox[3]);
+ plotLine(pps, pparm, pps->bbox[0], axY, pps->bbox[2], axY);
if (strlen(pparm->axisHorzLabel) || strlen(pparm->axisVertLabel)) {
fprintf(pps->file, "/Helvetica findfont 20 scalefont setfont\n");
if (strlen(pparm->axisHorzLabel)) {
- plotLabel(pps, pparm, AIR_FALSE,
- pps->bbox[2], axY, pparm->axisHorzLabel);
+ plotLabel(pps, pparm, AIR_FALSE, pps->bbox[2], axY, pparm->axisHorzLabel);
}
if (strlen(pparm->axisVertLabel)) {
- plotLabel(pps, pparm, AIR_FALSE,
- axX, pps->bbox[3], pparm->axisVertLabel);
+ plotLabel(pps, pparm, AIR_FALSE, axX, pps->bbox[3], pparm->axisVertLabel);
}
}
if (pparm->numHorzTick) {
if (pparm->tickThick > 0) {
- toff = pparm->tickLength/2;
+ toff = pparm->tickLength / 2;
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->tickThick);
- for (ti=0; ti<pparm->numHorzTick; ti++) {
+ for (ti = 0; ti < pparm->numHorzTick; ti++) {
xx = AIR_AFFINE(pparm->dbox[0], pparm->horzTick[ti], pparm->dbox[2],
pps->bbox[0], pps->bbox[2]);
plotLine(pps, pparm, xx, axY - toff, xx, axY + toff);
@@ -187,7 +178,7 @@
if (pparm->tickLabelSize) {
fprintf(pps->file, "/Helvetica findfont %g scalefont setfont\n",
pparm->tickLabelSize);
- for (ti=0; ti<pparm->numHorzTick; ti++) {
+ for (ti = 0; ti < pparm->numHorzTick; ti++) {
xx = AIR_AFFINE(pparm->dbox[0], pparm->horzTick[ti], pparm->dbox[2],
pps->bbox[0], pps->bbox[2]);
yy = axY + pparm->horzTickLabelOffset;
@@ -198,10 +189,10 @@
}
if (pparm->numVertTick) {
if (pparm->tickThick > 0) {
- toff = pparm->tickLength/2;
+ toff = pparm->tickLength / 2;
plotGray(pps, pparm, 0);
plotWidth(pps, pparm, pparm->tickThick);
- for (ti=0; ti<pparm->numVertTick; ti++) {
+ for (ti = 0; ti < pparm->numVertTick; ti++) {
yy = AIR_AFFINE(pparm->dbox[1], pparm->vertTick[ti], pparm->dbox[3],
pps->bbox[1], pps->bbox[3]);
plotLine(pps, pparm, axX - toff, yy, axX + toff, yy);
@@ -210,7 +201,7 @@
if (pparm->tickLabelSize) {
fprintf(pps->file, "/Helvetica findfont %g scalefont setfont\n",
pparm->tickLabelSize);
- for (ti=0; ti<pparm->numVertTick; ti++) {
+ for (ti = 0; ti < pparm->numVertTick; ti++) {
yy = AIR_AFFINE(pparm->dbox[1], pparm->vertTick[ti], pparm->dbox[3],
pps->bbox[1], pps->bbox[3]);
xx = axX + pparm->vertTickLabelOffset;
@@ -226,7 +217,7 @@
unsigned int ii, npts;
double xx, yy, *data, val;
- if (!( pparm->graphThick[nidx] > 0 )) {
+ if (!(pparm->graphThick[nidx] > 0)) {
return;
}
@@ -233,17 +224,13 @@
data = (double *)(ndata[nidx]->data);
npts = AIR_UINT(ndata[nidx]->axis[1].size);
plotGray(pps, pparm, pparm->graphGray[nidx]);
- fprintf(pps->file, "%g W\n", pps->psc*pparm->graphThick[nidx]);
- for (ii=0; ii<npts; ii++) {
+ fprintf(pps->file, "%g W\n", pps->psc * pparm->graphThick[nidx]);
+ for (ii = 0; ii < npts; ii++) {
val = data[ii];
- xx = AIR_AFFINE(0, ii, npts-1,
- ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
- xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
- fprintf(pps->file, "%g %g %s\n", PPS_X(xx), PPS_Y(yy),
- ii ? "L" : "M");
+ xx = AIR_AFFINE(0, ii, npts - 1, ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
+ xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2], pps->bbox[0], pps->bbox[2]);
+ yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3], pps->bbox[1], pps->bbox[3]);
+ fprintf(pps->file, "%g %g %s\n", PPS_X(xx), PPS_Y(yy), ii ? "L" : "M");
}
fprintf(pps->file, "S\n");
}
@@ -253,7 +240,7 @@
unsigned int ii, npts;
double xx, yy, orad, irad, *data, val;
- if (!( pparm->dotDiameter[nidx] > 0 )) {
+ if (!(pparm->dotDiameter[nidx] > 0)) {
return;
}
@@ -262,23 +249,20 @@
plotWidth(pps, pparm, 0);
data = (double *)(ndata[nidx]->data);
npts = AIR_UINT(ndata[nidx]->axis[1].size);
- orad = pparm->dotDiameter[nidx]/2;
- irad = pparm->dotInnerDiameterFraction*orad;
- for (ii=0; ii<npts; ii++) {
+ orad = pparm->dotDiameter[nidx] / 2;
+ irad = pparm->dotInnerDiameterFraction * orad;
+ for (ii = 0; ii < npts; ii++) {
val = data[ii];
- xx = AIR_AFFINE(0, ii, npts-1,
- ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
- xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2],
- pps->bbox[0], pps->bbox[2]);
- yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3],
- pps->bbox[1], pps->bbox[3]);
+ xx = AIR_AFFINE(0, ii, npts - 1, ndata[nidx]->axis[1].min, ndata[nidx]->axis[1].max);
+ xx = AIR_AFFINE(pparm->dbox[0], xx, pparm->dbox[2], pps->bbox[0], pps->bbox[2]);
+ yy = AIR_AFFINE(pparm->dbox[1], val, pparm->dbox[3], pps->bbox[1], pps->bbox[3]);
plotGray(pps, pparm, pparm->dotGray[nidx]);
- fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n",
- PPS_X(xx), PPS_Y(yy), PPS_S(orad));
+ fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n", PPS_X(xx), PPS_Y(yy),
+ PPS_S(orad));
if (irad) {
plotGray(pps, pparm, 1.0);
- fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n",
- PPS_X(xx), PPS_Y(yy), PPS_S(irad));
+ fprintf(pps->file, "%g %g %g 0 360 arc closepath fill\n", PPS_X(xx), PPS_Y(yy),
+ PPS_S(irad));
}
}
fprintf(pps->file, "grestore\n");
@@ -298,7 +282,7 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
int numGrth, numDtdi, numGrgr, numDtgr, numNrrd, ni;
@@ -311,126 +295,105 @@
me = argv[0];
hestOptAdd(&hopt, "i", "data", airTypeOther, 1, -1, &_ndata, NULL,
- "input nrrd containing data to plot",
- &numNrrd, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "dbox", "minX minY maxX maxY", airTypeDouble,
- 4, 4, pparm.dbox, NULL,
+ "input nrrd containing data to plot", &numNrrd, NULL, nrrdHestNrrd);
+ hestOptAdd(&hopt, "dbox", "minX minY maxX maxY", airTypeDouble, 4, 4, pparm.dbox, NULL,
"bounding box, in data space");
- hestOptAdd(&hopt, "bbox", "minX minY maxX maxY", airTypeDouble,
- 4, 4, pps.bbox, NULL,
+ hestOptAdd(&hopt, "bbox", "minX minY maxX maxY", airTypeDouble, 4, 4, pps.bbox, NULL,
"bounding box, in graph space");
hestOptAdd(&hopt, "psc", "PS scale", airTypeDouble, 1, 1, &(pps.psc), "300",
"scaling from graph space to PostScript points");
hestOptAdd(&hopt, "nobg", NULL, airTypeInt, 0, 0, &(pps.nobg), NULL,
"don't fill with background color");
- hestOptAdd(&hopt, "bg", "background", airTypeDouble, 3, 3,
- &(pps.bgColor), "1 1 1",
+ hestOptAdd(&hopt, "bg", "background", airTypeDouble, 3, 3, &(pps.bgColor), "1 1 1",
"background RGB color; each component in range [0.0,1.0]");
- hestOptAdd(&hopt, "grth", "graph thickness", airTypeDouble,
- 1, -1, &(pparm.graphThick), "0.01",
- "thickness of line for graph, or \"0\" for no graph line",
+ hestOptAdd(&hopt, "grth", "graph thickness", airTypeDouble, 1, -1, &(pparm.graphThick),
+ "0.01", "thickness of line for graph, or \"0\" for no graph line",
&numGrth);
- hestOptAdd(&hopt, "grgr", "graph gray", airTypeDouble,
- 1, -1, &(pparm.graphGray), "0",
+ hestOptAdd(&hopt, "grgr", "graph gray", airTypeDouble, 1, -1, &(pparm.graphGray), "0",
"grayscale to use for graph", &numGrgr);
- hestOptAdd(&hopt, "dtdi", "dot diameter", airTypeDouble,
- 1, -1, &(pparm.dotDiameter), "0.1",
- "radius of dot drawn at data points, or \"0\" for no dots",
+ hestOptAdd(&hopt, "dtdi", "dot diameter", airTypeDouble, 1, -1, &(pparm.dotDiameter),
+ "0.1", "radius of dot drawn at data points, or \"0\" for no dots",
&numDtdi);
- hestOptAdd(&hopt, "dtgr", "dot gray", airTypeDouble,
- 1, -1, &(pparm.dotGray), "0",
+ hestOptAdd(&hopt, "dtgr", "dot gray", airTypeDouble, 1, -1, &(pparm.dotGray), "0",
"grayscale to use for dots", &numDtgr);
- hestOptAdd(&hopt, "dtid", "dot inner diam frac", airTypeDouble,
- 1, 1, &(pparm.dotInnerDiameterFraction), "0.0",
+ hestOptAdd(&hopt, "dtid", "dot inner diam frac", airTypeDouble, 1, 1,
+ &(pparm.dotInnerDiameterFraction), "0.0",
"fractional radius of white dot drawn within dot");
- hestOptAdd(&hopt, "tihz", "pos", airTypeDouble,
- 0, -1, &(pparm.horzTick), "",
- "locations for tickmarks on horizontal axis",
- &(pparm.numHorzTick));
- hestOptAdd(&hopt, "tivt", "pos", airTypeDouble,
- 0, -1, &(pparm.vertTick), "",
- "locations for tickmarks on vertical axis",
- &(pparm.numVertTick));
- hestOptAdd(&hopt, "tiho", "offset", airTypeDouble,
- 1, 1, &(pparm.horzTickLabelOffset), "0",
- "horizontal tick label offset");
- hestOptAdd(&hopt, "tivo", "offset", airTypeDouble,
- 1, 1, &(pparm.vertTickLabelOffset), "0",
- "vertical tick label offset");
- hestOptAdd(&hopt, "tils", "size", airTypeDouble,
- 1, 1, &(pparm.tickLabelSize), "0",
+ hestOptAdd(&hopt, "tihz", "pos", airTypeDouble, 0, -1, &(pparm.horzTick), "",
+ "locations for tickmarks on horizontal axis", &(pparm.numHorzTick));
+ hestOptAdd(&hopt, "tivt", "pos", airTypeDouble, 0, -1, &(pparm.vertTick), "",
+ "locations for tickmarks on vertical axis", &(pparm.numVertTick));
+ hestOptAdd(&hopt, "tiho", "offset", airTypeDouble, 1, 1, &(pparm.horzTickLabelOffset),
+ "0", "horizontal tick label offset");
+ hestOptAdd(&hopt, "tivo", "offset", airTypeDouble, 1, 1, &(pparm.vertTickLabelOffset),
+ "0", "vertical tick label offset");
+ hestOptAdd(&hopt, "tils", "size", airTypeDouble, 1, 1, &(pparm.tickLabelSize), "0",
"font size for labels on tick marks, or \"0\" for no labels");
- hestOptAdd(&hopt, "tith", "tick thickness", airTypeDouble,
- 1, 1, &(pparm.tickThick), "0.01",
- "thickness of lines for tick marks");
- hestOptAdd(&hopt, "tiln", "tick length", airTypeDouble,
- 1, 1, &(pparm.tickLength), "0.08",
- "length of lines for tick marks");
+ hestOptAdd(&hopt, "tith", "tick thickness", airTypeDouble, 1, 1, &(pparm.tickThick),
+ "0.01", "thickness of lines for tick marks");
+ hestOptAdd(&hopt, "tiln", "tick length", airTypeDouble, 1, 1, &(pparm.tickLength),
+ "0.08", "length of lines for tick marks");
- hestOptAdd(&hopt, "axth", "axis thickness", airTypeDouble,
- 1, 1, &(pparm.axisThick), "0.01",
- "thickness of lines for axes");
- hestOptAdd(&hopt, "axor", "axis origin", airTypeDouble,
- 2, 2, &(pparm.axisOrig), "0 0",
+ hestOptAdd(&hopt, "axth", "axis thickness", airTypeDouble, 1, 1, &(pparm.axisThick),
+ "0.01", "thickness of lines for axes");
+ hestOptAdd(&hopt, "axor", "axis origin", airTypeDouble, 2, 2, &(pparm.axisOrig), "0 0",
"origin of lines for axes, in data space");
- hestOptAdd(&hopt, "axhl", "horiz axis label", airTypeString,
- 1, 1, &(pparm.axisHorzLabel), "",
- "label on horizontal axis");
- hestOptAdd(&hopt, "axvl", "vert axis label", airTypeString,
- 1, 1, &(pparm.axisVertLabel), "",
- "label on vertical axis");
+ hestOptAdd(&hopt, "axhl", "horiz axis label", airTypeString, 1, 1,
+ &(pparm.axisHorzLabel), "", "label on horizontal axis");
+ hestOptAdd(&hopt, "axvl", "vert axis label", airTypeString, 1, 1,
+ &(pparm.axisVertLabel), "", "label on vertical axis");
- hestOptAdd(&hopt, "o", "output PS", airTypeString,
- 1, 1, &outS, "out.ps",
+ hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps",
"output file to render postscript into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- if (!( numGrth == numDtdi
- && numDtdi == numGrgr
- && numGrgr == numDtgr )) {
- fprintf(stderr, "%s: number of arguments given to grth (%d), dtdi (%d), "
- "grgr (%d), dtgr (%d) not all equal\n", me,
- numGrth, numDtdi, numGrgr, numDtgr);
- airMopError(mop); return 1;
+ if (!(numGrth == numDtdi && numDtdi == numGrgr && numGrgr == numDtgr)) {
+ fprintf(stderr,
+ "%s: number of arguments given to grth (%d), dtdi (%d), "
+ "grgr (%d), dtgr (%d) not all equal\n",
+ me, numGrth, numDtdi, numGrgr, numDtgr);
+ airMopError(mop);
+ return 1;
}
- if (!( numNrrd == numGrth )) {
- fprintf(stderr, "%s: number of nrrds (%d) != number graph options (%d)\n",
- me, numNrrd, numGrth);
- airMopError(mop); return 1;
+ if (!(numNrrd == numGrth)) {
+ fprintf(stderr, "%s: number of nrrds (%d) != number graph options (%d)\n", me,
+ numNrrd, numGrth);
+ airMopError(mop);
+ return 1;
}
/* check nrrds */
- for (ni=0; ni<numNrrd; ni++) {
- if (!( (1 == _ndata[ni]->dim || 2 == _ndata[ni]->dim)
- && nrrdTypeBlock != _ndata[ni]->type )) {
- fprintf(stderr, "%s: input nrrd must be 1-D or 2-D array of scalars",
- me);
- airMopError(mop); return 1;
+ for (ni = 0; ni < numNrrd; ni++) {
+ if (!((1 == _ndata[ni]->dim || 2 == _ndata[ni]->dim)
+ && nrrdTypeBlock != _ndata[ni]->type)) {
+ fprintf(stderr, "%s: input nrrd must be 1-D or 2-D array of scalars", me);
+ airMopError(mop);
+ return 1;
}
}
- ndata = (Nrrd**)calloc(numNrrd, sizeof(Nrrd *));
+ ndata = (Nrrd **)calloc(numNrrd, sizeof(Nrrd *));
airMopAdd(mop, ndata, airFree, airMopAlways);
- for (ni=0; ni<numNrrd; ni++) {
+ for (ni = 0; ni < numNrrd; ni++) {
ndata[ni] = nrrdNew();
airMopAdd(mop, ndata[ni], (airMopper)nrrdNuke, airMopAlways);
if (nrrdConvert(ndata[ni], _ndata[ni], nrrdTypeDouble)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: couldn't convert input %d to %s:\n%s\n",
- me, ni, airEnumStr(nrrdType, nrrdTypeDouble), err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: couldn't convert input %d to %s:\n%s\n", me, ni,
+ airEnumStr(nrrdType, nrrdTypeDouble), err);
+ airMopError(mop);
+ return 1;
}
if (1 == ndata[ni]->dim) {
if (nrrdAxesInsert(ndata[ni], ndata[ni], 0)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: couldn't insert axis 0 on nrrd %d:\n%s\n",
- me, ni, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: couldn't insert axis 0 on nrrd %d:\n%s\n", me, ni, err);
+ airMopError(mop);
+ return 1;
}
}
/* currently assuming node centering */
@@ -438,19 +401,20 @@
ndata[ni]->axis[1].min = 0;
}
if (!AIR_EXISTS(ndata[ni]->axis[1].max)) {
- ndata[ni]->axis[1].max = ndata[ni]->axis[1].size-1;
+ ndata[ni]->axis[1].max = ndata[ni]->axis[1].size - 1;
}
}
if (!(pps.file = airFopen(outS, stdout, "wb"))) {
fprintf(stderr, "%s: couldn't open output file\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, pps.file, (airMopper)airFclose, airMopAlways);
plotPreamble(&pps, &pparm);
plotAxes(&pps, &pparm, ndata[0]);
- for (ni=0; ni<numNrrd; ni++) {
+ for (ni = 0; ni < numNrrd; ni++) {
plotGraph(&pps, &pparm, ndata, ni);
plotDots(&pps, &pparm, ndata, ni);
}
Modified: teem/trunk/src/limn/test/tcamanim.c
===================================================================
--- teem/trunk/src/limn/test/tcamanim.c 2023-07-07 21:32:07 UTC (rev 7043)
+++ teem/trunk/src/limn/test/tcamanim.c 2023-07-07 21:38:52 UTC (rev 7044)
@@ -29,16 +29,16 @@
_limnReadCamanim(int imgSize[2], limnCamera **keycamP, double **timeP,
unsigned int *numKeysP, FILE *fin) {
static const char me[] = "_limnReadCamanim";
- char line[AIR_STRLEN_HUGE];
+ char line[AIR_STRLEN_HUGE + 1];
unsigned int ki;
double *tmp, *dwell, di, dn, df, fr[3], at[3], up[3], va;
airArray *mop, *camA, *dwellA;
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE) && !strcmp(_LIMNMAGIC, line))) {
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1) && !strcmp(_LIMNMAGIC, line))) {
biffAddf(LIMN, "%s: couldn't read first line or it wasn't \"%s\"", me, _LIMNMAGIC);
return 1;
}
- if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE)
+ if (!(0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)
&& 2
== (airStrtrans(airStrtrans(line, '{', ' '), '}', ' '),
sscanf(line, "imgSize %d %d", imgSize + 0, imgSize + 1)))) {
@@ -54,7 +54,7 @@
airMopAdd(mop, camA, (airMopper)airArrayNix, airMopAlways);
airMopAdd(mop, dwellA, (airMopper)airArrayNuke, airMopAlways);
- while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE)) {
+ while (0 < airOneLine(fin, line, AIR_STRLEN_HUGE + 1)) {
airStrtrans(airStrtrans(line, '{', ' '), '}', ' ');
ki = airArrayLenIncr(camA, 1);
airArrayLenIncr(dwellA, 1);
@@ -103,7 +103,7 @@
int
_limnWriteCamanim(FILE *fout, int imgSize[2], limnCamera *cam, int numFrames) {
- /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED]; */
+ /* char me[]="_limnWriteCamanim", err[AIR_STRLEN_MED+1]; */
int fi;
fprintf(fout, "%s\n", _LIMNMAGIC);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|