|
From: <kin...@us...> - 2023-07-07 21:16:38
|
Revision: 7039
http://sourceforge.net/p/teem/code/7039
Author: kindlmann
Date: 2023-07-07 21:16:37 +0000 (Fri, 07 Jul 2023)
Log Message:
-----------
propagating AIR_STRLEN --> AIR_STRLEN+1 change
Modified Paths:
--------------
teem/trunk/src/ell/genmat.c
teem/trunk/src/ell/test/inter.c
Modified: teem/trunk/src/ell/genmat.c
===================================================================
--- teem/trunk/src/ell/genmat.c 2023-07-07 21:14:40 UTC (rev 7038)
+++ teem/trunk/src/ell/genmat.c 2023-07-07 21:16:37 UTC (rev 7039)
@@ -105,7 +105,7 @@
static const char me[] = "ell_Nm_mul";
double *A, *B, *AB, tmp;
size_t LL, MM, NN, ll, mm, nn;
- char stmp[4][AIR_STRLEN_SMALL];
+ char stmp[4][AIR_STRLEN_SMALL + 1];
if (!(nAB && !ell_Nm_check(nA, AIR_FALSE) && !ell_Nm_check(nB, AIR_FALSE))) {
biffAddf(ELL, "%s: NULL or invalid args", me);
@@ -172,7 +172,7 @@
}
}
if (!big) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
biffAddf(ELL, "%s: singular matrix since column %s all zero", me,
airSprintSize_t(stmp, ii));
/* return 1; (for biff auto-scan) */
@@ -347,7 +347,7 @@
NN = nmat->axis[0].size;
if (!(NN == nmat->axis[1].size)) {
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
biffAddf(ELL, "%s: need a square matrix, not %s-by-%s", me,
airSprintSize_t(stmp[0], nmat->axis[1].size), airSprintSize_t(stmp[1], NN));
return 1;
Modified: teem/trunk/src/ell/test/inter.c
===================================================================
--- teem/trunk/src/ell/test/inter.c 2023-07-07 21:14:40 UTC (rev 7038)
+++ teem/trunk/src/ell/test/inter.c 2023-07-07 21:16:37 UTC (rev 7039)
@@ -33,20 +33,18 @@
#define WPS_X(x) AIR_AFFINE(wps->bbox[0], (x), wps->bbox[2], 0, wps->maxX)
#define WPS_Y(y) AIR_AFFINE(wps->bbox[1], (y), wps->bbox[3], 0, wps->maxY)
-#define WPS_S(s) AIR_DELTA(wps->bbox[1], (s), wps->bbox[3], 0, wps->maxY)
+#define WPS_S(s) AIR_DELTA(wps->bbox[1], (s), wps->bbox[3], 0, wps->maxY)
void
wheelPreamble(wheelPS *wps) {
- wps->maxX = wps->psc*(wps->bbox[2] - wps->bbox[0]);
- wps->maxY = wps->psc*(wps->bbox[3] - wps->bbox[1]);
+ wps->maxX = wps->psc * (wps->bbox[2] - wps->bbox[0]);
+ wps->maxY = wps->psc * (wps->bbox[3] - wps->bbox[1]);
fprintf(wps->file, "%%!PS-Adobe-2.0 EPSF-2.0\n");
fprintf(wps->file, "%%%%Creator: limn\n");
fprintf(wps->file, "%%%%Pages: 1\n");
- fprintf(wps->file, "%%%%BoundingBox: 0 0 %d %d\n",
- (int)(wps->maxX),
- (int)(wps->maxY));
+ fprintf(wps->file, "%%%%BoundingBox: 0 0 %d %d\n", (int)(wps->maxX), (int)(wps->maxY));
fprintf(wps->file, "%%%%EndComments\n");
fprintf(wps->file, "%%%%EndProlog\n");
fprintf(wps->file, "%%%%Page: 1 1\n");
@@ -87,8 +85,8 @@
}
void
-wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1,
- double alen, double awidth) {
+wheelArrow(wheelPS *wps, double x0, double y0, double x1, double y1, double alen,
+ double awidth) {
double len, dir[2], perp[2];
dir[0] = x0 - x1;
@@ -96,21 +94,18 @@
ELL_2V_NORM(dir, dir, len);
ELL_2V_SET(perp, -dir[1], dir[0]);
fprintf(wps->file, "%g %g M\n", WPS_X(x0), WPS_Y(y0));
- fprintf(wps->file, "%g %g L S\n",
- WPS_X(x1 + alen*dir[0]/2),
- WPS_Y(y1 + alen*dir[1]/2));
+ fprintf(wps->file, "%g %g L S\n", WPS_X(x1 + alen * dir[0] / 2),
+ WPS_Y(y1 + alen * dir[1] / 2));
if (alen && awidth) {
if (len < alen) {
- awidth *= len/alen;
+ awidth *= len / alen;
alen = len;
}
- fprintf(wps->file, "%g %g M\n",
- WPS_X(x1 + alen*dir[0] + awidth*perp[0]),
- WPS_Y(y1 + alen*dir[1] + awidth*perp[1]));
+ fprintf(wps->file, "%g %g M\n", WPS_X(x1 + alen * dir[0] + awidth * perp[0]),
+ WPS_Y(y1 + alen * dir[1] + awidth * perp[1]));
fprintf(wps->file, "%g %g L\n", WPS_X(x1), WPS_Y(y1));
- fprintf(wps->file, "%g %g L CP F\n",
- WPS_X(x1 + alen*dir[0] - awidth*perp[0]),
- WPS_Y(y1 + alen*dir[1] - awidth*perp[1]));
+ fprintf(wps->file, "%g %g L CP F\n", WPS_X(x1 + alen * dir[0] - awidth * perp[0]),
+ WPS_Y(y1 + alen * dir[1] - awidth * perp[1]));
}
return;
}
@@ -133,10 +128,9 @@
airArray *mop;
int fidx, aidx, num, frames;
- double psc, width[2], arrowWidth, lineWidth, angle, seglen,
- x0, y0, x1, y1, cc, ss;
+ double psc, width[2], arrowWidth, lineWidth, angle, seglen, x0, y0, x1, y1, cc, ss;
wheelPS wps;
- char filename[AIR_STRLEN_MED];
+ char filename[AIR_STRLEN_MED + 1];
me = argv[0];
mop = airMopNew();
@@ -144,26 +138,25 @@
hparm->elideMultipleNonExistFloatDefault = AIR_TRUE;
hopt = NULL;
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
- hestOptAdd(&hopt, "w", "arrowWidth lineWidth", airTypeDouble, 2, 2, width,
- "1.0 0.2", "widths");
- hestOptAdd(&hopt, "n", "number", airTypeInt, 1, 1, &num, "10",
- "number of arrows");
- hestOptAdd(&hopt, "f", "frames", airTypeInt, 1, 1, &frames, "10",
- "number of frames");
+ hestOptAdd(&hopt, "w", "arrowWidth lineWidth", airTypeDouble, 2, 2, width, "1.0 0.2",
+ "widths");
+ hestOptAdd(&hopt, "n", "number", airTypeInt, 1, 1, &num, "10", "number of arrows");
+ hestOptAdd(&hopt, "f", "frames", airTypeInt, 1, 1, &frames, "10", "number of frames");
hestOptAdd(&hopt, "psc", "scale", airTypeDouble, 1, 1, &psc, "200",
"scaling from world space to PostScript points");
hestOptAdd(&hopt, "o", "prefix", airTypeString, 1, 1, &outS, NULL,
"prefix of file names");
- hestParseOrDie(hopt, argc-1, argv+1, hparm,
- me, interInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, interInfo, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- for (fidx=0; fidx<frames; fidx++) {
+ for (fidx = 0; fidx < frames; fidx++) {
sprintf(filename, "%s%03d.eps", outS, fidx);
if (!(wps.file = airFopen(filename, stdout, "wb"))) {
fprintf(stderr, "%s: couldn't open output file\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
lineWidth = width[0];
@@ -179,20 +172,20 @@
x0 = 0;
y0 = 0;
- seglen = 1.0/num;
- angle = AIR_AFFINE(0, fidx, frames, 0, 2*AIR_PI);
- for (aidx=1; aidx<=num; aidx++) {
- cc = cos(angle*aidx)*seglen;
- ss = sin(angle*aidx)*seglen;
- x1 = x0 + 0.90*cc;
- y1 = y0 + 0.90*ss;
- wheelArrow(&wps, x0, y0, x1, y1, arrowWidth, arrowWidth*0.4);
+ seglen = 1.0 / num;
+ angle = AIR_AFFINE(0, fidx, frames, 0, 2 * AIR_PI);
+ for (aidx = 1; aidx <= num; aidx++) {
+ cc = cos(angle * aidx) * seglen;
+ ss = sin(angle * aidx) * seglen;
+ x1 = x0 + 0.90 * cc;
+ y1 = y0 + 0.90 * ss;
+ wheelArrow(&wps, x0, y0, x1, y1, arrowWidth, arrowWidth * 0.4);
x0 += cc;
y0 += ss;
}
wheelGray(&wps, 0.0);
- wheelArrow(&wps, 0, 0, x0, y0, arrowWidth, arrowWidth*0.4);
+ wheelArrow(&wps, 0, 0, x0, y0, arrowWidth, arrowWidth * 0.4);
wheelEpilog(&wps);
airFclose(wps.file);
@@ -202,7 +195,6 @@
exit(0);
}
-
/*
mkdir inter04
test/inter -w 4 0.08 -o inter04/ -n 4 -f 300
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|