You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2025-10-02 05:16:32
|
Revision: 7561
http://sourceforge.net/p/teem/code/7561
Author: kindlmann
Date: 2025-10-02 05:16:30 +0000 (Thu, 02 Oct 2025)
Log Message:
-----------
using more snprintf instead of sprintf, and disclaiming sprintf use more
Modified Paths:
--------------
teem/trunk/src/air/enum.c
teem/trunk/src/air/miscAir.c
Modified: teem/trunk/src/air/enum.c
===================================================================
--- teem/trunk/src/air/enum.c 2025-10-02 04:46:15 UTC (rev 7560)
+++ teem/trunk/src/air/enum.c 2025-10-02 05:16:30 UTC (rev 7561)
@@ -142,18 +142,17 @@
}
/*
-******** airEnumFmtDesc()
-**
-** Formats a description line for one element "val" of airEnum "enm",
-** and puts the result in a NEWLY ALLOCATED string which is the return
-** of this function. The formatting is done via sprintf(), as governed
-** by "fmt", which should contain to "%s" conversion sequences, the
-** first for the string version "val", and the second for the
-** description If "canon", then the canonical string representation
-** will be used (the one in enm->str[]), otherwise the shortest string
-** representation will be used (which differs from the canonical one
-** when there is a strEqv[]/valEqv[] pair defining a shorter string)
-*/
+ ******* airEnumFmtDesc()
+ *
+ * Formats a description line for one element `val` of airEnum `enm`, and puts the result
+ * in a NEWLY ALLOCATED string which is the return of this function. The formatting is
+ * done via snprintf(), as governed by `fmt`, which should contain two `%s` conversion
+ * sequences, the first for the string version `val`, and the second for the description.
+ * If `canon`, then the canonical string representation will be used (the one in
+ * enm->str[]), otherwise the shortest string representation will be used (which differs
+ * from the canonical one when there is a strEqv[]/valEqv[] pair defining a shorter
+ * string)
+ */
char *
airEnumFmtDesc(const airEnum *enm, int val, int canon, const char *fmt) {
const char *desc;
@@ -160,7 +159,7 @@
char *buff, ident[AIR_STRLEN_SMALL + 1];
const char *_ident;
int i;
- size_t len;
+ size_t bsize, len;
if (!(enm && enm->desc && fmt)) {
return airStrdup("(airEnumDesc: invalid args)");
@@ -188,9 +187,11 @@
airToLower(ident);
}
desc = enm->desc[_airEnumIndex(enm, val)];
- buff = AIR_CALLOC(airStrlen(fmt) + airStrlen(ident) + airStrlen(desc) + 1, char);
+ bsize = airStrlen(fmt) + airStrlen(ident) + airStrlen(desc) + 1;
+ buff = AIR_CALLOC(bsize, char);
if (buff) {
- sprintf(buff, fmt, ident, desc);
+ /* snprintf just in case our math is wrong */
+ snprintf(buff, bsize, fmt, ident, desc);
}
return buff;
}
Modified: teem/trunk/src/air/miscAir.c
===================================================================
--- teem/trunk/src/air/miscAir.c 2025-10-02 04:46:15 UTC (rev 7560)
+++ teem/trunk/src/air/miscAir.c 2025-10-02 05:16:30 UTC (rev 7561)
@@ -48,9 +48,9 @@
*/
void
airTeemVersionSprint(char buff[AIR_STRLEN_LARGE + 1]) {
- sprintf(buff, "Teem version %s, %s%s%s", airTeemVersion,
- airTeemReleaseDone ? "released on " : "", airTeemReleaseDate,
- airTeemReleaseDone ? "" : " (not yet released)");
+ snprintf(buff, AIR_STRLEN_LARGE + 1, "Teem version %s, %s%s%s", airTeemVersion,
+ airTeemReleaseDone ? "released on " : "", airTeemReleaseDate,
+ airTeemReleaseDone ? "" : " (not yet released)");
return;
}
@@ -152,23 +152,25 @@
}
/*
-******** airSinglePrintf
-**
-** a complete stand-in for {f|s}printf(), as long as the given format
-** string contains exactly one conversion sequence. The utility of
-** this is to standardize the printing of IEEE 754 special values:
-** NAN (any kind) -> "NaN"
-** POS_INF -> "+inf"
-** NEG_INF -> "-inf"
-** The format string can contain other things besides just the
-** conversion sequence: airSingleFprintf(f, " (%f)\n", AIR_NAN)
-** will be the same as fprintf(f, " (%s)\n", "NaN");
-**
-** To get fprintf behavior, pass "str" as NULL
-** to get sprintf bahavior, pass "file" as NULL
-**
-** Finding a complete {f|s|}printf replacement is a priority for Teem 2.0
-*/
+ ******* airSinglePrintf
+ *
+ * a complete stand-in for {f|s}printf(), as long as the given format string contains
+ * exactly one conversion sequence, and does use any precision modifiers. The utility of
+ * this is to standardize the printing of IEEE 754 special values:
+ * NAN (any kind) -> "NaN"
+ * POS_INF -> "+inf"
+ * NEG_INF -> "-inf"
+ * The format string can contain other things besides just the conversion sequence:
+ * airSinglePrintf(f, NULL, " (%f)\n", AIR_NAN) will be the same as:
+ * fprintf(f, " (%s)\n", "NaN");
+ *
+ * To get fprintf behavior, pass "str" as NULL
+ * to get sprintf bahavior, pass "file" as NULL. AND NOTE THAT THIS DOES USE sprintf
+ * and not snprintf because we're not in a position to know what the buffer size is.
+ *
+ * Finding a complete {f|s|}printf replacement would be great, but finding one compatible
+ * with our LGPL+linking exception is hard.
+ */
int
airSinglePrintf(FILE *file, char *str, const char *_fmt, ...) {
char *fmt, buff[AIR_STRLEN_LARGE + 1];
@@ -368,7 +370,7 @@
break;
}
}
- sprintf(str, "%g %s", dval, suff[suffIdx]);
+ snprintf(str, AIR_STRLEN_SMALL + 1, "%g %s", dval, suff[suffIdx]);
return str;
}
@@ -566,15 +568,15 @@
}
/*
-******* airDoneStr()
-**
-** dinky little utility for generating progress messages of the form
-** " 1.9%" or " 35.3%" or "100.0%"
-**
-** The message will ALWAYS be six characters, and will ALWAYS be
-** preceeded by six backspaces. Thus, you pass in a string to print
-** into, and it had better be allocated for at least 6+6+1 = 13 chars.
-*/
+ ****** airDoneStr()
+ *
+ * dinky little utility for generating progress messages of the form
+ * " 1.9%" or " 35.3%" or "100.0%"
+ *
+ * The message will ALWAYS be six characters, and will ALWAYS be preceeded by six
+ * backspaces. Thus, you pass in a string to sprintf() into (yes sprintf not snprintf),
+ * and it had better be allocated for at least 6+6+1 = 13 chars.
+ */
char *
airDoneStr(double start, double here, double end, char *str) {
int perc = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-10-02 04:46:16
|
Revision: 7560
http://sourceforge.net/p/teem/code/7560
Author: kindlmann
Date: 2025-10-02 04:46:15 +0000 (Thu, 02 Oct 2025)
Log Message:
-----------
long overdue fix of buffer overflow bug in biff: should have been using snprintf/vsnprintf instead of sprintf/vsprintf, yikes. h/t Jorik Blaas for finding this
Modified Paths:
--------------
teem/trunk/src/biff/biffmsg.c
Modified: teem/trunk/src/biff/biffmsg.c
===================================================================
--- teem/trunk/src/biff/biffmsg.c 2025-10-01 20:03:38 UTC (rev 7559)
+++ teem/trunk/src/biff/biffmsg.c 2025-10-02 04:46:15 UTC (rev 7560)
@@ -21,10 +21,12 @@
#include "privateBiff.h"
/*
-** with the Nov'09 re-write of biff, this sourcefile becomes the only
-** place where a static buffer is used for message handling; this
-** should eventually be avoided by using things like asprintf and
-** vasprintf which allocated the string as needed
+With the Nov'09 re-write of biff, this sourcefile becomes the only place where a static
+buffer is used for message handling; this should eventually be avoided by using things
+like asprintf and vasprintf which allocated the string as needed. However (writing here
+in 2025), vasprintf is not apparently part of any C standard (as per
+https://en.cppreference.com/w/c/experimental/dynamic/asprintf), so we make do with
+snprintf and vsnprintf
*/
#define _HACK_STRLEN AIR_STRLEN_HUGE
#define _MSG_INCR 2
@@ -118,7 +120,8 @@
_biffMsgAddVL(biffMsg *msg, const char *errfmt, va_list args) {
char errstr[_HACK_STRLEN + 1];
- vsprintf(errstr, errfmt, args);
+ /* h/t Jorik Blaas for highlighting need for vsnprintf over vsprintf */
+ vsnprintf(errstr, _HACK_STRLEN + 1, errfmt, args);
biffMsgAdd(msg, errstr);
return;
}
@@ -173,6 +176,7 @@
biffMsgMove(biffMsg *dest, biffMsg *src, const char *err) {
static const char me[] = "biffMsgMove";
unsigned int ii;
+ size_t bsize;
char *buff;
if (&_biffMsgNoop == dest || &_biffMsgNoop == src) {
@@ -189,13 +193,14 @@
return;
}
- buff = AIR_CALLOC(_biffMsgLineLenMax(src) + 1, char);
+ bsize = _biffMsgLineLenMax(src) + 1;
+ buff = AIR_CALLOC(bsize, char);
if (!buff) {
fprintf(stderr, "%s: PANIC: can't allocate buffer\n", me);
return; /* exit(1); */
}
for (ii = 0; ii < src->errNum; ii++) {
- sprintf(buff, "[%s] %s", src->key, src->err[ii]);
+ snprintf(buff, bsize, "[%s] %s", src->key, src->err[ii]);
biffMsgAdd(dest, buff);
}
free(buff);
@@ -210,7 +215,7 @@
_biffMsgMoveVL(biffMsg *dest, biffMsg *src, const char *errfmt, va_list args) {
char errstr[_HACK_STRLEN + 1];
- vsprintf(errstr, errfmt, args);
+ vsnprintf(errstr, _HACK_STRLEN + 1, errfmt, args);
biffMsgMove(dest, src, errstr);
return;
}
@@ -294,6 +299,7 @@
biffMsgStrSet(char *ret, const biffMsg *msg) {
static const char me[] = "biffMsgStrSet";
char *buff;
+ size_t bsize;
unsigned int ii;
if (&_biffMsgNoop == msg) {
@@ -303,7 +309,8 @@
fprintf(stderr, "%s: PANIC got NULL ret", me);
return;
}
- buff = AIR_CALLOC(_biffMsgLineLenMax(msg) + 1, char);
+ bsize = _biffMsgLineLenMax(msg) + 1;
+ buff = AIR_CALLOC(bsize, char);
if (!buff) {
fprintf(stderr, "%s: PANIC couldn't alloc buffer", me);
return; /* exit(1); */
@@ -310,7 +317,7 @@
}
strcpy(ret, "");
for (ii = msg->errNum; ii > 0; ii--) {
- sprintf(buff, "[%s] %s\n", msg->key, msg->err[ii - 1]);
+ snprintf(buff, bsize, "[%s] %s\n", msg->key, msg->err[ii - 1]);
strcat(ret, buff);
}
free(buff);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-10-01 20:03:43
|
Revision: 7559
http://sourceforge.net/p/teem/code/7559
Author: kindlmann
Date: 2025-10-01 20:03:38 +0000 (Wed, 01 Oct 2025)
Log Message:
-----------
new source file for old CMakefiles
Modified Paths:
--------------
teem/trunk/src/hest/CMakeLists-v1.txt
teem/trunk/src/hest/CMakeLists.txt
Modified: teem/trunk/src/hest/CMakeLists-v1.txt
===================================================================
--- teem/trunk/src/hest/CMakeLists-v1.txt 2025-10-01 15:17:29 UTC (rev 7558)
+++ teem/trunk/src/hest/CMakeLists-v1.txt 2025-10-01 20:03:38 UTC (rev 7559)
@@ -8,6 +8,7 @@
privateHest.h
usage.c
adders.c
+ argvHest.c
)
target_sources(teem PRIVATE ${HEST_SOURCES})
Modified: teem/trunk/src/hest/CMakeLists.txt
===================================================================
--- teem/trunk/src/hest/CMakeLists.txt 2025-10-01 15:17:29 UTC (rev 7558)
+++ teem/trunk/src/hest/CMakeLists.txt 2025-10-01 20:03:38 UTC (rev 7559)
@@ -8,6 +8,7 @@
privateHest.h
usage.c
adders.c
+ argvHest.c
)
target_sources(teem PRIVATE ${HEST_SOURCES})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-10-01 15:17:31
|
Revision: 7558
http://sourceforge.net/p/teem/code/7558
Author: kindlmann
Date: 2025-10-01 15:17:29 +0000 (Wed, 01 Oct 2025)
Log Message:
-----------
writing tweaks
Modified Paths:
--------------
teem/trunk/src/biff/0-README.md
Modified: teem/trunk/src/biff/0-README.md
===================================================================
--- teem/trunk/src/biff/0-README.md 2025-10-01 00:32:20 UTC (rev 7557)
+++ teem/trunk/src/biff/0-README.md 2025-10-01 15:17:29 UTC (rev 7558)
@@ -1,6 +1,6 @@
# All about `/* Biff: */` annotations (new with Teem v2)
-Teem uses its `biff` library to collect error messages (based on its use in 90s skater culture to mean a hard fall). `biff` is not thread-safe, but that has never been the biggest barrier to its use (or Teem's use in general). Instead, a bigger problem is that there's nothing a function type signature that advertises whether it uses `biff` at all, or what return values from the function indicate the error conditions that would have generated `biff` messages that need to be collected and passed along to the user. Thankfully, there are now some automated tools to help with this.
+Teem uses its `biff` library to collect error messages (based on 90s skater culture using "biff" to mean a hard fall). `biff` is not thread-safe, but that has never been the biggest barrier to its use (or Teem's use in general). Instead, a bigger problem is that there's nothing in a function type signature that advertises whether it uses `biff` at all, or what return values from the function indicate the error conditions that would have generated `biff` messages that need to be collected and passed along to the user. Thankfully, there are now some semi-automated tools to help with this.
`teem/src/_util/scan-symbols.py -biff` (which performs something that for no good reason started being called the "biff auto-scan") will scrutinize Teem source code to look at how it uses `biff`. This analysis creates parsable annotations of function definitions to automate whether and how `biffGetDone` is called in response to an error (in, say, a Python wrapper), as documented below.
@@ -30,7 +30,7 @@
#### Required:
-- `<val>` : The return value `<val>` indicates a biff-reported error, i.e., if the function returns `<val>` then someone needs to retrieve the biff error message. `<val>` must not contain `|`, `:`, or whitespace, and cannot be `nope` or `maybe`. `<val>` is just a string (since it is in a comment), but hopfully it is parsable as the function return type (on this same line, before the comment containing this annotation). Simple integers are easy, but it could get trickier: example returns (currently used in Teem) include NULL, EOF, AIR\*FALSE, AIR_NAN, UINT_MAX, Z_STREAM_ERROR, and nrrdField_unknown. The point is: be prepared to do some work if you're trying to parse and act on Biff annotations.
+- `<val>` : The return value `<val>` indicates a biff-reported error, i.e., if the function returns `<val>` then someone needs to retrieve the biff error message. `<val>` must not contain `|`, `:`, or whitespace, and cannot be `nope` or `maybe`. `<val>` is just a string (since it is in a comment), but hopfully it is parsable as the function return type (on this same line, before the comment containing this annotation). Simple integers are easy, but it could get trickier: example returns (currently used in Teem) include `NULL`, `EOF`, `AIR\_FALSE`, `AIR\_NAN`, `UINT_MAX`, `Z_STREAM_ERROR`, and `nrrdField_unknown`. The point is: be prepared to do some work if you're trying to parse and act on Biff annotations.
- or `<v1>|<v2>` : A return value of either `<v1>` or `<v2>` indicates an error has been recorded in `biff`
- or `<v1>|<v2>|<v3>` : Error values are `<v1>` or `<v2>` or `<v3>` (and so on)
- or `maybe:<N>:<val>` : This function uses something like `biffMaybeAddf()`, which may or may not set a biff error message, depending on the value of one of the function parameters (always called `useBiff`, as enforced by biff auto-scan). `useBiff` is the Nth function parameter, in the _1_-based numbering of the function parameters.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-10-01 00:32:24
|
Revision: 7557
http://sourceforge.net/p/teem/code/7557
Author: kindlmann
Date: 2025-10-01 00:32:20 +0000 (Wed, 01 Oct 2025)
Log Message:
-----------
syncing with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/coil.csv
teem/trunk/python/cffi/biffdata/gage.csv
teem/trunk/python/cffi/biffdata/meet.csv
teem/trunk/python/cffi/biffdata/nrrd.csv
teem/trunk/python/cffi/cdef/cdef_air.h
teem/trunk/python/cffi/cdef/cdef_coil.h
teem/trunk/python/cffi/cdef/cdef_hest.h
teem/trunk/python/cffi/cdef/cdef_ten.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/coil.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/coil.csv 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/biffdata/coil.csv 2025-10-01 00:32:20 UTC (rev 7557)
@@ -2,6 +2,6 @@
coilStart,int,1,0,coil,coil/coreCoil.c:285
coilIterate,int,1,0,coil,coil/coreCoil.c:360
coilFinish,int,1,0,coil,coil/coreCoil.c:405
-coilVolumeCheck,int,1,0,coil,coil/methodsCoil.c:23
-coilContextAllSet,int,1,0,coil,coil/methodsCoil.c:67
-coilOutputGet,int,1,0,coil,coil/methodsCoil.c:198
+coilVolumeCheck,int,1,0,coil,coil/methodsCoil.c:25
+coilContextAllSet,int,1,0,coil,coil/methodsCoil.c:69
+coilOutputGet,int,1,0,coil,coil/methodsCoil.c:200
Modified: teem/trunk/python/cffi/biffdata/gage.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/gage.csv 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/biffdata/gage.csv 2025-10-01 00:32:20 UTC (rev 7557)
@@ -24,22 +24,22 @@
gageStackPerVolumeNew,int,1,0,gage,gage/stack.c:96
gageStackPerVolumeAttach,int,1,0,gage,gage/stack.c:125
gageStackBlurParmCompare,int,1,0,gage,gage/stackBlur.c:123
-gageStackBlurParmCopy,int,1,0,gage,gage/stackBlur.c:228
-gageStackBlurParmSigmaSet,int,1,0,gage,gage/stackBlur.c:265
-gageStackBlurParmScaleSet,int,1,0,gage,gage/stackBlur.c:359
-gageStackBlurParmKernelSet,int,1,0,gage,gage/stackBlur.c:383
-gageStackBlurParmRenormalizeSet,int,1,0,gage,gage/stackBlur.c:396
-gageStackBlurParmBoundarySet,int,1,0,gage,gage/stackBlur.c:408
-gageStackBlurParmBoundarySpecSet,int,1,0,gage,gage/stackBlur.c:427
-gageStackBlurParmOneDimSet,int,1,0,gage,gage/stackBlur.c:444
-gageStackBlurParmNeedSpatialBlurSet,int,1,0,gage,gage/stackBlur.c:456
-gageStackBlurParmVerboseSet,int,1,0,gage,gage/stackBlur.c:468
-gageStackBlurParmDgGoodSigmaMaxSet,int,1,0,gage,gage/stackBlur.c:480
-gageStackBlurParmCheck,int,1,0,gage,gage/stackBlur.c:496
-gageStackBlurParmParse,int,1,0,gage,gage/stackBlur.c:543
-gageStackBlurParmSprint,int,1,0,gage,gage/stackBlur.c:802
-gageStackBlur,int,1,0,gage,gage/stackBlur.c:1384
-gageStackBlurCheck,int,1,0,gage,gage/stackBlur.c:1487
-gageStackBlurGet,int,1,0,gage,gage/stackBlur.c:1595
-gageStackBlurManage,int,1,0,gage,gage/stackBlur.c:1696
+gageStackBlurParmCopy,int,1,0,gage,gage/stackBlur.c:232
+gageStackBlurParmSigmaSet,int,1,0,gage,gage/stackBlur.c:269
+gageStackBlurParmScaleSet,int,1,0,gage,gage/stackBlur.c:363
+gageStackBlurParmKernelSet,int,1,0,gage,gage/stackBlur.c:387
+gageStackBlurParmRenormalizeSet,int,1,0,gage,gage/stackBlur.c:400
+gageStackBlurParmBoundarySet,int,1,0,gage,gage/stackBlur.c:412
+gageStackBlurParmBoundarySpecSet,int,1,0,gage,gage/stackBlur.c:431
+gageStackBlurParmOneDimSet,int,1,0,gage,gage/stackBlur.c:448
+gageStackBlurParmNeedSpatialBlurSet,int,1,0,gage,gage/stackBlur.c:460
+gageStackBlurParmVerboseSet,int,1,0,gage,gage/stackBlur.c:472
+gageStackBlurParmDgGoodSigmaMaxSet,int,1,0,gage,gage/stackBlur.c:484
+gageStackBlurParmCheck,int,1,0,gage,gage/stackBlur.c:500
+gageStackBlurParmParse,int,1,0,gage,gage/stackBlur.c:547
+gageStackBlurParmSprint,int,1,0,gage,gage/stackBlur.c:806
+gageStackBlur,int,1,0,gage,gage/stackBlur.c:1388
+gageStackBlurCheck,int,1,0,gage,gage/stackBlur.c:1491
+gageStackBlurGet,int,1,0,gage,gage/stackBlur.c:1599
+gageStackBlurManage,int,1,0,gage,gage/stackBlur.c:1700
gageUpdate,int,1,0,gage,gage/update.c:311
Modified: teem/trunk/python/cffi/biffdata/meet.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/meet.csv 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/biffdata/meet.csv 2025-10-01 00:32:20 UTC (rev 7557)
@@ -1,5 +1,5 @@
func_name,return_type,error_val(s),mubi,biff_key,cfile:linenumber
-meetAirEnumAllCheck,int,1,0,meet,meet/enumall.c:214
+meetAirEnumAllCheck,int,1,0,meet,meet/enumall.c:215
meetNrrdKernelAllCheck,int,1,0,meet,meet/meetNrrd.c:234
meetPullVolCopy,meetPullVol *,NULL,0,meet,meet/meetPull.c:42
meetPullVolParse,int,1,0,meet,meet/meetPull.c:98
Modified: teem/trunk/python/cffi/biffdata/nrrd.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/nrrd.csv 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/biffdata/nrrd.csv 2025-10-01 00:32:20 UTC (rev 7557)
@@ -62,7 +62,7 @@
nrrdKernelSprint,int,1,0,nrrd,nrrd/kernel.c:3287
nrrdKernelCompare,int,1,0,nrrd,nrrd/kernel.c:3305
nrrdKernelSpecCompare,int,1,0,nrrd,nrrd/kernel.c:3354
-nrrdKernelCheck,int,1,0,nrrd,nrrd/kernel.c:3427
+nrrdKernelCheck,int,1,0,nrrd,nrrd/kernel.c:3430
nrrdConvert,int,1,0,nrrd,nrrd/map.c:232
nrrdClampConvert,int,1,0,nrrd,nrrd/map.c:252
nrrdCastClampRound,int,1,0,nrrd,nrrd/map.c:278
Modified: teem/trunk/python/cffi/cdef/cdef_air.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_air.h 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/cdef/cdef_air.h 2025-10-01 00:32:20 UTC (rev 7557)
@@ -383,68 +383,70 @@
extern void airJSFRandNormal2_d(airJSFRand *jsf, double val[2]);
extern int airJSFRandSanity(void);
/* ---- END non-NrrdIO */
-/*
-******** airType
-**
-** Different types which air cares about.
-** Currently only used in the command-line parsing, but perhaps will
-** be used elsewhere in air later
-*/
-enum {
- airTypeUnknown, /* 0 */
- airTypeBool, /* 1 */
- airTypeInt, /* 2 */
- airTypeUInt, /* 3 */
- airTypeLongInt, /* 4 */
- airTypeULongInt, /* 5 */
- airTypeSize_t, /* 6 */
- airTypeFloat, /* 7 */
- airTypeDouble, /* 8 */
- airTypeChar, /* 9 */
- airTypeString, /* 10 */
- airTypeEnum, /* 11 */
- airTypeOther, /* 12 */
- airTypeLast
-};
-#define AIR_TYPE_MAX 12
+/* changes for for TeemV2:
+ *** airParseStrT() are no longer var-args; it was a mistaken way to enforce uniformity
+ * across parsers for different types, but it was really only airParseStrE (for
+ * parsing airEnum values) that needed it. Then airParseStrS sneakily used it for
+ * its final "greedy" argument, which was also a bad idea to overcome bad ideas in
+ * hestParse(), which have since been fixed with its 2025 re-write.
+ *** Renamed airParseStrLI, airParseStrULI --> airParseStrL, airParseStrUL
+ *** Added airParseStrH and airParseStrUH for signed and unsigned shorts
+ *** Removed airStrtokQuoting (another bad idea; used only for "unu make")
+ *** Moved the airTypeT enum values from air to hest, since hest was the motivation for
+ * creating them so they should be localized to hest. To avoid needlessly breaking code
+ * that uses hestOptAdd(), which depends on the airTypeT enum values, those have kept
+ * their names, except:
+ * *** added airTypeShort and airTypeUShort
+ * *** renamed airTypeLongInt --> airTypeLong
+ * *** renamed airTypeULongInt --> airTypeULong
+ *** Moved the following from air to hest, renamed them, and made them private.
+ * They were only used to implement hest, no where else in Teem, so they never
+ * deserved to be in air:
+ * #define AIR_TYPE_MAX --> _HEST_TYPE_MAX
+ * const char airTypeStr[HEST_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1] --> _hestTypeStr
+ * const size_t airTypeSize[HEST_TYPE_MAX + 1] --> _hestTypeSize
+ *** Removed the following, since it was only used in the pre-TeemV2 hest
+ * unsigned int (*const airParseStr[AIR_TYPE_MAX + 1])(void *,
+ * const char *, *const char *,
+ * *unsigned int);
+ */
/* parseAir.c */
extern double airAtod(const char *str);
extern int airSingleSscanf(const char *str, const char *fmt, void *ptr);
extern const airEnum *const airBool;
extern unsigned int airParseStrB(int *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
+extern unsigned int airParseStrH(short *out, const char *s, const char *ct,
+ unsigned int n);
+extern unsigned int airParseStrUH(unsigned short *out, const char *s, const char *ct,
+ unsigned int n);
extern unsigned int airParseStrI(int *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
extern unsigned int airParseStrUI(unsigned int *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
-extern unsigned int airParseStrLI(long int *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
-extern unsigned int airParseStrULI(unsigned long int *out, const char *s,
- const char *ct, unsigned int n,
- ... /* (nothing used) */);
+ unsigned int n);
+extern unsigned int airParseStrL(long int *out, const char *s, const char *ct,
+ unsigned int n);
+extern unsigned int airParseStrUL(unsigned long int *out, const char *s,
+ const char *ct, unsigned int n);
extern unsigned int airParseStrZ(size_t *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
extern unsigned int airParseStrF(float *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
extern unsigned int airParseStrD(double *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
extern unsigned int airParseStrC(char *out, const char *s, const char *ct,
- unsigned int n, ... /* (nothing used) */);
+ unsigned int n);
extern unsigned int airParseStrS(char **out, const char *s, const char *ct,
- unsigned int n,
- ... /* REQ'D even if n>1: int greedy */);
+ unsigned int n);
extern unsigned int airParseStrE(int *out, const char *s, const char *ct,
- unsigned int n, ... /* REQUIRED: airEnum *e */);
-extern unsigned int (*const airParseStr[AIR_TYPE_MAX + 1])(void *, const char *,
- const char *,
- unsigned int, ...);
+ unsigned int n, const airEnum *enm);
/* string.c */
extern char *airStrdup(const char *s);
extern size_t airStrlen(const char *s);
/* ---- BEGIN non-NrrdIO */
+extern char *airStrunc(char *s, size_t bsize, size_t drop);
extern int airStrcmp(const char *s1, const char *s2);
/* ---- END non-NrrdIO */
-extern int airStrtokQuoting;
extern char *airStrtok(char *s, const char *ct, char **last);
extern unsigned int airStrntok(const char *s, const char *ct);
extern char *airStrtrans(char *s, char from, char to);
@@ -508,8 +510,6 @@
extern airULLong airIndexClampULL(double min, double val, double max, airULLong N);
extern char *airDoneStr(double start, double here, double end, char *str);
extern double airTime(void);
-extern const char airTypeStr[AIR_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
-extern const size_t airTypeSize[AIR_TYPE_MAX + 1];
extern void airEqvAdd(airArray *eqvArr, unsigned int j, unsigned int k);
extern unsigned int airEqvMap(airArray *eqvArr, unsigned int *map, unsigned int len);
extern unsigned int airEqvSettle(unsigned int *map, unsigned int len);
@@ -575,9 +575,9 @@
extern void airMopMem(airArray *arr, void *_ptrP, int when);
extern void airMopUnMem(airArray *arr, void *_ptrP);
extern void airMopPrint(airArray *arr, const void *_str, int when);
-extern void airMopDone(airArray *arr, int error);
-extern void airMopError(airArray *arr);
-extern void airMopOkay(airArray *arr);
+extern airArray *airMopDone(airArray *arr, int error);
+extern airArray *airMopError(airArray *arr);
+extern airArray *airMopOkay(airArray *arr);
extern void airMopDebug(airArray *arr);
/* ---- BEGIN non-NrrdIO */
extern void airMopSingleDone(airArray *arr, void *ptr, int error);
Modified: teem/trunk/python/cffi/cdef/cdef_coil.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_coil.h 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/cdef/cdef_coil.h 2025-10-01 00:32:20 UTC (rev 7557)
@@ -69,8 +69,8 @@
*/
typedef struct {
char name[AIR_STRLEN_SMALL + 1];
- int type; /* from coilMethodType* enum */
- int numParm; /* number of parameters we need */
+ int type; /* from coilMethodType* enum */
+ unsigned int parmNum; /* number of parameters we need */
} coilMethod;
/*
******** coilKindType* enum
Modified: teem/trunk/python/cffi/cdef/cdef_hest.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_hest.h 2025-10-01 00:29:49 UTC (rev 7556)
+++ teem/trunk/python/cffi/cdef/cdef_hest.h 2025-10-01 00:32:20 UTC (rev 7557)
@@ -20,26 +20,123 @@
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
+// and see privateHest.h for why we internally also use biff
/*
+ * The airType values are here in hest as a transition hack for TeemV2. The parsing needs
+ * of hest are what motivated creating airTypes in the first place. The fresh perspective
+ * of TeemV2 recognizes they should have been in hest from the outset, not in air.
+ *
+ * The blissfully-type-unaware hestOptAdd() has always relied on the airTypeT enum values
+ * below. Since that function is not being removed, to avoid needless code breakage with
+ * TeemV2, these values now live in this hest header. However, hest users should instead
+ * be using one of the 99 properly typed hestOptAdd_X_T functions from adder.c (see
+ * below), which have no need for airType pseudo-types.
+ *
+ * Other things that used to be in air, but which really only mattered to implement hest
+ * functions have been moved into privateHest.h, but with air --> _hest renaming:
+ * #define AIR_TYPE_MAX
+ * const char airTypeStr[AIR_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
+ * const size_t airTypeSize[AIR_TYPE_MAX + 1];
+ * unsigned int (*const airParseStr[AIR_TYPE_MAX + 1])(void *, const char *,const char
+ * unsigned int)
+ */
+enum {
+ airTypeUnknown, /* 0 */
+ airTypeBool, /* 1 */
+ airTypeShort, /* 2 (added for TeemV2) */
+ airTypeUShort, /* 3 (added for TeemV2) */
+ airTypeInt, /* 4 */
+ airTypeUInt, /* 5 */
+ airTypeLong, /* 6 (for TeemV2 renamed from airTypeLongInt) */
+ airTypeULong, /* 7 (for TeemV2 renamed from airTypeULongInt) */
+ airTypeSize_t, /* 8 */
+ airTypeFloat, /* 9 */
+ airTypeDouble, /* 10 */
+ airTypeChar, /* 11 */
+ airTypeString, /* 12 */
+ airTypeEnum, /* 13 */
+ airTypeOther, /* 14 */
+ airTypeLast
+};
+/*
******** hestSource* enum
**
-** records whether the info to satisfy a particular option came from the default or from
-** the user (command-line or response file). Distinguishing command-line from response
-** file would take a much more significant code restructuring
+** way of identifying where the info to satisfy a particular option came from.
*/
enum {
- hestSourceUnknown, /* 0 */
- hestSourceDefault, /* 1 */
- hestSourceUser, /* 2 */
+ hestSourceUnknown, /* 0 */
+ hestSourceCommandLine, /* 1 (formerly called hestSourceUser) */
+ hestSourceResponseFile, /* 2 */
+ hestSourceDefault, /* 3 */
hestSourceLast
};
/*
+The hestArg, hestArgVec, hestInput, and hestInputStack were all created for the 2025
+TeemV2 rewrite of hestParse, to fix bugs and limits on how the code previously worked:
+- Command-line arguments containing spaces were fully never correctly handled: the
+ internal representation of one argument, as one space-delineated substring of all
+ the arguments concatenated back into a single string (a bad idea), was never correctly
+ implemented. Now the internal representation of argv is with an array data structure,
+ not a single string that has to be retokenized. The old code was wary of dynamic
+ reallocation as part of the parsing process, the new code embraces it (note the many
+ airArray).
+- When parsing response files, ""-quoted strings were not correctly handled (nor was "#"
+ appearing within a string), and response files could not invoke other response files.
+- Can now support long-wanted feature: commenting out of some span of arguments, with
+ new hest-specific "-{" "}-" delimiters. As long as these are space-separated from
+ other args, these are left intact by sh, bash, and zsh (csh and tcsh get confused).
+ They must be kept as separate args to avoid brace expansion.
+*/
+// hestArg: for building up and representing one argument string
+typedef struct {
+ char *str; // the argument string
+ unsigned int len; // NOT strlen(); this includes '\0'-termination
+ airArray *strArr; // (manages str and len)
+ int source; // from hestSource* enum
+} hestArg;
+// hestArgVec: for building up a "vector" of arguments
+typedef struct {
+ hestArg **harg; // array of pointers to hestArg structs
+ unsigned int len; // number of arguments in this vector
+ airArray *hargArr; // (manages harg and len)
+} hestArgVec;
+// hestInput: what is the thing we're processing now to build up a hestArgVec
+typedef struct {
+ int source; // from the hestSource* enum
+ // ------ if source == hestSourceCommandLine ------
+ unsigned int argc;
+ const char **argv; // we do NOT own
+ unsigned int argIdx;
+ // ------ if source == hestSourceResponseFile ------
+ char *rfname; // we DO own
+ FILE *rfile; // user opens and closes this
+ // ------ if source == hestSourceDefault ------
+ const char *dfltStr; // we do NOT own
+ unsigned int dfltLen; // strlen(dfltStr)
+ // for both hestSourceResponseFile and hestSourceDefault
+ unsigned int carIdx; // which character are we on
+ // ------ general for all inputs ------
+ unsigned int dashBraceComment; /* not a boolean: how many -{ }- comment levels
+ deep are we currently; tracked this way to
+ permit nested commenting */
+} hestInput;
+/* hestInputStack: a way of remembering what more needs to be processed to build
+ up a hestArgVec. This full stack may be overkill, but is is the right tool for
+ handling the expansion of a @opts.txt response file, especially with the possibility
+ that response files can be expanded inside of other response files */
+typedef struct {
+ hestInput *hin; // array of hestInputs
+ unsigned int len; // size of stack of hestInputs
+ airArray *hinArr; // (manages hin and len)
+ int stdinRead; // while processing this stack we have read in "-" aka stdin
+} hestInputStack;
+/*
******** hestCB struct
**
** for when the thing you want to parse from the command-line is airTypeOther: not a
** simple boolean, number, string, or airEnum. hestParse() will not allocate anything to
** store individual things, though it may allocate an array in the case of a multiple
-** variable parameter option. If your things are actually pointers to things, then you
+** variadic parameter option. If your things are actually pointers to things, then you
** do the allocation in the parse() callback. In this case, you set destroy() to be
** your "destructor", and it will be called on the result of derefencing the argument
** to parse().
@@ -52,16 +149,15 @@
multiple parameter options. A non-zero return value is considered an error. Error
message goes in the err string */
void *(*destroy)(void *ptr);
- /* if non-NULL, this is the destructor that will be called by hestParseFree() (or by
- hestParse() if there is an error midway through parsing). The argument is NOT the
- same as passed to parse(): it is the result of dereferencing the argument to parse()
- */
+ /* if non-NULL, the destructor that will be called by hestParseFree() (or by
+ hestParse() if there is an error during parsing). The argument is NOT the same as
+ passed to parse(): it is the result of dereferencing the argument to parse() */
} hestCB;
/*
******** hestOpt struct
**
-** information which specifies one command-line option,
-** and describes it how it was parsed
+** information which specifies one command-line option, records state used during
+** parsing, and provides summary output info following parsing.
*/
typedef struct {
/* --------------------- "input" fields
@@ -74,81 +170,86 @@
int max; /* max # of parameters for option,
or -1 for "there is no max; # parms is unbounded" */
void *valueP; /* storage of parsed values */
- char *dflt, /* default value written out as string */
+ char *dflt, /* default value(s) written out as string */
*info; /* description to be printed with "glossary" info */
- unsigned int *sawP; /* used ONLY for multiple variable parameter options
- (min < max >= 2): storage of # of parsed values */
+ unsigned int *sawP; /* really OUTPUT: used ONLY for multiple variadic parameter
+ options (min < max >= 2): storage of # of parsed values */
const airEnum *enm; /* used ONLY for airTypeEnum options */
const hestCB *CB; /* used ONLY for airTypeOther options */
/* --------------------- end of user-defined fields
These are set by hest functions to remember state for the sake of other hest functions.
- It is probably a drawback of the simple design of hest that this internal state ends
- up in the same struct as the input parameters above, because it blocks some
- const-correctness opportunities that would otherwise make sense. */
- int kind, /* What kind of option is this, based on min and max:
- 0: (invalid; unset)
- 1: min == max == 0 stand-alone flag; no parameters
- 2: min == max == 1 single fixed parameter
- 3: min == max >= 2 multiple fixed parameters
- 4: min == 0; max == 1; single variable parameter
- 5: min < max; max >= 2 multiple variable parameters
- This is set by hest functions as part of building up an array of hestOpt,
- and informs the later action of hestOptFree */
- alloc; /* Information (set by hestParse) about whether flag is non-NULL, and what
- parameters were used, that determines whether or not memory was allocated
- by hestParse(). Informs later action of hestParseFree():
- 0: no free()ing needed
- 1: free(*valueP), either because it is a single string, or because was a
- dynamically allocated array of non-strings
- 2: free((*valueP)[i]), because they are elements of a fixed-length
- array of strings
- 3: free((*valueP)[i]) and free(*valueP), because it is a dynamically
- allocated array of strings */
- /* Since hest's beginning, the basic container for a set of options was an array of
- hestOpt structs (not pointers to them, which rules out argv-style NULL-termination of
- the array), also unfortunately with no other top-level container (which is why
- helpWanted below is set only in the first hestOpt of the array). hestOptAdd has
- historically reallocated the entire array, incrementing the length only by one with
- each call, while maintaining a single terminating hestOpt, wherein some fields were set
- to special values to indicate termination. With the 2023 code revisit, that was deemed
- even uglier than this hack: the first hestOpt now stores here in arrAlloc the allocated
- length of the hestOpt array, and in arrLen the number of hestOpts actually used and
- set. This facilitates implementing something much like an airArray, but without the
- burden of extra calls for the user (like airArrayLenIncr), nor new kinds of containers
- for hest and its users to manage: it is just the same array of hestOpt structs */
+ It may be a drawback of the simple design of hest that this internal state ends
+ up in the same struct as the input parameters above, but it also makes sense to keep
+ all per-opt state in one place. The const-correctness we might want of hestParse is
+ thwarted by this internal state, but also by the important output fields, below. */
+ int kind; /* What kind of option is this, based on min and max:
+ 0: (invalid; unset)
+ 1: min == max == 0 stand-alone flag; no parameters
+ 2: min == max == 1 single fixed parameter
+ 3: min == max >= 2 multiple fixed parameters
+ 4: min == 0; max == 1; single variadic parameter
+ 5: min < max; max >= 2 multiple variadic parameters
+ This is set by hest functions as part of building up an array of hestOpt,
+ and informs the later action of hestOptFree */
+ airArray *parseMop; /* If non-NULL: remembers what was allocated at or behind *valueP
+ as a result of running hestParse(). Free'ing or destroy'ing
+ callbacks are added here (by _hestParseSingle[type]) with
+ when=airMopAlways. With the 2025 rewrite, this replaces the
+ previous `int alloc` field with special values 0,1,2,3, which
+ had fussy semantics that complicated hestParseFree()'s work.
+ Now hestParseFree just calls airMopDone on all these per-option
+ parseMops (when non-NULL) */
+ hestArgVec *havec; // the (non-flag) parm args attributed to this option
+ /* Since hest's beginning in 2002, the basic container for a set of options was an
+ array of hestOpt structs (not pointers to them, which rules out argv-style
+ NULL-termination of the array), also unfortunately with no other top-level container
+ or hestContext (which is why helpWanted below is set only in the first hestOpt of the
+ array). hestOptAdd has historically reallocated the entire array, incrementing the
+ length only by one with each call, while maintaining a single terminating hestOpt,
+ wherein some fields were set to special values to indicate termination. With the 2023
+ code revisit, that was deemed even uglier than the new and current hack: the first
+ hestOpt now stores here in arrAlloc the allocated length of the hestOpt array, and in
+ arrLen the number of hestOpts actually used and set. This facilitates implementing
+ something much like an airArray, but without the burden of extra calls for the user
+ (like airArrayLenIncr), nor new kinds of containers for hest and its users to manage:
+ it is just the same array of hestOpt structs */
unsigned int arrAlloc, arrLen;
/* --------------------- Output
Things set/allocated by hestParse. */
- int source; /* from the hestSource* enum; from whence was this information learned,
- else hestSourceUnknown if not */
- char *parmStr; /* if non-NULL: a string (freed by hestParseFree) from which hestParse
- ultimately parsed whatever values were set in *valueP. All the
- parameters associated with this option are joined (with " " separation)
- into this single string. hestParse has always formed this string
- internally as part of its operation, but only belatedly (in 2023) is a
- copy of that string being made available here to the caller. Note that
- in the case of single variable parameter options used without a
- parameter, the value stored will be "inverted" from the string here. */
- int helpWanted; /* hestParse() saw something (like "--help") in one of the given
- arguments that looks like a call for help (and respectDashDashHelp is
- set in the hestParm), so it recorded that here. There is unfortunately
- no other top-level output container for info generated by hestParse(),
- so this field is going to be set only in the *first* hestOpt passed to
- hestParse(), even though that hestOpt has no particular relation to
- where hestParse() saw the call for help. */
+ /* from the hestSource* enum; from whence was this information learned. Can use
+ hestSourceUser(opt->source) to test for the sources associated with the user:
+ hestSourceCommandLine or hestSourceResponseFile */
+ int source;
+ /* if parseStr is non-NULL: a string (freed by hestParseFree) that is a lot like the
+ string (storing zero or many parameters), from which hestParse ultimately parsed
+ whatever values were set in *valueP above. Internally, hest maintains an argc,argv-like
+ representation of the info to parse, but here it is joined back together into a
+ space-delimited single string. Note that in the case of single variadic parameter
+ options used without a parameter, the value stored will be "inverted" (in the boolean
+ sense of V --> !V) from the value parsed from the string saved here. */
+ char *parmStr;
+ /* helpWanted indicates that hestParse() saw something (like "--help") in one of the
+ given arguments that looks like a call for help, and that respectDashDashHelp is set in
+ the hestParm. There is unfortunately no other top-level output container for info
+ generated by hestParse(), so this field is going to be set only in the *first* hestOpt
+ passed to hestParse(), even though that hestOpt has no particular relation to where
+ hestParse() saw the call for help. */
+ int helpWanted;
} hestOpt;
/*
******** hestParm struct
**
-** parameters to control behavior of hest functions.
+** parameters to control behavior of hest functions. Not to be confused with the
+** "parameters" to a hestOpt from which it parses values. Code should use "hparm" for
+** the pointer to this struct.
**
** GK: Don't even think about storing per-parse state in here.
*/
typedef struct {
int verbosity, /* verbose diagnostic messages to stdout */
- respFileEnable, /* whether or not to use response files */
+ responseFileEnable, /* whether or not to use response files */
elideSingleEnumType, /* if type is airTypeEnum, and if it's a single fixed parameter
- option, then don't bother printing the type information as
+ option, then don't bother printing the type information as
part of hestGlossary() */
elideSingleOtherType, /* like above, but for airTypeOther */
elideSingleOtherDefault, /* don't display default for single fixed airTypeOther
@@ -160,17 +261,21 @@
elideSingleEmptyStringDefault, /* if default for a single string is empty
(""), then don't display default */
elideMultipleEmptyStringDefault,
- respectDashDashHelp, /* hestParse interprets seeing "--help" as not an
- error, but as a request to print usage info,
- so sets helpWanted in the (first) hestOpt */
- noArgsIsNoProblem, /* if non-zero, having no arguments to parse is not in and
- of itself a problem; this means that if all options have
- defaults, it would be *ok* to invoke the problem without
- any further command-line options. This is counter to
- pre-Teem-1.11 behavior (for which no arguments *always*
- meant "show me usage info"). */
- greedySingleString, /* when parsing a single string, whether or not to be greedy
- (as per airParseStrS) */
+ respectDashDashHelp, /* (new with TeemV2) hestParse interprets seeing "--help" as not
+ an error, but as a request to print usage info, so sets
+ helpWanted in the (first) hestOpt */
+ respectDashBraceComments, /* (new with TeemV2) Sometimes in a huge command-line
+ invocation you want to comment part of it out. With this
+ set, hestParse recognizes hest-specific "-{" and "}-"
+ args as comment delimiters: these args and all args they
+ enclose are ignored. These must be stand-alone args, and
+ cannot be touching anything else, lest brace expansion
+ kick in. */
+ noArgsIsNoProblem, /* if non-zero, having no arguments to parse is not in and of
+ itself a problem; this means that if all options have defaults, it
+ would be *ok* to invoke the problem without any further
+ command-line options. This is counter to pre-Teem-1.11 behavior
+ (for which no arguments *always* meant "show me usage info"). */
cleverPluralizeOtherY, /* when printing the type for airTypeOther, when the min
number of items is > 1, and the type string ends with "y",
then pluralize with "ies" instead of "ys" */
@@ -178,22 +283,10 @@
might: only print info and glossary when they "ask for it" */
noBlankLineBeforeUsage; /* like it says */
unsigned int columns; /* number of printable columns in output */
- char respFileFlag, /* the character at the beginning of an argument
- indicating that this is a response file name */
- respFileComment, /* comment character for the response files */
- varParamStopFlag, /* prefixed by '-' to form the flag (usually "--") that signals the
- end of a *flagged* variable parameter option (single or
- multiple). This is important to use if there is a flagged
- variable parameter option preceeding an unflagged variable
- parameter option, because otherwise how will you know where the
- first stops and the second begins */
- multiFlagSep; /* character in flag which signifies that there is a long and short
- version, and which separates the two. Or, can be set to '\0' to
- disable this behavior entirely. */
} hestParm;
-/* defaultsHest.c */
+// defaultsHest.c
extern int hestDefaultVerbosity;
-extern int hestDefaultRespFileEnable;
+extern int hestDefaultResponseFileEnable;
extern int hestDefaultElideSingleEnumType;
extern int hestDefaultElideSingleOtherType;
extern int hestDefaultElideSingleOtherDefault;
@@ -202,20 +295,36 @@
extern int hestDefaultElideSingleEmptyStringDefault;
extern int hestDefaultElideMultipleEmptyStringDefault;
extern int hestDefaultNoArgsIsNoProblem;
-extern int hestDefaultGreedySingleString;
extern int hestDefaultCleverPluralizeOtherY;
extern unsigned int hestDefaultColumns;
-extern char hestDefaultRespFileFlag;
-extern char hestDefaultRespFileComment;
-extern char hestDefaultVarParamStopFlag;
-extern char hestDefaultMultiFlagSep;
-/* methodsHest.c */
+// argvHest.c
+extern hestArg *hestArgNew(void);
+extern hestArg *hestArgNix(hestArg *harg);
+extern void hestArgReset(hestArg *harg);
+extern void hestArgAddChar(hestArg *harg, char cc);
+extern void hestArgSetString(hestArg *harg, const char *str);
+extern void hestArgAddString(hestArg *harg, const char *str);
+extern hestArgVec *hestArgVecNew(void);
+extern void hestArgVecReset(hestArgVec *havec);
+extern hestArgVec *hestArgVecNix(hestArgVec *havec);
+extern hestArg *hestArgVecRemove(hestArgVec *havec, unsigned int popIdx);
+extern char *hestArgVecSprint(const hestArgVec *havec, int showIndices);
+extern void hestArgVecAppendString(hestArgVec *havec, const char *str);
+extern void hestArgVecAppendArg(hestArgVec *havec, hestArg *harg);
+extern void hestArgVecPrint(const char *caller, const char *info,
+ const hestArgVec *havec);
+extern hestInput *hestInputNew(void);
+extern hestInput *hestInputNix(hestInput *hin);
+extern hestInputStack *hestInputStackNew(void);
+extern hestInputStack *hestInputStackNix(hestInputStack *hist);
+// methodsHest.c
extern const int hestPresent;
+extern const airEnum *const hestSource;
+extern int hestSourceUser(int src);
extern hestParm *hestParmNew(void);
-extern hestParm *hestParmFree(hestParm *parm);
-extern void *hestParmFree_vp(void *parm);
+extern hestParm *hestParmFree(hestParm *hparm);
extern int hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns);
-extern void hestOptSingleSet(hestOpt *opt, const char *flag, const char *name,
+extern void hestOptSingleSet(hestOpt *hopt, const char *flag, const char *name,
int type, unsigned int min, int max, void *valueP,
const char *dflt, const char *info, unsigned int *sawP,
const airEnum *enm, const hestCB *CB);
@@ -224,6 +333,7 @@
int max, void *valueP, const char *dflt,
const char *info, unsigned int *sawP,
const airEnum *enm, const hestCB *CB);
+// Instead of hestOptAdd, use one of the 99 type-checked functions (from adders.c), below
extern unsigned int hestOptAdd(hestOpt **optP,
const char *flag, const char *name,
int type, unsigned int min, int max,
@@ -232,48 +342,64 @@
... /* unsigned int *sawP,
const airEnum *enm,
const hestCB *CB */);
-/* see also all the special-purpose and type-checked versions in adders.c, below */
-extern unsigned int hestOptNum(const hestOpt *opt);
-extern hestOpt *hestOptFree(hestOpt *opt);
-extern void *hestOptFree_vp(void *opt);
-extern int hestOptCheck(hestOpt *opt, char **errP);
-/* parseHest.c */
-extern int hestParse(hestOpt *opt, int argc, const char **argv, char **errP,
- const hestParm *parm);
-extern void *hestParseFree(hestOpt *opt);
-extern void hestParseOrDie(hestOpt *opt, int argc, const char **argv,
- hestParm *parm, const char *me, const char *info,
+extern unsigned int hestOptNum(const hestOpt *hopt);
+extern hestOpt *hestOptFree(hestOpt *hopt);
+extern int hestOptCheck(const hestOpt *hopt, char **errP);
+extern int hestOptParmCheck(const hestOpt *hopt, const hestParm *hparm,
+ char **errP);
+// parseHest.c
+extern int hestParse(hestOpt *hopt, int argc, const char **argv, char **errP,
+ const hestParm *hparm);
+extern hestOpt *hestParseFree(hestOpt *hopt);
+extern void hestParseOrDie(hestOpt *hopt, int argc, const char **argv,
+ hestParm *hparm, const char *me, const char *info,
int doInfo, int doUsage, int doGlossary);
-/* usage.c */
+// parsest.c
+extern int hestParse2(hestOpt *hopt, int argc, const char **argv, char **errP,
+ const hestParm *hparm);
+// usage.c
extern void _hestPrintStr(FILE *f, unsigned int indent, unsigned int already,
unsigned int width, const char *_str, int bslash);
-extern int hestMinNumArgs(hestOpt *opt);
-extern void hestUsage(FILE *file, hestOpt *opt, const char *argv0,
- const hestParm *parm);
-extern void hestGlossary(FILE *file, hestOpt *opt, const hestParm *parm);
+extern void hestUsage(FILE *file, const hestOpt *hopt, const char *argv0,
+ const hestParm *hparm);
+extern void hestGlossary(FILE *file, const hestOpt *hopt, const hestParm *hparm);
extern void hestInfo(FILE *file, const char *argv0, const char *info,
- const hestParm *parm);
-/* adders.c */
+ const hestParm *hparm);
+// adders.c
extern void hestOptAddDeclsPrint(FILE *f);
-/* Many many non-var-args alternatives to hestOptAdd, also usefully type-specific for the
-type of value to be parsed in a way that hestOptAdd_nva cannot match. These capture all
-the common uses (and then some) of hest within Teem. They can be categorized, like
-hestOpt->kind, in terms of the min, max number of (type T) parameters to the option:
- min == max == 0 hestOptAdd_Flag (stand-alone flag; no parameters)
- min == max == 1 hestOptAdd_1_T single fixed parameter
- min == max >= 2 hestOptAdd_{2,3,4,N}_T multiple fixed parameters
- min == 0; max == 1 hestOptAdd_1v_T single variable parameter
- min < max; max >= 2 hestOptAdd_Nv_T multiple variable parameters
-An airEnum* is passed for _Enum options; or a hestCB* for _Other options. The number of
-parameters *sawP that hestParm saw on the command-line is passed for the _Nv_ options.
-All declarations below were automatically generated via hestOptAddDeclsPrint (followed by
-clang-format), which (like the implementation of all the functions) is done via lots of
-#define macro tricks. */
+/* The 99 (!) non-var-args alternatives to hestOptAdd, enable more type checking because
+they non-var-args, but are also usefully type-specific for each possible type of value to
+be parsed in a way that hestOptAdd_nva cannot match. In fact, *all* possible ways of
+using hest are covered here, due to the enumeration over "kind" and over type T, which
+determines the function name as follows:
+kind min, max function family description
+ 1 min == max == 0 hestOptAdd_Flag (stand-alone flag; no parameters)
+ 2 min == max == 1 hestOptAdd_1_T single fixed parameter
+ 3 min == max >= 2 hestOptAdd_{2,3,4,N}_T multiple fixed parameters
+ 4 min == 0; max == 1 hestOptAdd_1v_T single variadic parameter
+ 5 min < max; max >= 2 hestOptAdd_Nv_T multiple variadic parameters
+The type T can be (one for each airType enum value): Bool, Short, UShort, Int, UInt,
+Long, ULong, Size_t, Float, Double, Char, String, Enum, or Other. An `airEnum *enm` is
+passed with the T=Enum functions. A `hestCB *CB` is passed for the T=Other functions. The
+number of parms `int *sawP` that hestParm saw on the command-line is passed for the _Nv_
+options.
+For each of the 14 different `_T` types, there are 7 different families for `_1`
+(kind=2), `_2`,`_3`,`_4`,`_N` (kind=3),`_1v` (kind=4), and `_Nv` (kind=5).
+14 * 7 = 98, plus hestOptAdd_Flag makes 99 functions.
+All declarations below were automatically generated via hest/test/decls (which calls
+hestOptAddDeclsPrint), followed by clang-format. */
extern unsigned int hestOptAdd_Flag(hestOpt **optP, const char *flag, int *valueP,
const char *info);
extern unsigned int hestOptAdd_1v_Bool(hestOpt **hoptP, const char *flag,
const char *name, int *valueP,
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1v_Short(hestOpt **hoptP, const char *flag,
+ const char *name, short int *valueP,
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1v_UShort(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned short int *valueP,
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_1v_Int(hestOpt **hoptP, const char *flag,
const char *name, int *valueP,
const char *dflt, const char *info);
@@ -280,13 +406,12 @@
extern unsigned int hestOptAdd_1v_UInt(hestOpt **hoptP, const char *flag,
const char *name, unsigned int *valueP,
const char *dflt, const char *info);
-extern unsigned int hestOptAdd_1v_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, long int *valueP,
- const char *dflt, const char *info);
-extern unsigned int hestOptAdd_1v_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name,
- unsigned long int *valueP,
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1v_Long(hestOpt **hoptP, const char *flag,
+ const char *name, long int *valueP,
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1v_ULong(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned long int *valueP,
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_1v_Size_t(hestOpt **hoptP, const char *flag,
const char *name, size_t *valueP,
const char *dflt, const char *info);
@@ -313,6 +438,13 @@
extern unsigned int hestOptAdd_1_Bool(hestOpt **hoptP, const char *flag,
const char *name, int *valueP,
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1_Short(hestOpt **hoptP, const char *flag,
+ const char *name, short int *valueP,
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1_UShort(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned short int *valueP,
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_1_Int(hestOpt **hoptP, const char *flag,
const char *name, int *valueP,
const char *dflt, const char *info);
@@ -319,13 +451,12 @@
extern unsigned int hestOptAdd_1_UInt(hestOpt **hoptP, const char *flag,
const char *name, unsigned int *valueP,
const char *dflt, const char *info);
-extern unsigned int hestOptAdd_1_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, long int *valueP,
- const char *dflt, const char *info);
-extern unsigned int hestOptAdd_1_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name,
- unsigned long int *valueP,
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1_Long(hestOpt **hoptP, const char *flag,
+ const char *name, long int *valueP,
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_1_ULong(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned long int *valueP,
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_1_Size_t(hestOpt **hoptP, const char *flag,
const char *name, size_t *valueP,
const char *dflt, const char *info);
@@ -352,6 +483,13 @@
extern unsigned int hestOptAdd_2_Bool(hestOpt **hoptP, const char *flag,
const char *name, int valueP[2],
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_2_Short(hestOpt **hoptP, const char *flag,
+ const char *name, short int valueP[2],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_2_UShort(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned short int valueP[2],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_2_Int(hestOpt **hoptP, const char *flag,
const char *name, int valueP[2],
const char *dflt, const char *info);
@@ -358,13 +496,13 @@
extern unsigned int hestOptAdd_2_UInt(hestOpt **hoptP, const char *flag,
const char *name, unsigned int valueP[2],
const char *dflt, const char *info);
-extern unsigned int hestOptAdd_2_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, long int valueP[2],
- const char *dflt, const char *info);
-extern unsigned int hestOptAdd_2_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name,
- unsigned long int valueP[2],
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_2_Long(hestOpt **hoptP, const char *flag,
+ const char *name, long int valueP[2],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_2_ULong(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned long int valueP[2],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_2_Size_t(hestOpt **hoptP, const char *flag,
const char *name, size_t valueP[2],
const char *dflt, const char *info);
@@ -391,6 +529,13 @@
extern unsigned int hestOptAdd_3_Bool(hestOpt **hoptP, const char *flag,
const char *name, int valueP[3],
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_3_Short(hestOpt **hoptP, const char *flag,
+ const char *name, short int valueP[3],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_3_UShort(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned short int valueP[3],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_3_Int(hestOpt **hoptP, const char *flag,
const char *name, int valueP[3],
const char *dflt, const char *info);
@@ -397,13 +542,13 @@
extern unsigned int hestOptAdd_3_UInt(hestOpt **hoptP, const char *flag,
const char *name, unsigned int valueP[3],
const char *dflt, const char *info);
-extern unsigned int hestOptAdd_3_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, long int valueP[3],
- const char *dflt, const char *info);
-extern unsigned int hestOptAdd_3_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name,
- unsigned long int valueP[3],
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_3_Long(hestOpt **hoptP, const char *flag,
+ const char *name, long int valueP[3],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_3_ULong(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned long int valueP[3],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_3_Size_t(hestOpt **hoptP, const char *flag,
const char *name, size_t valueP[3],
const char *dflt, const char *info);
@@ -430,6 +575,13 @@
extern unsigned int hestOptAdd_4_Bool(hestOpt **hoptP, const char *flag,
const char *name, int valueP[4],
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_4_Short(hestOpt **hoptP, const char *flag,
+ const char *name, short int valueP[4],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_4_UShort(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned short int valueP[4],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_4_Int(hestOpt **hoptP, const char *flag,
const char *name, int valueP[4],
const char *dflt, const char *info);
@@ -436,13 +588,13 @@
extern unsigned int hestOptAdd_4_UInt(hestOpt **hoptP, const char *flag,
const char *name, unsigned int valueP[4],
const char *dflt, const char *info);
-extern unsigned int hestOptAdd_4_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, long int valueP[4],
- const char *dflt, const char *info);
-extern unsigned int hestOptAdd_4_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name,
- unsigned long int valueP[4],
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_4_Long(hestOpt **hoptP, const char *flag,
+ const char *name, long int valueP[4],
+ const char *dflt, const char *info);
+extern unsigned int hestOptAdd_4_ULong(hestOpt **hoptP, const char *flag,
+ const char *name,
+ unsigned long int valueP[4],
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_4_Size_t(hestOpt **hoptP, const char *flag,
const char *name, size_t valueP[4],
const char *dflt, const char *info);
@@ -469,6 +621,14 @@
extern unsigned int hestOptAdd_N_Bool(hestOpt **hoptP, const char *flag,
const char *name, unsigned int N, int *valueP,
const char *dflt, const char *info);
+extern unsigned int hestOptAdd_N_Short(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned int N,
+ short int *valueP, const char *dflt,
+ const char *info);
+extern unsigned int hestOptAdd_N_UShort(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned int N,
+ unsigned short int *valueP,
+ const char *dflt, const char *info);
extern unsigned int hestOptAdd_N_Int(hestOpt **hoptP, const char *flag,
const char *name, unsigned int N, int *valueP,
const char *dflt, const char *info);
@@ -476,14 +636,14 @@
const char *name, unsigned int N,
unsigned int *valueP, const char *dflt,
const char *info);
-extern unsigned int hestOptAdd_N_LongInt(hestOpt **hoptP, const char *flag,
- const char *name, unsigned int N,
- long int *valueP, const char *dflt,
- const char *info);
-extern unsigned int hestOptAdd_N_ULongInt(hestOpt **hoptP, const char *flag,
- const char *name, unsigned int N,
- unsigned long int *valueP,
- const char *dflt, const char *info);
+extern unsigned int hestOptAdd_N_Long(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned int N,
+ long int *valueP, const char *dflt,
+ const char *info);
+extern unsigned int hestOptAdd_N_ULong(hestOpt **hoptP, const char *flag,
+ const char *name, unsigned int N,
+ unsigned long int *valueP, const char *dflt,
+ const char *info);
extern unsigned int hestOptAdd_N_Size_t(hestOpt **hoptP, const char *flag,
const char *name, unsigned int N,
size_t *valueP, const char *dflt,
@@ -516,6 +676,15 @@
const char *name, unsigned int min, int max,
int **valueP, const char *dflt,
const char *info, ...
[truncated message content] |
|
From: <kin...@us...> - 2025-10-01 00:29:52
|
Revision: 7556
http://sourceforge.net/p/teem/code/7556
Author: kindlmann
Date: 2025-10-01 00:29:49 +0000 (Wed, 01 Oct 2025)
Log Message:
-----------
now working to show usage info
Modified Paths:
--------------
teem/trunk/tests/ctest/ten/tendlist.c
Modified: teem/trunk/tests/ctest/ten/tendlist.c
===================================================================
--- teem/trunk/tests/ctest/ten/tendlist.c 2025-09-30 23:32:00 UTC (rev 7555)
+++ teem/trunk/tests/ctest/ten/tendlist.c 2025-10-01 00:29:49 UTC (rev 7556)
@@ -47,9 +47,11 @@
fprintf(out, "%s: ################### END tend (ret=%d)\n", me, ret);
tci = 0;
+ hparm->respectDashDashHelp = AIR_TRUE;
+ const char *hargv[2] = {"--help", NULL};
do {
fprintf(out, "%s: ################### BEGIN tend %s\n", me, tendCmdList[tci]->name);
- ret = tendCmdList[tci]->main(0, NULL, tendCmdList[tci]->name, hparm);
+ ret = tendCmdList[tci]->main(1, hargv, tendCmdList[tci]->name, hparm);
fprintf(out, "%s: ################### END tend %s (ret=%d)\n", me,
tendCmdList[tci]->name, ret);
tci++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 23:32:01
|
Revision: 7555
http://sourceforge.net/p/teem/code/7555
Author: kindlmann
Date: 2025-09-30 23:32:00 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
filled in info about how to learn about the Teem build
Modified Paths:
--------------
teem/trunk/src/unrrdu/built.c
Modified: teem/trunk/src/unrrdu/built.c
===================================================================
--- teem/trunk/src/unrrdu/built.c 2025-09-30 23:23:25 UTC (rev 7554)
+++ teem/trunk/src/unrrdu/built.c 2025-09-30 23:32:00 UTC (rev 7555)
@@ -23,9 +23,11 @@
#define INFO "Configuration and platform parameters of this \"unu\""
static const char *_unrrdu_builtInfoL
= (INFO ". Not every configuration/compilation choice made when building Teem "
- " matters for nrrd and the other libraries that \"unu\" depends on; "
- "see output of \"XXXX HEY WUT? XXXX\" for a view of those. "
- "This documents things visible to \"unu\".");
+ "matters for nrrd and the other libraries that \"unu\" depends on. "
+ "The CMake-generated teem-install/lib/pkgconfig/teem.pc and "
+ "teem-install/bin/teem-config offer a more complete account of "
+ "what this (whole) Teem build depends on. "
+ "This command only documents things visible to \"unu\".");
static int
unrrdu_builtMain(int argc, const char **argv, const char *me, hestParm *hparm) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 23:23:27
|
Revision: 7554
http://sourceforge.net/p/teem/code/7554
Author: kindlmann
Date: 2025-09-30 23:23:25 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
updating this test so it successfully shows the usage info for all the unu commands
Modified Paths:
--------------
teem/trunk/tests/ctest/unrrdu/unulist.c
Modified: teem/trunk/tests/ctest/unrrdu/unulist.c
===================================================================
--- teem/trunk/tests/ctest/unrrdu/unulist.c 2025-09-30 21:11:13 UTC (rev 7553)
+++ teem/trunk/tests/ctest/unrrdu/unulist.c 2025-09-30 23:23:25 UTC (rev 7554)
@@ -52,10 +52,12 @@
fprintf(out, "%s: ################### END unu\n", me);
uci = 0;
+ hparm->respectDashDashHelp = AIR_TRUE;
+ const char *hargv[2] = {"--help", NULL};
do {
fprintf(out, "%s: ################### BEGIN (%u) unu %s\n", me, uci,
unrrduCmdList[uci]->name);
- ret = unrrduCmdList[uci]->main(0, NULL, unrrduCmdList[uci]->name, hparm);
+ ret = unrrduCmdList[uci]->main(1, hargv, unrrduCmdList[uci]->name, hparm);
fprintf(out, "%s: ################### END (%u) unu %s (ret=%d)\n", me, uci,
unrrduCmdList[uci]->name, ret);
uci++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 21:11:16
|
Revision: 7553
http://sourceforge.net/p/teem/code/7553
Author: kindlmann
Date: 2025-09-30 21:11:13 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
some long-standing hest annoyances have been addressed with the rewrite
Modified Paths:
--------------
teem/trunk/src/TODO.txt
teem/trunk/src/hest/TODO.txt
Modified: teem/trunk/src/TODO.txt
===================================================================
--- teem/trunk/src/TODO.txt 2025-09-30 20:57:42 UTC (rev 7552)
+++ teem/trunk/src/TODO.txt 2025-09-30 21:11:13 UTC (rev 7553)
@@ -1,11 +1,3 @@
-******* Figure out what is going on with parsing spaces in hest:
-this doesn't work:
- unu basinfo -i tmp.nrrd -kv space:=RGB "novalue:=0.3 0 0" -o tmp2.nrrd
-and instead it sees:
- !unu basinfo: kvpstring[0/2] = |space:=RGB|
- !unu basinfo: kvpstring[1/2] = |"novalue:=0.3|
-where the hell is the " coming from?
-
(Actually maybe ctypes is not important, now that the CFFI stuff is solid with exult.py)
revisit ctypes with new ctypeslib2:
https://github.com/trolldbois/ctypeslib
@@ -82,22 +74,6 @@
to a great many functions (or else it itself would be a global),
and then how do you know which functions should take it?
-hest:
-* consider renaming hestParmFree --> hestParmNix
-* air/hest: remove the airType* enum. The following sort of code looks
-correct but is completely wrong
- if (nrrdAlloc(nout, airTypeFloat, 3, size[0], size[1], size[2])) { ...
-because "airTypeFloat" is there instead of "nrrdTypeFloat". All
-things airType were created for the sake of hest. Instead of taking an
-airType enum value for hestOptAdd, hestOptAdd can take a string
-(e.g. "uchar", "float", "enum", "callback" for airTypeOther).
-* There's no such thing as a truly optional parameter: data is needed
-for all options, whether it comes from the default string or the
-command line, and its an error if no data is found. Not having
-optional parameters is why things like "unu make" learn centerings via
-strings: the string can be given or not, and if its given, then the
-information is used.
-
biff:
* biffMove(destKey, err, srcKey) --> biffMove(destKey, srcKey, err)
so that it matches biffMovef
Modified: teem/trunk/src/hest/TODO.txt
===================================================================
--- teem/trunk/src/hest/TODO.txt 2025-09-30 20:57:42 UTC (rev 7552)
+++ teem/trunk/src/hest/TODO.txt 2025-09-30 21:11:13 UTC (rev 7553)
@@ -5,6 +5,3 @@
currently the "input nrrd" option to unu comes last as a way of allowing
hest to do error checking on all other (more error prone) options. But
it would be nice to indicate a parsing order seperate from the option order.
-
-
-??? What is relationship between parseHest.c/whichCase() and hestOpt.alloc ???
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 20:57:45
|
Revision: 7552
http://sourceforge.net/p/teem/code/7552
Author: kindlmann
Date: 2025-09-30 20:57:42 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
hestParse(2) now returns -1 if the hestOpt array is busted, and now returns any non-zero return from optSetValues, such as the 2 generated by hestCB *nrrdHestNrrd->parse() if nrrdLoad() failed with an error message mentioning EOF
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-30 19:52:14 UTC (rev 7551)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-30 20:57:42 UTC (rev 7552)
@@ -162,6 +162,9 @@
parseSingleO(void *out, const char *str, _hestPPair *hpp) {
if (!(out && str && hpp)) return 1;
char myerr[AIR_STRLEN_HUGE + 1];
+ /* important to return this value; it has been part of hestParse() behavior
+ for a long time. e.g. hestCB *nrrdHestNrrd->parse() returns 2 if nrrdLoad()
+ fails with an error message mentioning "EOF", but returns 1 otherwise */
int ret = hpp->hopt->CB->parse(out, str, myerr);
if (ret) {
if (strlen(myerr)) {
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 19:52:14 UTC (rev 7551)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 20:57:42 UTC (rev 7552)
@@ -1258,6 +1258,7 @@
void *valueP;
uint optNum = hopt->arrLen;
for (uint opi = 0; opi < optNum; opi++) {
+ int pret;
identStr(ident, hopt + opi);
// hopt[opi].source has already been set
/* 2023 GLK notes that r6388 2020-05-14 GLK was asking:
@@ -1339,10 +1340,10 @@
hopt[opi].havec->len);
return 1;
}
- if (_hestParseSingle[type](valueP, strsrc, hpp)) {
+ if ((pret = _hestParseSingle[type](valueP, strsrc, hpp))) {
biffAddf(HEST, "%s%sfor (kind 4) %s[%u] could not parse |%s| as single %s", _ME_,
ident, opi, strsrc, _hestTypeStr[type]);
- return 1;
+ return pret;
}
if (invert) {
_hestInvertScalar[type](valueP);
@@ -1352,10 +1353,10 @@
} // end case 4 {
break;
case 2: // -------- one required parameter --------
- if (_hestParseSingle[type](valueP, hopt[opi].havec->harg[0]->str, hpp)) {
+ if ((pret = _hestParseSingle[type](valueP, hopt[opi].havec->harg[0]->str, hpp))) {
biffAddf(HEST, "%s%sproblem parsing for (kind 2) %s[%u] (from %s): %s", _ME_,
ident, opi, airEnumStr(hestSource, hopt[opi].source), hpp->err);
- return 1;
+ return pret;
}
break;
case 3: { // -------- multiple required parameters --------
@@ -1362,11 +1363,11 @@
// user already allocated array at valueP
char *cvalueP = (char *)valueP;
for (uint argi = 0; argi < hopt[opi].havec->len; argi++) {
- if (_hestParseSingle[type](cvalueP + size * argi,
- hopt[opi].havec->harg[argi]->str, hpp)) {
+ if ((pret = _hestParseSingle[type](cvalueP + size * argi,
+ hopt[opi].havec->harg[argi]->str, hpp))) {
biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for (kind 3) %s[%u]: %s",
_ME_, argi, hopt[opi].havec->len, ident, opi, hpp->err);
- return 1;
+ return pret;
}
}
} break;
@@ -1416,11 +1417,11 @@
char *cvalueP = *((void **)valueP);
// (RIP hammerhead.ucsd.edu, Intel Itanium, and last days of grad school)
for (uint argi = 0; argi < hopt[opi].havec->len; argi++) {
- if (_hestParseSingle[type](cvalueP + size * argi,
- hopt[opi].havec->harg[argi]->str, hpp)) {
+ if ((pret = _hestParseSingle[type](cvalueP + size * argi,
+ hopt[opi].havec->harg[argi]->str, hpp))) {
biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for (kind 5) %s[%u]: %s",
_ME_, argi, hopt[opi].havec->len, ident, opi, hpp->err);
- return 1;
+ return pret;
}
}
if (airTypeString == type) {
@@ -1445,8 +1446,9 @@
The basic phases of parsing are:
1) Error checking on given `hopt` array. If this fails (i.e. because the previous
-calls to hestOptAdd were malformed), the return is 2, not the 1 returned from errors in
-any of the subsequent steps.
+calls to hestOptAdd were malformed), the return is -1, not the 1 returned from errors in
+most of the subsequent steps (the exception is optSetValues; its non-zero return value is
+returned from here).
2) Generate internal representation of command-line that includes expanding any
response files; this all goes into the `hestArgVec *havec`.
@@ -1466,7 +1468,7 @@
hestParse2(hestOpt *hopt, int argc, const char **argv, char **errP,
const hestParm *_hparm) {
airArray *mop = airMopNew(); // initialize the mop
-
+ int pret;
// make exactly one of (given) _hparm and (our) hparm non-NULL
hestParm *hparm = NULL;
if (!_hparm) {
@@ -1509,7 +1511,7 @@
if (_hestOPCheck(hopt, HPARM)) {
DO_ERR("problem with given hestOpt array");
airMopError(mop);
- return 2;
+ return -1;
}
if (HPARM->verbosity > 1) {
printf("%s: _hestOPCheck passed\n", __func__);
@@ -1565,10 +1567,10 @@
}
// --6--6--6--6--6-- Finally, parse the args and set values
- if (optSetValues(hopt, HPARM)) {
- DO_ERR("problem with setting values");
+ if ((pret = optSetValues(hopt, HPARM))) {
+ DO_ERR("problem with parsing and setting values");
airMopError(mop);
- return 1;
+ return pret;
}
#undef DO_ERR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 19:52:16
|
Revision: 7551
http://sourceforge.net/p/teem/code/7551
Author: kindlmann
Date: 2025-09-30 19:52:14 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
fixing numbering of steps in comment above hestParse(2)
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 19:47:02 UTC (rev 7550)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 19:52:14 UTC (rev 7551)
@@ -1444,20 +1444,20 @@
The basic phases of parsing are:
-0) Error checking on given `hopt` array. If this fails (i.e. because the previous
+1) Error checking on given `hopt` array. If this fails (i.e. because the previous
calls to hestOptAdd were malformed), the return is 2, not the 1 returned from errors in
any of the subsequent steps.
-1) Generate internal representation of command-line that includes expanding any
+2) Generate internal representation of command-line that includes expanding any
response files; this all goes into the `hestArgVec *havec`.
-2) From `havec`, extract the args that are attributable to flagged and unflagged
-options, moving each `hestArg` out of main `havec` and into the per-hestOpt
-opt->havec
+3) From `havec`, extract the args that are attributable to flagged ...
+4) ... and unflagged options, moving each `hestArg` out of main `havec` and into
+the per-hestOpt opt->havec
-3) For options not user-supplied, process the opt's `dflt` string to set hopt->havec
+5) For options not user-supplied, process the opt's `dflt` string to set hopt->havec
-4) Now, every option should have a hopt->havec set, regardless of where it came from.
+6) Now, every option should have a hopt->havec set, regardless of where it came from.
So parse those per-opt args to set final values for the user to see
What is allocated as result of work here should be freed by hestParseFree
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 19:47:03
|
Revision: 7550
http://sourceforge.net/p/teem/code/7550
Author: kindlmann
Date: 2025-09-30 19:47:02 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
oops long comment belongs outside if verbose check
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 19:24:02 UTC (rev 7549)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 19:47:02 UTC (rev 7550)
@@ -1385,17 +1385,17 @@
&& !strcmp("", hopt[opi].havec->harg[0]->str) //
&& hestSourceDefault == hopt[opi].source //
&& 0 == hopt[opi].min) {
+ /* An established hest idiom (certainly used by unu, e.g. unu resample -off)
+ for non-string-type variadic options with min=0, is to give a default as the
+ "" empty string to mean: 0 values. In the old (pre-2025) code based on
+ strtok: strtok would look at "" and see zero tokens and say: 0 values. The
+ new code sees "" as one arg, dutifully saved to the per-option havec, and
+ then we would (below) try to parse "" as some type (e.g. double), which isn't
+ intended. So here is where we make the idiom work again: if the per-option
+ havec is just a single empty string that came from the default, and this is a
+ non-string variadic option with min=0, then we pretend like we never saw any
+ args, and reset per-option havec to length 0. */
if (hparm->verbosity) {
- /* An established hest idiom (certainly used by unu, e.g. unu resample -off)
- for non-string-type variadic options with min=0, is to give a default as the
- "" empty string to mean: 0 values. In the old (pre-2025) code based on
- strtok: strtok would look at "" and see zero tokens and say: 0 values. The
- new code sees "" as one arg, dutifully saved to the per-option havec, and
- then we would (below) try to parse "" as some type (e.g. double), which isn't
- intended. So here is where we make the idiom work again: if the per-option
- havec is just a single empty string that came from the default, and this is a
- non-string variadic option with min=0, then we pretend like we never saw any
- args, and reset per-option havec to length 0. */
printf(
"%s: (kind 5) %s[%u] (type=%s min=0) default single arg==empty-string "
"treated as 0 args\n",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 19:24:03
|
Revision: 7549
http://sourceforge.net/p/teem/code/7549
Author: kindlmann
Date: 2025-09-30 19:24:02 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
still debugging
Modified Paths:
--------------
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-30 19:23:29 UTC (rev 7548)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-30 19:24:02 UTC (rev 7549)
@@ -36,11 +36,11 @@
hparm->responseFileEnable = AIR_TRUE;
hparm->verbosity = 4;
- /*
int flag;
hestOptAdd_Flag(&opt, "b,bingo", &flag, "a flag");
int verb;
hestOptAdd_1_Int(&opt, "v", "verb", &verb, "0", "verbosity");
+ /*
int unpA[2];
hestOptAdd_2_Int(&opt, NULL, "A A", unpA, NULL, "unflagged A");
@@ -73,6 +73,15 @@
"(e.g. space, time, 3-vector, 3D-masked-symmetric-matrix, "
"or \"none\" to signify no kind)",
&kindsLen);
+ double *off;
+ unsigned int offLen;
+ hestOptAdd_Nv_Double(&opt, "off,offset", "off0", 0, -1, &off, "",
+ "For each axis, an offset or shift to the position (in index "
+ "space) of the lower end of the sampling domain. "
+ "Either -off can be used, or -min and -max "
+ "together, or none of these (so that, by default, the full "
+ "domain of the axis is resampled).",
+ &offLen);
char *err = NULL;
if (hestParse2(opt, argc - 1, argv + 1, &err, hparm)) {
@@ -85,6 +94,9 @@
for (unsigned int ki = 0; ki < kindsLen; ki++) {
printf("kind[%u] = |%s|\n", ki, kinds[ki]);
}
+ for (unsigned int ii = 0; ii < offLen; ii++) {
+ printf("off[%u] = %g\n", ii, off[ii]);
+ }
hestParseFree(opt);
hestOptFree(opt);
hestParmFree(hparm);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 19:23:31
|
Revision: 7548
http://sourceforge.net/p/teem/code/7548
Author: kindlmann
Date: 2025-09-30 19:23:29 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
added slightly hacky logic to rescue a hest idiom: using default of empty string, for 0 or more non-strings, to mean: 0 values (not 1 value, which will fail to parse from the 1 empty string)
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 19:21:28 UTC (rev 7547)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 19:23:29 UTC (rev 7548)
@@ -1353,8 +1353,8 @@
break;
case 2: // -------- one required parameter --------
if (_hestParseSingle[type](valueP, hopt[opi].havec->harg[0]->str, hpp)) {
- biffAddf(HEST, "%s%sproblem parsing for (kind 2) %s[%u]: %s", _ME_, ident, opi,
- hpp->err);
+ biffAddf(HEST, "%s%sproblem parsing for (kind 2) %s[%u] (from %s): %s", _ME_,
+ ident, opi, airEnumStr(hestSource, hopt[opi].source), hpp->err);
return 1;
}
break;
@@ -1381,7 +1381,32 @@
*((void **)valueP) = calloc(hopt[opi].havec->len + 1, size);
} else if (hopt[opi].havec->len) {
// only allocate if there's a need to
- *((void **)valueP) = calloc(hopt[opi].havec->len, size);
+ if (1 == hopt[opi].havec->len //
+ && !strcmp("", hopt[opi].havec->harg[0]->str) //
+ && hestSourceDefault == hopt[opi].source //
+ && 0 == hopt[opi].min) {
+ if (hparm->verbosity) {
+ /* An established hest idiom (certainly used by unu, e.g. unu resample -off)
+ for non-string-type variadic options with min=0, is to give a default as the
+ "" empty string to mean: 0 values. In the old (pre-2025) code based on
+ strtok: strtok would look at "" and see zero tokens and say: 0 values. The
+ new code sees "" as one arg, dutifully saved to the per-option havec, and
+ then we would (below) try to parse "" as some type (e.g. double), which isn't
+ intended. So here is where we make the idiom work again: if the per-option
+ havec is just a single empty string that came from the default, and this is a
+ non-string variadic option with min=0, then we pretend like we never saw any
+ args, and reset per-option havec to length 0. */
+ printf(
+ "%s: (kind 5) %s[%u] (type=%s min=0) default single arg==empty-string "
+ "treated as 0 args\n",
+ __func__, ident, opi, _hestTypeStr[hopt[opi].type]);
+ }
+ hestArgVecReset(hopt[opi].havec);
+ }
+ // yea, so, like we were saying: only allocate if there's a need to
+ if (hopt[opi].havec->len) {
+ *((void **)valueP) = calloc(hopt[opi].havec->len, size);
+ }
}
if (*((void **)valueP)) {
if (!hopt[opi].parseMop) hopt[opi].parseMop = airMopNew();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 19:21:30
|
Revision: 7547
http://sourceforge.net/p/teem/code/7547
Author: kindlmann
Date: 2025-09-30 19:21:28 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
error messages about parse failures now note the source of the string that couldnt be parsed
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-30 18:11:30 UTC (rev 7546)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-30 19:21:28 UTC (rev 7547)
@@ -80,8 +80,8 @@
*out = airEnumVal(airBool, str);
int ret = airEnumUnknown(airBool) /* which is -1 */ == *out;
if (ret) {
- snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldnt parse \"%s\" as %s", str,
- airBool->name);
+ snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldnt parse \"%s\" (from %s) as %s", str,
+ airEnumStr(hestSource, hpp->hopt->source), airBool->name);
} else {
hpp->err[0] = '\0';
}
@@ -93,8 +93,8 @@
if (!(out && str && hpp)) return 1; \
int ret = (1 != airSingleSscanf(str, format, out)); \
if (ret) { \
- snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" as %s", str, \
- typstr); \
+ snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" (from %s) as %s", \
+ str, airEnumStr(hestSource, hpp->hopt->source), typstr); \
} else { \
hpp->err[0] = '\0'; \
} \
@@ -118,8 +118,8 @@
int ret;
if (1 != slen) {
snprintf(hpp->err, AIR_STRLEN_HUGE + 1,
- "expected single char but got string \"%s\" length %u", str,
- AIR_UINT(slen));
+ "expected single char but got (from %s) string \"%s\" length %u",
+ airEnumStr(hestSource, hpp->hopt->source), str, AIR_UINT(slen));
ret = 1;
} else {
char *out = (char *)_out;
@@ -151,8 +151,8 @@
*out = airEnumVal(hpp->hopt->enm, str);
int ret = (airEnumUnknown(hpp->hopt->enm) == *out);
if (ret) {
- snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" as %s", str,
- hpp->hopt->enm->name);
+ snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" (from %s) as %s", str,
+ airEnumStr(hestSource, hpp->hopt->source), hpp->hopt->enm->name);
} else {
hpp->err[0] = '\0';
}
@@ -165,8 +165,9 @@
int ret = hpp->hopt->CB->parse(out, str, myerr);
if (ret) {
if (strlen(myerr)) {
- snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "error parsing \"%s\" as %s:\n%s\n", str,
- hpp->hopt->CB->type,
+ snprintf(hpp->err, AIR_STRLEN_HUGE + 1,
+ "error parsing \"%s\" (from %s) as %s:\n%s\n", str,
+ airEnumStr(hestSource, hpp->hopt->source), hpp->hopt->CB->type,
airStrunc(myerr, AIR_STRLEN_HUGE + 1,
strlen(str) + strlen(hpp->hopt->CB->type) + 100));
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 18:11:31
|
Revision: 7546
http://sourceforge.net/p/teem/code/7546
Author: kindlmann
Date: 2025-09-30 18:11:30 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
if (kvpLen) was not a sensible test: hest is asked get 1 or more strings; instead should be like the test used for all the other options similarly parsed as 1 or more strings
Modified Paths:
--------------
teem/trunk/src/unrrdu/make.c
Modified: teem/trunk/src/unrrdu/make.c
===================================================================
--- teem/trunk/src/unrrdu/make.c 2025-09-30 18:04:33 UTC (rev 7545)
+++ teem/trunk/src/unrrdu/make.c 2025-09-30 18:11:30 UTC (rev 7546)
@@ -421,7 +421,7 @@
if (airStrlen(content)) {
nrrd->content = airStrdup(content);
}
- if (kvpLen) {
+ if (airStrlen(kvp[0])) {
for (ii = 0; ii < kvpLen; ii++) {
/* a hack: have to use NrrdIoState->line as the channel to communicate
the key/value pair, since we have to emulate it having been
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 18:04:34
|
Revision: 7545
http://sourceforge.net/p/teem/code/7545
Author: kindlmann
Date: 2025-09-30 18:04:33 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
maybe finally, finally corrrectly handling case of single empty string default, which is what was screwing up unu make -k, which is what triggered the 2025 hest re-write
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 16:40:47 UTC (rev 7544)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 18:04:33 UTC (rev 7545)
@@ -138,15 +138,18 @@
if (EOF == icc) {
int ret;
switch (*stateP) {
+ case argstInside:
case argstStart:
- case argstComment:
- // oh well, we didn't get to start an arg
- *nastP = nastTryAgain; // input will be popped, try again with next stack element
+ /* EOF ends the arg we're argstInside (which is fine), or it ends the arg we're
+ just argstStart'ing, and that's fine too: it's how to get an empty string arg,
+ which is a legit arg (e.g. unu make -k <kind> default is "" for single empty
+ string; the mishandling of that triggered the 2025 hest re-write) */
+ *nastP = nastBehold;
ret = 0;
break;
- case argstInside:
- // the EOF ends the arg and that's ok
- *nastP = nastBehold;
+ case argstComment:
+ /* hit EOF will inside a #-comment, which is totally fine, move along ... */
+ *nastP = nastTryAgain;
ret = 0;
break;
case argstSingleQ:
@@ -338,6 +341,8 @@
}
return 1;
}
+ /* printf("!%s: icc = %d --> argstGo --> *nastP = %s; tharg:|%s|\n", __func__, icc,
+ airEnumStr(nast_ae, *nastP), tharg->str); */
if (EOF != icc) {
hin->carIdx++;
} else {
@@ -372,7 +377,7 @@
return 1;
}
if (hparm->verbosity > 1) {
- printf("%s: histProcNextArgSub set *nastP = %s\n", __func__,
+ printf("%s: histProcNextArgTry set *nastP = %s\n", __func__,
airEnumStr(nast_ae, *nastP));
}
} while (*nastP == nastTryAgain);
@@ -553,7 +558,7 @@
? hist->hin + hist->len - 1
: NULL);
// printf("!%s: nast = %s, |stack| = %u, topHin = %p\n", __func__,
- // airEnumStr(nast_ae, nast), hist->len, AIR_VOIDP(topHin));
+ // airEnumStr(nast_ae, nast), hist->len, AIR_VOIDP(topHin));
// we have a token, is it turning off commenting?
if (hparm->respectDashBraceComments && !strcmp("}-", tharg->str)) {
if (!topHin) {
@@ -1197,6 +1202,8 @@
printf("%s: looking at %s[%u] default string |%s|\n", __func__, ident, opi,
hopt[opi].dflt);
}
+ /* printf("!%s: hopt[%u].havec %p havec->len = %u\n", __func__, opi,
+ hopt[opi].havec, hopt[opi].havec->len); */
if (histPushDefault(hist, hopt[opi].dflt, hparm)
|| histProcess(hopt[opi].havec, NULL, tharg, hist, hparm)) {
biffAddf(HEST, "%s%sproblem tokenizing %s[%u] default string", _ME_, ident, opi);
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-30 16:40:47 UTC (rev 7544)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-30 18:04:33 UTC (rev 7545)
@@ -36,6 +36,7 @@
hparm->responseFileEnable = AIR_TRUE;
hparm->verbosity = 4;
+ /*
int flag;
hestOptAdd_Flag(&opt, "b,bingo", &flag, "a flag");
int verb;
@@ -47,6 +48,7 @@
unsigned int slen;
hestOptAdd_Nv_Int(&opt, "s,sizes", "sx sy", 2, -1, &size, NULL, "image resolutions",
&slen);
+ */
#if 0
int *unpB;
unsigned int sawB;
@@ -55,8 +57,10 @@
#endif
/* int unpB[2];
hestOptAdd_2_Int(&opt, NULL, "B B", unpB, NULL, "unflagged B"); */
+#if 0
int unpC[2];
hestOptAdd_2_Int(&opt, NULL, "C C", unpC, /* "dfltC0 dfltC1" */ NULL, "unflagged C");
+#endif
/*
int *unpC;
unsigned int sawC;
@@ -64,7 +68,7 @@
*/
char **kinds;
unsigned int kindsLen;
- hestOptAdd_Nv_String(&opt, "k,kind", "k0 k1", 1, -1, &kinds, "boo",
+ hestOptAdd_Nv_String(&opt, "k,kind", "k0 k1", 1, -1, &kinds, "",
"what \"kind\" is each axis, from the nrrdKind airEnum "
"(e.g. space, time, 3-vector, 3D-masked-symmetric-matrix, "
"or \"none\" to signify no kind)",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 16:40:49
|
Revision: 7544
http://sourceforge.net/p/teem/code/7544
Author: kindlmann
Date: 2025-09-30 16:40:47 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
cleaning up logic of how to finish
Modified Paths:
--------------
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-30 16:37:14 UTC (rev 7543)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-30 16:40:47 UTC (rev 7544)
@@ -75,14 +75,13 @@
fprintf(stderr, "%s: problem:\n%s\n", argv[0], err);
free(err);
ret = 1;
+ } else if (opt->helpWanted) {
+ printf("\n\n%s: help wanted!\n\n\n", argv[0]);
} else {
- if (opt->helpWanted) {
- printf("\n\n%s: help wanted!\n\n\n", argv[0]);
- }
for (unsigned int ki = 0; ki < kindsLen; ki++) {
printf("kind[%u] = |%s|\n", ki, kinds[ki]);
}
-
+ hestParseFree(opt);
hestOptFree(opt);
hestParmFree(hparm);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 16:37:17
|
Revision: 7543
http://sourceforge.net/p/teem/code/7543
Author: kindlmann
Date: 2025-09-30 16:37:14 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
adding (kind N) to error messages
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 16:36:38 UTC (rev 7542)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 16:37:14 UTC (rev 7543)
@@ -1327,13 +1327,14 @@
strsrc = hopt[opi].havec->harg[0]->str;
invert = AIR_FALSE;
} else {
- biffAddf(HEST, "%s%sconfused by %s[%u] source %s and havec->len %u", _ME_, ident,
- opi, airEnumStr(hestSource, hopt[opi].source), hopt[opi].havec->len);
+ biffAddf(HEST, "%s%sconfused by (kind 4) %s[%u] source %s and havec->len %u",
+ _ME_, ident, opi, airEnumStr(hestSource, hopt[opi].source),
+ hopt[opi].havec->len);
return 1;
}
if (_hestParseSingle[type](valueP, strsrc, hpp)) {
- biffAddf(HEST, "%s%sfor %s[%u] could not parse |%s| as single %s", _ME_, ident,
- opi, strsrc, _hestTypeStr[type]);
+ biffAddf(HEST, "%s%sfor (kind 4) %s[%u] could not parse |%s| as single %s", _ME_,
+ ident, opi, strsrc, _hestTypeStr[type]);
return 1;
}
if (invert) {
@@ -1345,7 +1346,8 @@
break;
case 2: // -------- one required parameter --------
if (_hestParseSingle[type](valueP, hopt[opi].havec->harg[0]->str, hpp)) {
- biffAddf(HEST, "%s%sproblem parsing for %s[%u]: %s", _ME_, ident, opi, hpp->err);
+ biffAddf(HEST, "%s%sproblem parsing for (kind 2) %s[%u]: %s", _ME_, ident, opi,
+ hpp->err);
return 1;
}
break;
@@ -1355,8 +1357,8 @@
for (uint argi = 0; argi < hopt[opi].havec->len; argi++) {
if (_hestParseSingle[type](cvalueP + size * argi,
hopt[opi].havec->harg[argi]->str, hpp)) {
- biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for %s[%u]: %s", _ME_, argi,
- hopt[opi].havec->len, ident, opi, hpp->err);
+ biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for (kind 3) %s[%u]: %s",
+ _ME_, argi, hopt[opi].havec->len, ident, opi, hpp->err);
return 1;
}
}
@@ -1384,8 +1386,8 @@
for (uint argi = 0; argi < hopt[opi].havec->len; argi++) {
if (_hestParseSingle[type](cvalueP + size * argi,
hopt[opi].havec->harg[argi]->str, hpp)) {
- biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for %s[%u]: %s", _ME_, argi,
- hopt[opi].havec->len, ident, opi, hpp->err);
+ biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for (kind 5) %s[%u]: %s",
+ _ME_, argi, hopt[opi].havec->len, ident, opi, hpp->err);
return 1;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 16:36:41
|
Revision: 7542
http://sourceforge.net/p/teem/code/7542
Author: kindlmann
Date: 2025-09-30 16:36:38 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
fixing broken error message
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-30 16:24:58 UTC (rev 7541)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-30 16:36:38 UTC (rev 7542)
@@ -93,7 +93,8 @@
if (!(out && str && hpp)) return 1; \
int ret = (1 != airSingleSscanf(str, format, out)); \
if (ret) { \
- snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" as", typstr); \
+ snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "couldn't parse \"%s\" as %s", str, \
+ typstr); \
} else { \
hpp->err[0] = '\0'; \
} \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 16:24:59
|
Revision: 7541
http://sourceforge.net/p/teem/code/7541
Author: kindlmann
Date: 2025-09-30 16:24:58 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
still working on debugging hestParse2
Modified Paths:
--------------
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-30 15:46:48 UTC (rev 7540)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-30 16:24:58 UTC (rev 7541)
@@ -62,18 +62,29 @@
unsigned int sawC;
hestOptAdd_Nv_Int(&opt, NULL, "C C", 1, 2, &unpC, NULL, "unflagged C", &sawC);
*/
+ char **kinds;
+ unsigned int kindsLen;
+ hestOptAdd_Nv_String(&opt, "k,kind", "k0 k1", 1, -1, &kinds, "boo",
+ "what \"kind\" is each axis, from the nrrdKind airEnum "
+ "(e.g. space, time, 3-vector, 3D-masked-symmetric-matrix, "
+ "or \"none\" to signify no kind)",
+ &kindsLen);
+
char *err = NULL;
if (hestParse2(opt, argc - 1, argv + 1, &err, hparm)) {
fprintf(stderr, "%s: problem:\n%s\n", argv[0], err);
free(err);
ret = 1;
+ } else {
+ if (opt->helpWanted) {
+ printf("\n\n%s: help wanted!\n\n\n", argv[0]);
+ }
+ for (unsigned int ki = 0; ki < kindsLen; ki++) {
+ printf("kind[%u] = |%s|\n", ki, kinds[ki]);
+ }
+
+ hestOptFree(opt);
+ hestParmFree(hparm);
}
- if (opt->helpWanted) {
- printf("\n\n%s: help wanted!\n\n\n", argv[0]);
- }
-
- hestOptFree(opt);
- hestParmFree(hparm);
-
exit(ret);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 15:46:51
|
Revision: 7540
http://sourceforge.net/p/teem/code/7540
Author: kindlmann
Date: 2025-09-30 15:46:48 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
disallowing - inside the long flag was a mistake; the issue is that the long flag shouldnt start with -
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-30 15:24:21 UTC (rev 7539)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-30 15:46:48 UTC (rev 7540)
@@ -742,8 +742,8 @@
biffAddf(HEST, "%s%sstrlen(opt[%u].flag) %u is too big", _ME_, opi, fslen);
return 1;
}
- if (strchr(flag, '-')) {
- biffAddf(HEST, "%s%sopt[%u].flag \"%s\" contains '-', which will confuse things",
+ if ('-' == flag[0]) {
+ biffAddf(HEST, "%s%sopt[%u].flag \"%s\" starts with '-', which is confusing",
_ME_, opi, flag);
return 1;
}
@@ -772,6 +772,20 @@
_ME_, tbuff, sep + 1, opi);
return (free(tbuff), 1);
}
+ if (strchr(sep + 1, MULTI_FLAG_SEP)) {
+ biffAddf(HEST,
+ "%s%sopt[%u] flag string \"%s\" has more than one instance of "
+ "short/long separation character '%c'",
+ _ME_, opi, flag, MULTI_FLAG_SEP);
+ return (free(tbuff), 1);
+ }
+ if ('-' == (sep + 1)[0]) {
+ biffAddf(HEST,
+ "%s%slong flag \"%s\" (part of \"%s\") of opt[%u] starts with '-', "
+ "which is confusing",
+ _ME_, sep + 1, flag, opi);
+ return 1;
+ }
if (hparm->respectDashDashHelp && !strcmp("help", sep + 1)) {
biffAddf(HEST,
"%s%slong \"--%s\" flag of opt[%u] is same as \"--help\" "
@@ -779,13 +793,6 @@
_ME_, sep + 1, opi);
return (free(tbuff), 1);
}
- if (strchr(sep + 1, MULTI_FLAG_SEP)) {
- biffAddf(HEST,
- "%s%sopt[%u] flag string \"%s\" has more than one instance of "
- "short/long separation character '%c'",
- _ME_, opi, flag, MULTI_FLAG_SEP);
- return (free(tbuff), 1);
- }
} else {
if (!strlen(hopt[opi].flag)) {
biffAddf(HEST, "%s%sopt[%u].flag is zero length", _ME_, opi);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 15:24:33
|
Revision: 7539
http://sourceforge.net/p/teem/code/7539
Author: kindlmann
Date: 2025-09-30 15:24:21 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
no memory-in-use with unu --version
Modified Paths:
--------------
teem/trunk/src/bin/unu.c
Modified: teem/trunk/src/bin/unu.c
===================================================================
--- teem/trunk/src/bin/unu.c 2025-09-30 15:14:53 UTC (rev 7538)
+++ teem/trunk/src/bin/unu.c 2025-09-30 15:24:21 UTC (rev 7539)
@@ -85,6 +85,7 @@
char vbuff[AIR_STRLEN_LARGE + 1];
airTeemVersionSprint(vbuff);
printf("%s\n", vbuff);
+ airMopOkay(mop);
exit(0);
}
/* else, we should see if they're asking for a command we know about */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 15:14:56
|
Revision: 7538
http://sourceforge.net/p/teem/code/7538
Author: kindlmann
Date: 2025-09-30 15:14:53 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
tweaking comments
Modified Paths:
--------------
teem/trunk/src/hest/hest.h
Modified: teem/trunk/src/hest/hest.h
===================================================================
--- teem/trunk/src/hest/hest.h 2025-09-30 14:44:56 UTC (rev 7537)
+++ teem/trunk/src/hest/hest.h 2025-09-30 15:14:53 UTC (rev 7538)
@@ -223,12 +223,12 @@
and informs the later action of hestOptFree */
airArray *parseMop; /* If non-NULL: remembers what was allocated at or behind *valueP
as a result of running hestParse(). Free'ing or destroy'ing
- callbacks added here (by _hestParseSingle[type]) with
+ callbacks are added here (by _hestParseSingle[type]) with
when=airMopAlways. With the 2025 rewrite, this replaces the
previous `int alloc` field with special values 0,1,2,3, which
had fussy semantics that complicated hestParseFree()'s work.
- Now hestParseFree just calls airMopDone on all these (non-NULL)
- per-option parseMops. */
+ Now hestParseFree just calls airMopDone on all these per-option
+ parseMops (when non-NULL) */
hestArgVec *havec; // the (non-flag) parm args attributed to this option
/* Since hest's beginning in 2002, the basic container for a set of options was an
array of hestOpt structs (not pointers to them, which rules out argv-style
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 14:44:59
|
Revision: 7537
http://sourceforge.net/p/teem/code/7537
Author: kindlmann
Date: 2025-09-30 14:44:56 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
reducing warnings associated with sprintf and snprintf
Modified Paths:
--------------
teem/trunk/src/gage/stackBlur.c
Modified: teem/trunk/src/gage/stackBlur.c
===================================================================
--- teem/trunk/src/gage/stackBlur.c 2025-09-30 14:33:56 UTC (rev 7536)
+++ teem/trunk/src/gage/stackBlur.c 2025-09-30 14:44:56 UTC (rev 7537)
@@ -125,8 +125,9 @@
char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "gageStackBlurParmCompare", baseA[] = "A", baseB[] = "B";
const char *nameA, *nameB;
- unsigned int si, warnLen = AIR_STRLEN_LARGE / 4;
- char stmp[2][AIR_STRLEN_LARGE + 1], subexplain[AIR_STRLEN_LARGE + 1];
+#define ASL AIR_STRLEN_LARGE
+ unsigned int si, warnLen = ASL / 4;
+ char stmp[2][ASL + 1], subexplain[ASL + 1];
if (!(aa && bb && differ)) {
biffAddf(GAGE, "%s: got NULL pointer (%p %p %p)", me, AIR_CVOIDP(aa), AIR_CVOIDP(bb),
@@ -136,7 +137,7 @@
nameA = _nameA ? _nameA : baseA;
nameB = _nameB ? _nameB : baseB;
if (strlen(nameA) + strlen(nameB) > warnLen) {
- biffAddf(GAGE, "%s: names (len %s, %s) might lead to overflow", me,
+ biffAddf(GAGE, "%s: names (len %s, %s) might cause string buffer overflow", me,
airSprintSize_t(stmp[0], strlen(nameA)),
airSprintSize_t(stmp[1], strlen(nameB)));
return 1;
@@ -160,8 +161,8 @@
#define CHECK(VAR, FMT) \
if (aa->VAR != bb->VAR) { \
if (explain) { \
- sprintf(explain, "%s->" #VAR "=" #FMT " != %s->" #VAR "=" #FMT, nameA, aa->VAR, \
- nameB, bb->VAR); \
+ snprintf(explain, ASL + 1, "%s->" #VAR "=" #FMT " != %s->" #VAR "=" #FMT, nameA, \
+ aa->VAR, nameB, bb->VAR); \
} \
*differ = 1; \
return 0; \
@@ -180,9 +181,9 @@
#undef CHECK
if (aa->sigmaSampling != bb->sigmaSampling) {
if (explain) {
- sprintf(explain, "%s->sigmaSampling=%s != %s->sigmaSampling=%s", nameA,
- airEnumStr(gageSigmaSampling, aa->sigmaSampling), nameB,
- airEnumStr(gageSigmaSampling, bb->sigmaSampling));
+ snprintf(explain, ASL + 1, "%s->sigmaSampling=%s != %s->sigmaSampling=%s", nameA,
+ airEnumStr(gageSigmaSampling, aa->sigmaSampling), nameB,
+ airEnumStr(gageSigmaSampling, bb->sigmaSampling));
}
*differ = 1;
return 0;
@@ -190,8 +191,8 @@
for (si = 0; si < aa->num; si++) {
if (aa->sigma[si] != bb->sigma[si]) {
if (explain) {
- sprintf(explain, "%s->sigma[%u]=%.17g != %s->sigma[%u]=%.17g", nameA, si,
- aa->sigma[si], nameB, si, bb->sigma[si]);
+ snprintf(explain, ASL + 1, "%s->sigma[%u]=%.17g != %s->sigma[%u]=%.17g", nameA,
+ si, aa->sigma[si], nameB, si, bb->sigma[si]);
}
*differ = 1;
return 0;
@@ -203,7 +204,8 @@
}
if (*differ) {
if (explain) {
- sprintf(explain, "kernel specs different: %s", subexplain);
+ snprintf(explain, ASL + 1, "kernel specs different: %s",
+ airStrunc(subexplain, ASL + 1, 30));
}
*differ = 1;
return 0;
@@ -214,7 +216,8 @@
}
if (*differ) {
if (explain) {
- sprintf(explain, "boundary specs different: %s", subexplain);
+ snprintf(explain, ASL + 1, "boundary specs different: %s",
+ airStrunc(subexplain, ASL + 1, 30));
}
*differ = 1;
return 0;
@@ -221,6 +224,7 @@
}
/* no differences so far */
*differ = 0;
+#undef ASL
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|