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-09-30 14:33:58
|
Revision: 7536
http://sourceforge.net/p/teem/code/7536
Author: kindlmann
Date: 2025-09-30 14:33:56 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
reducing warnings associated with sprintf and snprintf
Modified Paths:
--------------
teem/trunk/src/nrrd/kernel.c
Modified: teem/trunk/src/nrrd/kernel.c
===================================================================
--- teem/trunk/src/nrrd/kernel.c 2025-09-30 07:29:51 UTC (rev 7535)
+++ teem/trunk/src/nrrd/kernel.c 2025-09-30 14:33:56 UTC (rev 7536)
@@ -3354,7 +3354,8 @@
nrrdKernelSpecCompare(const NrrdKernelSpec *aa, const NrrdKernelSpec *bb, int *differ,
char explain[AIR_STRLEN_LARGE + 1]) {
static const char me[] = "nrrdKernelSpecCompare";
- char subexplain[AIR_STRLEN_LARGE + 1];
+#define ASL AIR_STRLEN_LARGE
+ char subexplain[ASL + 1];
if (!(differ)) {
biffAddf(NRRD, "%s: got NULL differ", me);
@@ -3362,8 +3363,8 @@
}
if (!!aa != !!bb) {
if (explain) {
- sprintf(explain, "different NULL-ities of kspec itself %s != %s",
- aa ? "non-NULL" : "NULL", bb ? "non-NULL" : "NULL");
+ snprintf(explain, ASL + 1, "different NULL-ities of kspec itself %s != %s",
+ aa ? "non-NULL" : "NULL", bb ? "non-NULL" : "NULL");
}
*differ = 1;
return 0;
@@ -3375,8 +3376,8 @@
}
if (!!aa->kernel != !!bb->kernel) {
if (explain) {
- sprintf(explain, "different NULL-ities of kspec->kernel %s != %s",
- aa->kernel ? "non-NULL" : "NULL", bb->kernel ? "non-NULL" : "NULL");
+ snprintf(explain, ASL + 1, "different NULL-ities of kspec->kernel %s != %s",
+ aa->kernel ? "non-NULL" : "NULL", bb->kernel ? "non-NULL" : "NULL");
}
*differ = 1;
return 0;
@@ -3393,12 +3394,14 @@
}
if (*differ) {
if (explain) {
- sprintf(explain, "kern/parm pairs differ: %s", subexplain);
+ snprintf(explain, ASL + 1, "kern/parm pairs differ: %s",
+ airStrunc(subexplain, ASL + 1, 30));
}
*differ = 1; /* losing ordering info (of dubious value) */
return 0;
}
*differ = 0;
+#undef ASL
return 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 07:29:53
|
Revision: 7535
http://sourceforge.net/p/teem/code/7535
Author: kindlmann
Date: 2025-09-30 07:29:51 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
different headers
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-09-30 07:10:55 UTC (rev 7534)
+++ teem/trunk/src/biff/0-README.md 2025-09-30 07:29:51 UTC (rev 7535)
@@ -19,25 +19,24 @@
The single-space-separated words in the comment are, in order:
-### Required:
+#### Required:
- `Biff:` : the information in this annotation has been manually verified or,
- `Biff?` : this annotation automatically generated, and needs verification. `teem/src/\_util/scan-symbols.py -biff` _only_ produces `Biff?` annotations.
-### Optional:
+#### Optional:
`(private)` : this function is private (as described above). Otherwise, from the qualifiers on the return type of the function (the same line as this annotation), `static` will mean that the function is static, while not having `static` (and absent `(private)`) means the function is declared in `lib.h` and intended for external linkage. Such "private" functions probably aren't even in a python wrapper, but the fact of being private is nice to record once known, since you can't tell by looking at a function definition where it has been declared. Despite the tendency, there is no requirement in Teem code that private function names start with a single `_` underscore.
-### Required:
+#### 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.
- or `nope` : This function does not use `biff`. The function may usefully communicate something about how things went wrong by a returning one of some possible error return values, but that isn't documented here because it doesn't involve `biff`. (Why `nope`: it won't be confused for anything else, and GLK had just seen the excellent [movie of the same name](<https://en.wikipedia.org/wiki/Nope_(film)>))
-### Optional:
+#### Optional:
`# <comments>` : anything after a `#` is ignored by an annotation parser
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 07:10:57
|
Revision: 7534
http://sourceforge.net/p/teem/code/7534
Author: kindlmann
Date: 2025-09-30 07:10:55 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
trying to avoid crashing
Modified Paths:
--------------
teem/trunk/src/hest/parseHest.c
Modified: teem/trunk/src/hest/parseHest.c
===================================================================
--- teem/trunk/src/hest/parseHest.c 2025-09-30 06:21:24 UTC (rev 7533)
+++ teem/trunk/src/hest/parseHest.c 2025-09-30 07:10:55 UTC (rev 7534)
@@ -1274,6 +1274,10 @@
hestParm *hparm;
optNum = hestOptNum(opt);
+ if (errP) {
+ /* initialize error string pointer */
+ *errP = NULL;
+ }
/* -------- initialize the mop! */
mop = 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 06:21:27
|
Revision: 7533
http://sourceforge.net/p/teem/code/7533
Author: kindlmann
Date: 2025-09-30 06:21:24 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
cleaning up hest usage
Modified Paths:
--------------
teem/trunk/tests/ctest/nrrd/tskip.c
Modified: teem/trunk/tests/ctest/nrrd/tskip.c
===================================================================
--- teem/trunk/tests/ctest/nrrd/tskip.c 2025-09-30 06:07:31 UTC (rev 7532)
+++ teem/trunk/tests/ctest/nrrd/tskip.c 2025-09-30 06:21:24 UTC (rev 7533)
@@ -66,7 +66,7 @@
hestOptAdd(&hopt, "p", "pb pa", airTypeSize_t, 2, 2, pad, "0 0",
"bytes of padding before, and after, the data segment "
"in the written data");
- hestOptAdd(&hopt, "ns", "bool", airTypeInt, 0, 0, &negskip, NULL,
+ hestOptAdd(&hopt, "ns", NULL, airTypeInt, 0, 0, &negskip, NULL,
"skipping should be relative to end of file");
hestOptAdd(&hopt, "pb", "print", airTypeUInt, 1, 1, &printbytes, "0",
"bytes to print at beginning and end of data, to help "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 06:07:34
|
Revision: 7532
http://sourceforge.net/p/teem/code/7532
Author: kindlmann
Date: 2025-09-30 06:07:31 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
oops, was using HEST_EXPORT instead of extern inside privateHest.h
Modified Paths:
--------------
teem/trunk/src/biff/0-README.md
teem/trunk/src/hest/argvHest.c
teem/trunk/src/hest/privateHest.h
Modified: teem/trunk/src/biff/0-README.md
===================================================================
--- teem/trunk/src/biff/0-README.md 2025-09-30 06:06:44 UTC (rev 7531)
+++ teem/trunk/src/biff/0-README.md 2025-09-30 06:07:31 UTC (rev 7532)
@@ -1,128 +1,97 @@
-All about /* Biff: */ annotations (new with Teem v2)
+# All about `/* Biff: */` annotations (new with Teem v2)
-teem/src/_util/scan-symbols.py -biff (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 biffGet{Done} is called in response to an error
-(in, say, a Python wrapper), as follows.
+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.
-Even though these annotations were motivated by the needs of Python wrapping (which is
-only wrapping things in the public API), GLK decided to also do these annotations for
-"private" functions (which are are available for linking in the library, but are declared
-in privateLib.h rather than lib.h), and even for static functions that do use biff. The
-idea is that this is potentially useful information for further analysis or for human
-coding, and its better to err on the side of more info, discretely packaged, when the
-quality/correctness of the info is high.
+`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.
-NOTE that the Biff annotation on a function currently reflects a simplistic textual
-analysis of that function code, saying "it looks like this function uses biff in this
-way." This is not based on any proper parsing of the code AST, so calls to biff could be
-hidden behind a #define, and there is certainly no way to know (without execution)
-whether any other functions called from this function used biff. The formatting of the
-newly adopted clang-format is a big help. In any case this seems adequate for Teem's
-Python wrapping error handling.
+Even though these annotations were motivated by the needs of Python wrapping (which is only wrapping things in the public API), GLK decided to also do these annotations for "private" functions (which are are available for linking in the library, but are declared in privateLib.h rather than lib.h), and even for static functions that do use biff. The idea is that this is potentially useful information for further analysis or for human coding, and its better to err on the side of more info, discretely packaged, when the quality/correctness of the information is high.
-Here is an example annotation from teem/src/nrrd/subset.c
+NOTE that the `Biff` annotation on a function currently reflects a simplistic textual analysis of that function code, saying "it looks like this function uses biff in this way." This is not based on any proper parsing of the code AST, so calls to `biff` could be hidden behind a `#define`, and there is certainly no way to know (without execution) whether any other functions called from this function used biff. The formatting induced by the newly adopted `clang-format` is a big help. In any case this seems adequate for Teem's Python wrapping error handling.
- int /* Biff: 1 */
- nrrdSlice(Nrrd *nout, const Nrrd *cnin, unsigned int saxi, size_t pos) {
+Here is an example annotation from `teem/src/nrrd/subset.c`:
-The annotations are a one-line comment, always on the line with the function return type,
-which is above the function name (this formatting is enforced by new use of
-clang-format).
-** NOTE that in Teem code, the remainder of the line after the function return
-** type (with the function name on the next line) is reserved for these kinds
-** of annotations. Human-written comments about the return type/qualifers need
-** to be in the previous line. In the future this space may be used for other
-** annotations with other non-biff info about the function.
+```
+int /* Biff: 1 */
+nrrdSlice(Nrrd *nout, const Nrrd *cnin, unsigned int saxi, size_t pos) {
+```
+The annotations are a one-line comment, always on the line with the function return type, which is above the function name (this formatting is enforced by new use of `clang-format`). **NOTE** that in Teem code, the remainder of the line after the function return type (with the function name on the next line) is reserved for these kinds of adhoc function annotations. Human-written comments about the return type/qualifers need to be in the previous line. In the future this space may be used for other annotations giving other non-biff info about the function.
+
The single-space-separated words in the comment are, in order:
---- Required:
- "Biff:" : the information in this annotation has been manually verified
-or "Biff?" : this annotation automatically generated, and needs verification.
-teem/src/_util/scan-symbols.py -biff *only* produces Biff? annotations.
+### Required:
---- Optional:
-"(private)" : this function is private (as described above). Otherwise, from the
-qualifiers on the return type of the function (the same line as this annotation),
-"static" will mean that the function is static, while not having "static" (and absent
-"(private)"), this is declared in lib.h and intended for external linkage. Such "private"
-functions probably aren't even in a python wrapper, but the fact of being private is nice
-to record once known, since you can't tell by looking at a function definition where it
-has been declared. Despite the tendency, there is no iron rule in Teem code that private
-function names start with a single "_".
+- `Biff:` : the information in this annotation has been manually verified or,
+- `Biff?` : this annotation automatically generated, and needs verification. `teem/src/\_util/scan-symbols.py -biff` _only_ produces `Biff?` annotations.
---- 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.
-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.
-or "nope" : This function does not use biff. The function may usefully communicate
- something about how things went wrong by a returning one of some possible
- error return values, but that isn't documented here because it doesn't
- involve biff. (Why "nope": it won't be confused for anything else, and GLK had
- just seen the excellent Jordan Peele movie of the same name)
+### Optional:
---- Optional:
- # <comments> : anything after a '#' is ignored by an annotation parser
+`(private)` : this function is private (as described above). Otherwise, from the qualifiers on the return type of the function (the same line as this annotation), `static` will mean that the function is static, while not having `static` (and absent `(private)`) means the function is declared in `lib.h` and intended for external linkage. Such "private" functions probably aren't even in a python wrapper, but the fact of being private is nice to record once known, since you can't tell by looking at a function definition where it has been declared. Despite the tendency, there is no requirement in Teem code that private function names start with a single `_` underscore.
-Other examples:
+### Required:
- int /* Biff: (private) maybe:2:nrrdField_unknown */
- _nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff) {
+- `<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.
+- or `nope` : This function does not use `biff`. The function may usefully communicate something about how things went wrong by a returning one of some possible error return values, but that isn't documented here because it doesn't involve `biff`. (Why `nope`: it won't be confused for anything else, and GLK had just seen the excellent [movie of the same name](<https://en.wikipedia.org/wiki/Nope_(film)>))
- static int /* Biff: nope # unlike other parsers, for reasons described below */
- _nrrdReadNrrdParse_number(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) {
+### Optional:
-You can see the variety of Biff annotations by, from the top-level teem directory
-(with air, biff, hest, etc as subdirs), running:
+`# <comments>` : anything after a `#` is ignored by an annotation parser
+## More examples:
+
+```
+int /* Biff: (private) maybe:2:nrrdField_unknown */
+_nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff) {
+```
+
+```
+static int /* Biff: nope # unlike other parsers, for reasons described below */
+_nrrdReadNrrdParse_number(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) {
+```
+
+You can see the variety of Biff annotations by, from the top-level teem directory (the one with `air`, `biff`, `hest`, etc as subdirectories), running:
+
+```
grep 'Biff:' */*.c | cut -d: -f 2- | cut -d/ -f 2- | cut -d' ' -f 2- | cut -d\* -f 1 | sort | uniq
+```
-For context: the Biff: annotations are created with the help of
-../_util/scan-symbols.py, which is re-run as needed when the API changes,
-and prior to releases. Then, the Biff: annotations are ready by
-../_util/gen_biffdata.py, which repackages the info and save it into
-../../python/cffi/biffdata/*.csv, one file per Teem library.
+## What creates `Biff` annotations
-Some further notes on how GLK creates the annotations, for example for gage:
-GLK has his teem source checkout in ~/teem.
-From the ~/teem/src/_util directory:
+The annotations are created with the help of `../_util/scan-symbols.py`, which is re-run as needed when the API changes, and prior to releases. Later, the `Biff:` annotations are read by `../_util/gen_biffdata.py`, which repackages the info and save it into `../../python/cffi/biffdata/*.csv`, one file per Teem library.
- unset TEEM_SRC
- export TEEM_ARCH=darwin.64 # for example
- python3 scan-symbols.py ~/teem -biff 3 gage
+`scan-symbols.py` uses the per-library `GNUmakefile`s to make `.a` library archive file to look at with `nm`. Supposing you have your teem source checkout in `~/teem`, then from the `~/teem/src/_util` directory:
-why -biff 3: because
--biff 1 is just for observing biff usage;
--biff 2 is for doing annotations where none have been done before, and
--biff 3 will over-write old comments and wrong annotations.
-But no original source .c files are actually over-written, instead new files
-are created, eg:
+```
+unset TEEM_SRC
+python3 scan-symbols.py ~/teem -biff 3 gage
+```
- wrote 2 annotations in miscGage-annote.c
- wrote 5 annotations in kind-annote.c
- wrote 6 annotations in shape-annote.c
+The different `-biff _n_` levels:
-(so, files ending with "-annote.c" can actually get over-written).
-Then to process these (in ~/teem/src/gage)
+- `-biff 1` is just for observing `biff` usage;
+- `-biff 2` is for doing annotations where none have been done before, and
+- `-biff 3` will over-write old comments and wrong annotations.
+ But actually, no original source `.c` files are actually modified over-written, instead new files are created, as described by `scan-symbols.py`, eg:
- diff miscGage{-annote,}.c # to inspect what biff auto-scan wrote
- mv miscGage{-annote,}.c # to start editing
- # open miscGage.c for editing, confirm each annotation,
- # and then change "Biff?" to "Biff:" once confirmed.
- svn diff -x -U0 miscGage.c # to confirm what was changed
- svn commit ...
+```
+wrote 2 annotations in miscGage-annote.c
+wrote 5 annotations in kind-annote.c
+wrote 6 annotations in shape-annote.c
+```
+
+Thus, it is files ending with `-annote.c` that are written or over-written by `scan-symbols.py`. In a way that helps ensure Teem libraries have the symbols intended, `scan-symbols.py` will loudly fail if it detects that a link-able symbol in library `lib` does not start with `lib` or `\_lib`.
+
+Then to process these (in e.g. `~/teem/src/gage`):
+
+```
+diff miscGage{-annote,}.c # to inspect what biff auto-scan wrote
+mv miscGage{-annote,}.c # to start editing
+# open miscGage.c (for example) for editing, confirm each annotation,
+# and then change "Biff?" to "Biff:" once confirmed.
+svn diff -x -U0 miscGage.c # to confirm what was changed
+svn commit ...
+```
Modified: teem/trunk/src/hest/argvHest.c
===================================================================
--- teem/trunk/src/hest/argvHest.c 2025-09-30 06:06:44 UTC (rev 7531)
+++ teem/trunk/src/hest/argvHest.c 2025-09-30 06:07:31 UTC (rev 7532)
@@ -208,7 +208,7 @@
/* Assuming that `str` needs some quoting or ecaping to be retokenized as a single arg
then figure out if that should be via single or double quoting, by doing both and picking
the shorter one */
-void
+static void
argAddQuotedString(hestArg *harg, const char *str) {
hestArg *singQ = hestArgNew();
hestArg *doubQ = hestArgNew();
Modified: teem/trunk/src/hest/privateHest.h
===================================================================
--- teem/trunk/src/hest/privateHest.h 2025-09-30 06:06:44 UTC (rev 7531)
+++ teem/trunk/src/hest/privateHest.h 2025-09-30 06:07:31 UTC (rev 7532)
@@ -69,9 +69,9 @@
* with a air --> _hest renaming, since these are only used to implement hest functions.
*/
#define _HEST_TYPE_MAX 14
-HEST_EXPORT const char _hestTypeStr[_HEST_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
-HEST_EXPORT const size_t _hestTypeSize[_HEST_TYPE_MAX + 1];
-HEST_EXPORT void (*const _hestInvertScalar[_HEST_TYPE_MAX + 1])(void *);
+extern const char _hestTypeStr[_HEST_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
+extern const size_t _hestTypeSize[_HEST_TYPE_MAX + 1];
+extern void (*const _hestInvertScalar[_HEST_TYPE_MAX + 1])(void *);
/* the _hestPPair (hest parse pair) struct is a 2025 idea for addressing one of the most
annoying parts of hest's code: the special-casing of how values are parsed from strings,
depending on type (scalar vs enum vs other-via-callbacks). Old code has long had nested
@@ -86,12 +86,12 @@
hestOpt *hopt; // what option is this for
char err[AIR_STRLEN_HUGE + 1]; // error message can go for any type
} _hestPPair;
-HEST_EXPORT int (*const _hestParseSingle[_HEST_TYPE_MAX + 1])(void *, const char *,
- _hestPPair *);
+extern int (*const _hestParseSingle[_HEST_TYPE_MAX + 1])(void *, const char *,
+ _hestPPair *);
// HEY these are sticking around just for the old implementation of hestParse
-HEST_EXPORT unsigned int (*const _hestParseStr[_HEST_TYPE_MAX + 1])(void *, const char *,
- const char *,
- unsigned int);
+extern unsigned int (*const _hestParseStr[_HEST_TYPE_MAX + 1])(void *, const char *,
+ const char *,
+ unsigned int);
extern const char *const _hestBiffKey;
extern int _hestMax(int max);
extern int _hestOPCheck(const hestOpt *hopt, const hestParm *parm);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 06:06:47
|
Revision: 7531
http://sourceforge.net/p/teem/code/7531
Author: kindlmann
Date: 2025-09-30 06:06:44 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
fixing to work with new top-level built/ instead of arch/ directory, and to try to generate Biff annotations for hest, but not working yet
Modified Paths:
--------------
teem/trunk/src/_util/scan-symbols.py
Modified: teem/trunk/src/_util/scan-symbols.py
===================================================================
--- teem/trunk/src/_util/scan-symbols.py 2025-09-30 04:30:08 UTC (rev 7530)
+++ teem/trunk/src/_util/scan-symbols.py 2025-09-30 06:06:44 UTC (rev 7531)
@@ -49,7 +49,7 @@
verbose = 1
LIB = None # which library is being scanned
-archDir = None
+builtDir = None
libDir = None
srcLines = {} # maps from filename to (list of) lines of code, either from disk or modified
modified = {} # maps from filename to how many srcLines have been modified
@@ -100,6 +100,10 @@
'airThreadBarrier',
'airJSFRand',
'biffMsg',
+ 'hestArg',
+ 'hestArgVec',
+ 'hestInput',
+ 'hestInputStack',
'hestCB',
'hestParm',
'hestOpt',
@@ -330,9 +334,8 @@
if firstClean:
runthis('make clean', False)
runthis('make', False)
- runthis('make install', False)
# HEY HEY this depends on "nm" being llvm-nm
- nmOut = runthis(f'nm {archDir}/lib/lib{lib}.a', True).stdout.decode('UTF-8').splitlines()
+ nmOut = runthis(f'nm {builtDir}/lib/lib{lib}.a', True).stdout.decode('UTF-8').splitlines()
nmOut.pop(0) # first line is empty (at least on Mac)
# symb accumulates a dict mapping from symbol name to little description:
# 'type': of the symbol, in the nm sense (not the C sense)
@@ -341,7 +344,7 @@
currFile = None
for L in nmOut:
# if match := re.match(r'[^\()]+\(([^\)]+).o\):$', L): # old nm
- if match := re.match(r'^([^\)]+).o:$', L): # new llvm-nm
+ if match := re.match(r'^([^\)]+).o:$', L): # new llvm-nm
currFile = match.group(1) + '.c'
if verbose > 1:
print(f' ... {currFile}')
@@ -365,7 +368,8 @@
if dropUnder: # (Mac) (----- 1 -----)(- 2 -) ( 3)
match = re.match(r'([0-9a-fA-F]+ )([tTDS]) _(.*)$', L)
if not match:
- raise Exception(f'malformed (no leading underscore) "{L}" in {currFile}')
+ print(f'malformed (no leading underscore) "{L}" in {currFile}; ignoring ...')
+ continue
else: # not trying to drop leading underscore (not on Mac)
# (----- 1 -----)(- 2 -) ( 3)
match = re.match(r'([0-9a-fA-F]+ )([tTDS]) (.*)$', L)
@@ -436,6 +440,8 @@
lines.remove('extern "C" {')
# how thing intended for linkable visibility are are announced
externStr = f'{LIB}_EXPORT ' if public else 'extern '
+ if verbose:
+ print(f' = = = = = looking at {HN=} {externStr=} ... ')
for L in lines:
origL = L
# special handling of inside of list of nrrdKernels
@@ -443,11 +449,13 @@
L = 'NRRD_EXPORT const NrrdKernel' + kernelLineProc(L[1:])
# does it looks like the start of a declaration?
if L.startswith(externStr):
+ # print(f'{HN=} : {externStr=} {L=}')
# remove LIB_EXPORT or extern prefix
L = L.removeprefix(externStr)
if L == 'const NrrdKernel':
# its the start of a kernel list; each handled separately above
continue
+ # print(f' ... {L=}')
# else (hackly) work on isolating the symbol name
# print(f'foo0 |{L}|')
for QT in allTypes:
@@ -728,16 +736,16 @@
# check the two command-line arguments to this script
def argsCheck(tPath, lib):
- global archDir, libDir
+ global builtDir, libDir
if not (
- os.path.isdir(tPath) and os.path.isdir(f'{tPath}/arch') and os.path.isdir(f'{tPath}/src')
+ os.path.isdir(tPath) and os.path.isdir(f'{tPath}/built') and os.path.isdir(f'{tPath}/src')
):
- raise Exception(f'Need {tPath} to be dir with "arch" and "src" subdirs')
+ raise Exception(f'Need {tPath} to be dir with "built" and "src" subdirs')
if not os.path.isdir(f'{tPath}/src/{lib}'):
raise Exception(f'Do not see library "{lib}" subdir in "src" subdir')
- archDir = f'{tPath}/built'
- if not os.path.isdir(archDir):
- raise Exception(f'Do not see "{archDir}" subdir')
+ builtDir = f'{tPath}/built'
+ if not os.path.isdir(builtDir):
+ raise Exception(f'Do not see "{builtDir}" subdir')
libDir = f'{tPath}/src/{lib}'
if not os.path.isdir(libDir):
raise Exception(f'Do not see "{libDir}" subdir for lib "{lib}"')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:30:11
|
Revision: 7530
http://sourceforge.net/p/teem/code/7530
Author: kindlmann
Date: 2025-09-30 04:30:08 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
rename README.txt -> 0-README.md
Added Paths:
-----------
teem/trunk/src/biff/0-README.md
Removed Paths:
-------------
teem/trunk/src/biff/README.txt
Copied: teem/trunk/src/biff/0-README.md (from rev 7529, teem/trunk/src/biff/README.txt)
===================================================================
--- teem/trunk/src/biff/0-README.md (rev 0)
+++ teem/trunk/src/biff/0-README.md 2025-09-30 04:30:08 UTC (rev 7530)
@@ -0,0 +1,128 @@
+All about /* Biff: */ annotations (new with Teem v2)
+
+teem/src/_util/scan-symbols.py -biff (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 biffGet{Done} is called in response to an error
+(in, say, a Python wrapper), as follows.
+
+Even though these annotations were motivated by the needs of Python wrapping (which is
+only wrapping things in the public API), GLK decided to also do these annotations for
+"private" functions (which are are available for linking in the library, but are declared
+in privateLib.h rather than lib.h), and even for static functions that do use biff. The
+idea is that this is potentially useful information for further analysis or for human
+coding, and its better to err on the side of more info, discretely packaged, when the
+quality/correctness of the info is high.
+
+NOTE that the Biff annotation on a function currently reflects a simplistic textual
+analysis of that function code, saying "it looks like this function uses biff in this
+way." This is not based on any proper parsing of the code AST, so calls to biff could be
+hidden behind a #define, and there is certainly no way to know (without execution)
+whether any other functions called from this function used biff. The formatting of the
+newly adopted clang-format is a big help. In any case this seems adequate for Teem's
+Python wrapping error handling.
+
+Here is an example annotation from teem/src/nrrd/subset.c
+
+ int /* Biff: 1 */
+ nrrdSlice(Nrrd *nout, const Nrrd *cnin, unsigned int saxi, size_t pos) {
+
+The annotations are a one-line comment, always on the line with the function return type,
+which is above the function name (this formatting is enforced by new use of
+clang-format).
+** NOTE that in Teem code, the remainder of the line after the function return
+** type (with the function name on the next line) is reserved for these kinds
+** of annotations. Human-written comments about the return type/qualifers need
+** to be in the previous line. In the future this space may be used for other
+** annotations with other non-biff info about the function.
+
+The single-space-separated words in the comment are, in order:
+
+--- Required:
+ "Biff:" : the information in this annotation has been manually verified
+or "Biff?" : this annotation automatically generated, and needs verification.
+teem/src/_util/scan-symbols.py -biff *only* produces Biff? annotations.
+
+--- Optional:
+"(private)" : this function is private (as described above). Otherwise, from the
+qualifiers on the return type of the function (the same line as this annotation),
+"static" will mean that the function is static, while not having "static" (and absent
+"(private)"), this is declared in lib.h and intended for external linkage. Such "private"
+functions probably aren't even in a python wrapper, but the fact of being private is nice
+to record once known, since you can't tell by looking at a function definition where it
+has been declared. Despite the tendency, there is no iron rule in Teem code that private
+function names start with a single "_".
+
+--- 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.
+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.
+or "nope" : This function does not use biff. The function may usefully communicate
+ something about how things went wrong by a returning one of some possible
+ error return values, but that isn't documented here because it doesn't
+ involve biff. (Why "nope": it won't be confused for anything else, and GLK had
+ just seen the excellent Jordan Peele movie of the same name)
+
+--- Optional:
+ # <comments> : anything after a '#' is ignored by an annotation parser
+
+Other examples:
+
+ int /* Biff: (private) maybe:2:nrrdField_unknown */
+ _nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff) {
+
+ static int /* Biff: nope # unlike other parsers, for reasons described below */
+ _nrrdReadNrrdParse_number(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) {
+
+You can see the variety of Biff annotations by, from the top-level teem directory
+(with air, biff, hest, etc as subdirs), running:
+
+grep 'Biff:' */*.c | cut -d: -f 2- | cut -d/ -f 2- | cut -d' ' -f 2- | cut -d\* -f 1 | sort | uniq
+
+For context: the Biff: annotations are created with the help of
+../_util/scan-symbols.py, which is re-run as needed when the API changes,
+and prior to releases. Then, the Biff: annotations are ready by
+../_util/gen_biffdata.py, which repackages the info and save it into
+../../python/cffi/biffdata/*.csv, one file per Teem library.
+
+Some further notes on how GLK creates the annotations, for example for gage:
+GLK has his teem source checkout in ~/teem.
+From the ~/teem/src/_util directory:
+
+ unset TEEM_SRC
+ export TEEM_ARCH=darwin.64 # for example
+ python3 scan-symbols.py ~/teem -biff 3 gage
+
+why -biff 3: because
+-biff 1 is just for observing biff usage;
+-biff 2 is for doing annotations where none have been done before, and
+-biff 3 will over-write old comments and wrong annotations.
+But no original source .c files are actually over-written, instead new files
+are created, eg:
+
+ wrote 2 annotations in miscGage-annote.c
+ wrote 5 annotations in kind-annote.c
+ wrote 6 annotations in shape-annote.c
+
+(so, files ending with "-annote.c" can actually get over-written).
+Then to process these (in ~/teem/src/gage)
+
+ diff miscGage{-annote,}.c # to inspect what biff auto-scan wrote
+ mv miscGage{-annote,}.c # to start editing
+ # open miscGage.c for editing, confirm each annotation,
+ # and then change "Biff?" to "Biff:" once confirmed.
+ svn diff -x -U0 miscGage.c # to confirm what was changed
+ svn commit ...
Deleted: teem/trunk/src/biff/README.txt
===================================================================
--- teem/trunk/src/biff/README.txt 2025-09-30 04:29:27 UTC (rev 7529)
+++ teem/trunk/src/biff/README.txt 2025-09-30 04:30:08 UTC (rev 7530)
@@ -1,128 +0,0 @@
-All about /* Biff: */ annotations (new with Teem v2)
-
-teem/src/_util/scan-symbols.py -biff (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 biffGet{Done} is called in response to an error
-(in, say, a Python wrapper), as follows.
-
-Even though these annotations were motivated by the needs of Python wrapping (which is
-only wrapping things in the public API), GLK decided to also do these annotations for
-"private" functions (which are are available for linking in the library, but are declared
-in privateLib.h rather than lib.h), and even for static functions that do use biff. The
-idea is that this is potentially useful information for further analysis or for human
-coding, and its better to err on the side of more info, discretely packaged, when the
-quality/correctness of the info is high.
-
-NOTE that the Biff annotation on a function currently reflects a simplistic textual
-analysis of that function code, saying "it looks like this function uses biff in this
-way." This is not based on any proper parsing of the code AST, so calls to biff could be
-hidden behind a #define, and there is certainly no way to know (without execution)
-whether any other functions called from this function used biff. The formatting of the
-newly adopted clang-format is a big help. In any case this seems adequate for Teem's
-Python wrapping error handling.
-
-Here is an example annotation from teem/src/nrrd/subset.c
-
- int /* Biff: 1 */
- nrrdSlice(Nrrd *nout, const Nrrd *cnin, unsigned int saxi, size_t pos) {
-
-The annotations are a one-line comment, always on the line with the function return type,
-which is above the function name (this formatting is enforced by new use of
-clang-format).
-** NOTE that in Teem code, the remainder of the line after the function return
-** type (with the function name on the next line) is reserved for these kinds
-** of annotations. Human-written comments about the return type/qualifers need
-** to be in the previous line. In the future this space may be used for other
-** annotations with other non-biff info about the function.
-
-The single-space-separated words in the comment are, in order:
-
---- Required:
- "Biff:" : the information in this annotation has been manually verified
-or "Biff?" : this annotation automatically generated, and needs verification.
-teem/src/_util/scan-symbols.py -biff *only* produces Biff? annotations.
-
---- Optional:
-"(private)" : this function is private (as described above). Otherwise, from the
-qualifiers on the return type of the function (the same line as this annotation),
-"static" will mean that the function is static, while not having "static" (and absent
-"(private)"), this is declared in lib.h and intended for external linkage. Such "private"
-functions probably aren't even in a python wrapper, but the fact of being private is nice
-to record once known, since you can't tell by looking at a function definition where it
-has been declared. Despite the tendency, there is no iron rule in Teem code that private
-function names start with a single "_".
-
---- 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.
-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.
-or "nope" : This function does not use biff. The function may usefully communicate
- something about how things went wrong by a returning one of some possible
- error return values, but that isn't documented here because it doesn't
- involve biff. (Why "nope": it won't be confused for anything else, and GLK had
- just seen the excellent Jordan Peele movie of the same name)
-
---- Optional:
- # <comments> : anything after a '#' is ignored by an annotation parser
-
-Other examples:
-
- int /* Biff: (private) maybe:2:nrrdField_unknown */
- _nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff) {
-
- static int /* Biff: nope # unlike other parsers, for reasons described below */
- _nrrdReadNrrdParse_number(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) {
-
-You can see the variety of Biff annotations by, from the top-level teem directory
-(with air, biff, hest, etc as subdirs), running:
-
-grep 'Biff:' */*.c | cut -d: -f 2- | cut -d/ -f 2- | cut -d' ' -f 2- | cut -d\* -f 1 | sort | uniq
-
-For context: the Biff: annotations are created with the help of
-../_util/scan-symbols.py, which is re-run as needed when the API changes,
-and prior to releases. Then, the Biff: annotations are ready by
-../_util/gen_biffdata.py, which repackages the info and save it into
-../../python/cffi/biffdata/*.csv, one file per Teem library.
-
-Some further notes on how GLK creates the annotations, for example for gage:
-GLK has his teem source checkout in ~/teem.
-From the ~/teem/src/_util directory:
-
- unset TEEM_SRC
- export TEEM_ARCH=darwin.64 # for example
- python3 scan-symbols.py ~/teem -biff 3 gage
-
-why -biff 3: because
--biff 1 is just for observing biff usage;
--biff 2 is for doing annotations where none have been done before, and
--biff 3 will over-write old comments and wrong annotations.
-But no original source .c files are actually over-written, instead new files
-are created, eg:
-
- wrote 2 annotations in miscGage-annote.c
- wrote 5 annotations in kind-annote.c
- wrote 6 annotations in shape-annote.c
-
-(so, files ending with "-annote.c" can actually get over-written).
-Then to process these (in ~/teem/src/gage)
-
- diff miscGage{-annote,}.c # to inspect what biff auto-scan wrote
- mv miscGage{-annote,}.c # to start editing
- # open miscGage.c for editing, confirm each annotation,
- # and then change "Biff?" to "Biff:" once confirmed.
- svn diff -x -U0 miscGage.c # to confirm what was changed
- svn commit ...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:29:29
|
Revision: 7529
http://sourceforge.net/p/teem/code/7529
Author: kindlmann
Date: 2025-09-30 04:29:27 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
rename README.md -> 0-README.md
Added Paths:
-----------
teem/trunk/src/hest/0-README.md
Removed Paths:
-------------
teem/trunk/src/hest/README.md
Copied: teem/trunk/src/hest/0-README.md (from rev 7528, teem/trunk/src/hest/README.md)
===================================================================
--- teem/trunk/src/hest/0-README.md (rev 0)
+++ teem/trunk/src/hest/0-README.md 2025-09-30 04:29:27 UTC (rev 7529)
@@ -0,0 +1,97 @@
+# `hest`: command-line parsing
+
+## Intro
+
+The purpose of `hest` is to bridge the `int argc`, `char *argv[]` command-line arguments and a set of C variables that need to be set for a C program to run. The variables can be of most any type (boolean, `int`, `float`, `char *` strings, or user-defined types), and the variables can hold single values (such as `float thresh`) or multiple values (such as `float RGBA[4]`).
+
+`hest` was created in 2002 out of frustration with how limited other C command-line parsing libraries were, and has become essential for the utility of tools like `unu`. To the extent that `hest` bridges the interactive command-line with compiled C code, it approaches some of the roles that in other contexts are served by scripting languages with C extensions. The `hest` code was revisited in 2023 to add long-overdue support for `--help`, and to add typed functions for specifying options like `hestOptAdd_4_Float`. Re-writing the code in 2025 finally fixed long-standing bugs with how quoted strings were handled and how response files were parsed, and to add `-{`, `}-` comments.
+
+`hest` is powerful and not simple. This note attempts to give a technical description useful for someone thinking about using `hest`, as well as anyone trying wrap their head around the `hest` source code, including its author.
+
+First, some examples ...
+
+## Terminology and concepts
+
+`hest` has possibly non-standard terminology for the elements of command-line parsing. Here is a bottom-up description of the command-line and what `hest` can do with it:
+
+- What `main()` gets as `char *argv[]` is the vector of _arguments_ or _args_; each one is a `char*` string. An arg can contain spaces and other arbitrary characters if the user quoted strings or escaped characters; that is between the user and shell (the shell is responsible for taking the command-line and tokenizing it into `char *argv[]`).
+- Arguments like `-v` and `-size`, which identify the variable to be set, are called _flags_.
+- Some flags are really just flags; no further information is given beyond their presence or absence. Other flags introduce subsequent arguments that together supply information for setting one variable.
+- The sub-sequence of arguments that logically belong together (often following a flag) in the service of setting a variable are called _parameters_ (or _parms_). There is some slippage of terminology between the `char *` string that communicates the parameter, and the value (such an `int`) parsed from the parameter string.
+- Separately, and possibly confusingly, `hest`'s behavior has many knobs and controls, stored in the `hestParm` struct. The pointer-to-struct is always named `hparm` in the code, to try to distinguish it from the parameters appearing on the command-line.
+- One _option_ determines how to set one C variable. In the C code, one `hestOpt` struct stores everything about how to parse one option, _and_ intermediate state during the parsing process, _and_ the final results of that parsing. An _array_ of `hestOpt` structs (which we can call an _option list_) is how a `hest`-using program communicates what it wants to learn from the command-line, and how to interpret the contents of the command-line. The `hestOpt` array is usually built up by calls to one of the `hestOptAdd` functions.
+- On the command-line, the option may be communicated by a flag (e.g. `-sz`) and its associated parms (e.g. `3 640 480`); this is a _flagged_ option. Options may also be _unflagged_, or what others call "positional" arguments, because determining which option a given argument belongs to is disambiguated by where that option's `hestOpt` struct occurs with the option list.
+- An option may have no parms, one parm, a fixed number of parms, or a variable number of parms; `hest` calls these _variadic_ options to separate the description of the options from the information (the C _variable_) that the option describes. Unflagged options must have one or more parms. With `mv *.txt dir`, the `*.txt` filenames could be parsed as the variadic parms for an unflagged option, and `dir` would be a fixed single parm for a second unflagged option.
+- Sometimes multiple command-line options need to be saved and re-used together, over a time span longer than any one shell. Command-line options can thus be stored in _response files_, and the contents of response files effecively expanded into the command-line. Response files can have comments (from `#` to end of line, just like shell scripts), and response files can in turn name other response files.
+- The main `hest` function that does the parsing is `hestParse`. Its job is to set one variable (which may have multiple components) for every `hestOpt`. Information for setting each variable can come from the command-line, or from the default string set in the `hestOpt`, but it has to come from somewhere. Essentially, if no default string is given, then the option _must_ be set on the command-line (or a response file named there). In this sense, `hest`'s "options" are badly named, because they are not really optional.
+
+Pre-dating `hest` are the [POSIX conventions for command-line arguments](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_01), wherein the elements of `argv` can be first "options" and then "operands", where "options" are indicated by an initial `-` character, and may have zero or more "option-arguments" (what `hest` calls "parameters"). However, `hest` does not attempt to follow POSIX conventions (or terminology) for command-line usage. In particular, `hest` has no idea of an "operand" while it tries to interpret _every_ the `argv` args as some argument of some (possibly unflagged) option. Disregard for POSIX has not limited `hest`'s expressivity and flexibility, or its utility for the scientific computing and visualization contexts that it was built for.
+
+## The different `kind`s of options, and how to `hestOptAdd` them.
+
+There are lot of moving pieces inside `hestParse`, and the description of how it works is complicated by how flexible a `hestOpt` can be. Two of the most important yet unconventional fields in the `hestOpt` are `min` and `max`: the min and max number of parameters that may be parsed for that option. All the different traditional uses of the command-line can be parameterized in terms of `min` and `max`, but the full range of possibilities of `min`,`max` (which `hest` supports) include unusual use-cases. Once the possibility of mapping out all possibilities for command-line options in terms of `min` and `max` was recognized, `hest` implementation was organized around that, even if typical uses of `hest` are not thought of that way. Refer also to the **concrete examples** above and below.
+
+The _`kind`_ is `hest`'s term for a numeric identifier for the kind of option that a `hestOpt` describes. The following ASCII-art illustrates how `min` and `max` determine:
+
+- numeric `kind`, shown as `(`_n_`)`; for _n_ = 1,2,3,4,5
+- the prose name for that kind of option, which appears in the code and a description of its operation.
+- Which `hestOptAdd_` function or family of functions is used to parse that kind of option. Here, `hestOptAdd_` is abbreviated `hOA_` and the final `_T` stands for the type (eg. `_Bool`, `_Int`, `_Float`, `_Enum`, `_Other`, etc).
+
+```
+ | . / . /
+ | . / . /
+ | . / . /
+ | (5) multiple | (3) multiple
+ 2--| variadic | fixed
+ | parms | parms
+ | hOA_Nv_T | hOA_{2,3,4,N}_T
+ |.............................../
+ | (4) single | (2) single
+ 1--| variadic | fixed
+ | parm | parm
+ | hOA_1v_T | hOA_1_T
+ |...............|/
+ | (1) stand-alone
+ 0--| flag;
+ | no parms
+ | hOA_Flag
+ ^ |/_____________________________________________
+max | | |
+ min > 0 1 2
+```
+
+The `kind` of option is mostly independent of whether it is flagged or unflagged, and independent of being optional (due to the `hestOpt` having a default string) versus required (when no default is given). The one wrinkle is that unflagged options must have at least one parameter (i.e. `min` > 0), either by the command-line or via a default string. An unflagged option allowed to have zero parameters has no explicit textual existence, which seems out-of-bounds for a command-line parser. Thus for unflagged options, `kind`s 1 and 4 are ruled out, and kind 5 is possible only with `min` >= 1. This is likely already too much low-level information: users of `hest` will probably never need to worry about `kind`, and certainly `kind` is not part of the API calls to create options and parse command-lines.
+
+More examples may help show `hest`'s utility ... (IN PROGRESS) ...
+... Give some specific examples, flagged and unflagged ...
+.. show a response file being used, show -{ }- commenting
+
+## The over-all process `hestParse`, its limits, and the `--` flag
+
+Given an `argc`,`argv` command-line and a `hestOpt` array describing the options to parse, `hestParse` must first answer: **which elements of `argv` are associated with which options?** If there are no variadic options (i.e. limiting oneself to kinds 1, 2, and 3), then the answer is straight-forward, even with flagged options being able to appear on the command-line in any order. The option set has some fixed number of slots. The flag arguments for the flagged options, and the position of arguments of unflagged options, implies how to put each `argv` element into each slot.
+
+Things became more complicated with variadic options. Suppose ... two unflagged variadic options wouldn't make sense ...
+
+Understanding how `hest` attributes arguments to options starts with knowing the main phases of `hestParse`:
+
+1. Validate the given `hestOpt` array
+1. Convert given `argc`,`argv`, to an internal (`hestArgVec`) representation of the argument vector (called `havec` in the code). This is the phase in which response files are expanded and `-{`,`}-` comments are interpreted.
+1. Extract from `havec` all the arguments associated with flagged options: the flag args, plus any immediately subsequent associated parm args. Arguments are transferred to the per-option arg vector within the `hestOpt` struct.
+1. What remains in the command-line `havec` should be the concatenation of args associated with the unflagged (positional) options. As long as there is at most one unflagged variadic option, there is an unambigious assignment of arguments to options, so transfer these args to their corresponding option.
+1. For any option that did not receive any args from the command-line, tokenize the option's default string and save into its per-option arg vector. Whether by command-line, response file, or default, every option should have the information it needs.
+1. Parse the per-option arg vectors (of strings) to set the value(s) of C variable pointed to by each `hestOpt`. Each `hestOpt` also remembers the source of information for setting the variable (command-line vs response-file vs default string).
+
+Fans of [POSIX Guidelines](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) may know that Guideline 10 describes the role of `--`:
+
+> The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the `-` character. So `--` marks the end of some "option-arguments".
+
+Even though, as noted above, `hest` itself does not traffic in "operands" or follow POSIX, it does borrow `--` in a limited way to help with phase 3 above: `--` marks the end of arguments for a _flagged_ variadic option, to demarcate them from any arguments intended for _unflagged_ options (variadic or not). In this sense, the `--` mark is more about seperating phases 3 and 4 above, than it is about separating options from operands.
+
+With this context, some further details and limitations of `hest`' processing can be outlined:
+
+- There can be only one _unflagged_ multiple variadic option (kind 5). Having more than one could create ambiguity about which option consumes which arguments, and `hest` currently attempts nothing (not even `--`) to resolve this. There can be, however, more than one _flagged_ multiple variadic options.
+- The `--` flag indicates the explicit end of arguments for a _flagged_ variadic option. But the `--` is not necessary: any option flag also marks the end of variadic args, as does the end of the command-line.
+- `hestProc` strives to interpret the entire `argc`,`argv` argument vector you give it; there is currently no way to tell `hest` (via `--` or otherwise): "stop processing `argv` here, and leave the rest as operands for something else to interpret".
+- Arguments for options (flagged or unflagged) can only come from the user (the `argc`,`argv` command-line or a response file it invokes) or from the option's default string, but not from any mix of both: there is no way to supplement arguments from the user with those from the default string. Though it will probably be more confusing than helpful, options can get arguments from a mix of the command-line and response files, since response files are effectively expanded into the command-line prior to any per-option processing.
+- Flagged options can appear in any order on the command-line, and the same option can be repeated: the last appearance over-rides all earlier appearances. `hest` currently cannot remember a list of occurance of repeated options (unlike, say, `sed -e ... -e ... `. )
+- By their nature, unflagged options can appear at most once on the command-line, or not at all if they have a default. The attribution of arguments to unflagged options depends on the ordering of the options in the option list (later arguments are always attributed to later options), but arguments are not extracted from the command-line (and moved to the per-option arg vec) if the option has a default. .... forward and back order ...
Deleted: teem/trunk/src/hest/README.md
===================================================================
--- teem/trunk/src/hest/README.md 2025-09-30 04:27:30 UTC (rev 7528)
+++ teem/trunk/src/hest/README.md 2025-09-30 04:29:27 UTC (rev 7529)
@@ -1,97 +0,0 @@
-# `hest`: command-line parsing
-
-## Intro
-
-The purpose of `hest` is to bridge the `int argc`, `char *argv[]` command-line arguments and a set of C variables that need to be set for a C program to run. The variables can be of most any type (boolean, `int`, `float`, `char *` strings, or user-defined types), and the variables can hold single values (such as `float thresh`) or multiple values (such as `float RGBA[4]`).
-
-`hest` was created in 2002 out of frustration with how limited other C command-line parsing libraries were, and has become essential for the utility of tools like `unu`. To the extent that `hest` bridges the interactive command-line with compiled C code, it approaches some of the roles that in other contexts are served by scripting languages with C extensions. The `hest` code was revisited in 2023 to add long-overdue support for `--help`, and to add typed functions for specifying options like `hestOptAdd_4_Float`. Re-writing the code in 2025 finally fixed long-standing bugs with how quoted strings were handled and how response files were parsed, and to add `-{`, `}-` comments.
-
-`hest` is powerful and not simple. This note attempts to give a technical description useful for someone thinking about using `hest`, as well as anyone trying wrap their head around the `hest` source code, including its author.
-
-First, some examples ...
-
-## Terminology and concepts
-
-`hest` has possibly non-standard terminology for the elements of command-line parsing. Here is a bottom-up description of the command-line and what `hest` can do with it:
-
-- What `main()` gets as `char *argv[]` is the vector of _arguments_ or _args_; each one is a `char*` string. An arg can contain spaces and other arbitrary characters if the user quoted strings or escaped characters; that is between the user and shell (the shell is responsible for taking the command-line and tokenizing it into `char *argv[]`).
-- Arguments like `-v` and `-size`, which identify the variable to be set, are called _flags_.
-- Some flags are really just flags; no further information is given beyond their presence or absence. Other flags introduce subsequent arguments that together supply information for setting one variable.
-- The sub-sequence of arguments that logically belong together (often following a flag) in the service of setting a variable are called _parameters_ (or _parms_). There is some slippage of terminology between the `char *` string that communicates the parameter, and the value (such an `int`) parsed from the parameter string.
-- Separately, and possibly confusingly, `hest`'s behavior has many knobs and controls, stored in the `hestParm` struct. The pointer-to-struct is always named `hparm` in the code, to try to distinguish it from the parameters appearing on the command-line.
-- One _option_ determines how to set one C variable. In the C code, one `hestOpt` struct stores everything about how to parse one option, _and_ intermediate state during the parsing process, _and_ the final results of that parsing. An _array_ of `hestOpt` structs (which we can call an _option list_) is how a `hest`-using program communicates what it wants to learn from the command-line, and how to interpret the contents of the command-line. The `hestOpt` array is usually built up by calls to one of the `hestOptAdd` functions.
-- On the command-line, the option may be communicated by a flag (e.g. `-sz`) and its associated parms (e.g. `3 640 480`); this is a _flagged_ option. Options may also be _unflagged_, or what others call "positional" arguments, because determining which option a given argument belongs to is disambiguated by where that option's `hestOpt` struct occurs with the option list.
-- An option may have no parms, one parm, a fixed number of parms, or a variable number of parms; `hest` calls these _variadic_ options to separate the description of the options from the information (the C _variable_) that the option describes. Unflagged options must have one or more parms. With `mv *.txt dir`, the `*.txt` filenames could be parsed as the variadic parms for an unflagged option, and `dir` would be a fixed single parm for a second unflagged option.
-- Sometimes multiple command-line options need to be saved and re-used together, over a time span longer than any one shell. Command-line options can thus be stored in _response files_, and the contents of response files effecively expanded into the command-line. Response files can have comments (from `#` to end of line, just like shell scripts), and response files can in turn name other response files.
-- The main `hest` function that does the parsing is `hestParse`. Its job is to set one variable (which may have multiple components) for every `hestOpt`. Information for setting each variable can come from the command-line, or from the default string set in the `hestOpt`, but it has to come from somewhere. Essentially, if no default string is given, then the option _must_ be set on the command-line (or a response file named there). In this sense, `hest`'s "options" are badly named, because they are not really optional.
-
-Pre-dating `hest` are the [POSIX conventions for command-line arguments](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_01), wherein the elements of `argv` can be first "options" and then "operands", where "options" are indicated by an initial `-` character, and may have zero or more "option-arguments" (what `hest` calls "parameters"). However, `hest` does not attempt to follow POSIX conventions (or terminology) for command-line usage. In particular, `hest` has no idea of an "operand" while it tries to interpret _every_ the `argv` args as some argument of some (possibly unflagged) option. Disregard for POSIX has not limited `hest`'s expressivity and flexibility, or its utility for the scientific computing and visualization contexts that it was built for.
-
-## The different `kind`s of options, and how to `hestOptAdd` them.
-
-There are lot of moving pieces inside `hestParse`, and the description of how it works is complicated by how flexible a `hestOpt` can be. Two of the most important yet unconventional fields in the `hestOpt` are `min` and `max`: the min and max number of parameters that may be parsed for that option. All the different traditional uses of the command-line can be parameterized in terms of `min` and `max`, but the full range of possibilities of `min`,`max` (which `hest` supports) include unusual use-cases. Once the possibility of mapping out all possibilities for command-line options in terms of `min` and `max` was recognized, `hest` implementation was organized around that, even if typical uses of `hest` are not thought of that way. Refer also to the **concrete examples** above and below.
-
-The _`kind`_ is `hest`'s term for a numeric identifier for the kind of option that a `hestOpt` describes. The following ASCII-art illustrates how `min` and `max` determine:
-
-- numeric `kind`, shown as `(`_n_`)`; for _n_ = 1,2,3,4,5
-- the prose name for that kind of option, which appears in the code and a description of its operation.
-- Which `hestOptAdd_` function or family of functions is used to parse that kind of option. Here, `hestOptAdd_` is abbreviated `hOA_` and the final `_T` stands for the type (eg. `_Bool`, `_Int`, `_Float`, `_Enum`, `_Other`, etc).
-
-```
- | . / . /
- | . / . /
- | . / . /
- | (5) multiple | (3) multiple
- 2--| variadic | fixed
- | parms | parms
- | hOA_Nv_T | hOA_{2,3,4,N}_T
- |.............................../
- | (4) single | (2) single
- 1--| variadic | fixed
- | parm | parm
- | hOA_1v_T | hOA_1_T
- |...............|/
- | (1) stand-alone
- 0--| flag;
- | no parms
- | hOA_Flag
- ^ |/_____________________________________________
-max | | |
- min > 0 1 2
-```
-
-The `kind` of option is mostly independent of whether it is flagged or unflagged, and independent of being optional (due to the `hestOpt` having a default string) versus required (when no default is given). The one wrinkle is that unflagged options must have at least one parameter (i.e. `min` > 0), either by the command-line or via a default string. An unflagged option allowed to have zero parameters has no explicit textual existence, which seems out-of-bounds for a command-line parser. Thus for unflagged options, `kind`s 1 and 4 are ruled out, and kind 5 is possible only with `min` >= 1. This is likely already too much low-level information: users of `hest` will probably never need to worry about `kind`, and certainly `kind` is not part of the API calls to create options and parse command-lines.
-
-More examples may help show `hest`'s utility ... (IN PROGRESS) ...
-... Give some specific examples, flagged and unflagged ...
-.. show a response file being used, show -{ }- commenting
-
-## The over-all process `hestParse`, its limits, and the `--` flag
-
-Given an `argc`,`argv` command-line and a `hestOpt` array describing the options to parse, `hestParse` must first answer: **which elements of `argv` are associated with which options?** If there are no variadic options (i.e. limiting oneself to kinds 1, 2, and 3), then the answer is straight-forward, even with flagged options being able to appear on the command-line in any order. The option set has some fixed number of slots. The flag arguments for the flagged options, and the position of arguments of unflagged options, implies how to put each `argv` element into each slot.
-
-Things became more complicated with variadic options. Suppose ... two unflagged variadic options wouldn't make sense ...
-
-Understanding how `hest` attributes arguments to options starts with knowing the main phases of `hestParse`:
-
-1. Validate the given `hestOpt` array
-1. Convert given `argc`,`argv`, to an internal (`hestArgVec`) representation of the argument vector (called `havec` in the code). This is the phase in which response files are expanded and `-{`,`}-` comments are interpreted.
-1. Extract from `havec` all the arguments associated with flagged options: the flag args, plus any immediately subsequent associated parm args. Arguments are transferred to the per-option arg vector within the `hestOpt` struct.
-1. What remains in the command-line `havec` should be the concatenation of args associated with the unflagged (positional) options. As long as there is at most one unflagged variadic option, there is an unambigious assignment of arguments to options, so transfer these args to their corresponding option.
-1. For any option that did not receive any args from the command-line, tokenize the option's default string and save into its per-option arg vector. Whether by command-line, response file, or default, every option should have the information it needs.
-1. Parse the per-option arg vectors (of strings) to set the value(s) of C variable pointed to by each `hestOpt`. Each `hestOpt` also remembers the source of information for setting the variable (command-line vs response-file vs default string).
-
-Fans of [POSIX Guidelines](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) may know that Guideline 10 describes the role of `--`:
-
-> The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the `-` character. So `--` marks the end of some "option-arguments".
-
-Even though, as noted above, `hest` itself does not traffic in "operands" or follow POSIX, it does borrow `--` in a limited way to help with phase 3 above: `--` marks the end of arguments for a _flagged_ variadic option, to demarcate them from any arguments intended for _unflagged_ options (variadic or not). In this sense, the `--` mark is more about seperating phases 3 and 4 above, than it is about separating options from operands.
-
-With this context, some further details and limitations of `hest`' processing can be outlined:
-
-- There can be only one _unflagged_ multiple variadic option (kind 5). Having more than one could create ambiguity about which option consumes which arguments, and `hest` currently attempts nothing (not even `--`) to resolve this. There can be, however, more than one _flagged_ multiple variadic options.
-- The `--` flag indicates the explicit end of arguments for a _flagged_ variadic option. But the `--` is not necessary: any option flag also marks the end of variadic args, as does the end of the command-line.
-- `hestProc` strives to interpret the entire `argc`,`argv` argument vector you give it; there is currently no way to tell `hest` (via `--` or otherwise): "stop processing `argv` here, and leave the rest as operands for something else to interpret".
-- Arguments for options (flagged or unflagged) can only come from the user (the `argc`,`argv` command-line or a response file it invokes) or from the option's default string, but not from any mix of both: there is no way to supplement arguments from the user with those from the default string. Though it will probably be more confusing than helpful, options can get arguments from a mix of the command-line and response files, since response files are effectively expanded into the command-line prior to any per-option processing.
-- Flagged options can appear in any order on the command-line, and the same option can be repeated: the last appearance over-rides all earlier appearances. `hest` currently cannot remember a list of occurance of repeated options (unlike, say, `sed -e ... -e ... `. )
-- By their nature, unflagged options can appear at most once on the command-line, or not at all if they have a default. The attribution of arguments to unflagged options depends on the ordering of the options in the option list (later arguments are always attributed to later options), but arguments are not extracted from the command-line (and moved to the per-option arg vec) if the option has a default. .... forward and back order ...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:27:31
|
Revision: 7528
http://sourceforge.net/p/teem/code/7528
Author: kindlmann
Date: 2025-09-30 04:27:30 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
adding airEnum test
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 04:26:12 UTC (rev 7527)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 04:27:30 UTC (rev 7528)
@@ -1446,6 +1446,20 @@
HPARM->verbosity);
}
+#if 0
+ { // checking on the private airEnums
+ char err[AIR_STRLEN_LARGE + 1];
+ static const airEnum *saenm[2] = {argst_ae, nast_ae};
+ for (uint ei = 0; ei < 2; ei++) {
+ if (airEnumCheck(err, saenm[ei])) {
+ fprintf(stderr, "%s: problem with enum \"%s\" (%u):\n%s", __func__,
+ saenm[ei]->name, ei, err);
+ exit(1);
+ }
+ }
+ }
+#endif
+
// error string song and dance
#define DO_ERR(WUT) \
biffAddf(HEST, "%s%s" WUT, _MEV_(HPARM->verbosity)); \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:26:15
|
Revision: 7527
http://sourceforge.net/p/teem/code/7527
Author: kindlmann
Date: 2025-09-30 04:26:12 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
clang-format?
Modified Paths:
--------------
teem/trunk/src/hest/test/ex6.c
Modified: teem/trunk/src/hest/test/ex6.c
===================================================================
--- teem/trunk/src/hest/test/ex6.c 2025-09-30 04:04:39 UTC (rev 7526)
+++ teem/trunk/src/hest/test/ex6.c 2025-09-30 04:26:12 UTC (rev 7527)
@@ -95,7 +95,8 @@
short h1v;
hestOptAdd_1v_Short(&opt, "h1v", "short1", &h1v, "42", "test of hestOptAdd_1v_Short");
unsigned short uh1v;
- hestOptAdd_1v_UShort(&opt, "uh1v", "ushort1", &uh1v, "42", "test of hestOptAdd_1v_UShort");
+ hestOptAdd_1v_UShort(&opt, "uh1v", "ushort1", &uh1v, "42",
+ "test of hestOptAdd_1v_UShort");
int i1v;
hestOptAdd_1v_Int(&opt, "i1v", "int1", &i1v, "42", "test of hestOptAdd_1v_Int");
unsigned int ui1v;
@@ -103,8 +104,7 @@
long int l1v;
hestOptAdd_1v_Long(&opt, "l1v", "lnt1", &l1v, "42", "test of hestOptAdd_1v_Long");
unsigned long int ul1v;
- hestOptAdd_1v_ULong(&opt, "ul1v", "ulnt1", &ul1v, "42",
- "test of hestOptAdd_1v_ULong");
+ hestOptAdd_1v_ULong(&opt, "ul1v", "ulnt1", &ul1v, "42", "test of hestOptAdd_1v_ULong");
size_t sz1v;
hestOptAdd_1v_Size_t(&opt, "sz1v", "size1", &sz1v, "42",
"test of hestOptAdd_1v_Size_t");
@@ -170,10 +170,11 @@
hestOptAdd_2_Bool(&opt, "b2", "bool1 bool2", b2, "true false",
"test of hestOptAdd_2_Bool");
short h2[2];
- hestOptAdd_2_Short(&opt, "h2", "short1 short2", h2, "42 24", "test of hestOptAdd_2_Short");
+ hestOptAdd_2_Short(&opt, "h2", "short1 short2", h2, "42 24",
+ "test of hestOptAdd_2_Short");
unsigned short uh2[2];
hestOptAdd_2_UShort(&opt, "uh2", "ushort1 ushort2", uh2, "42 24",
- "test of hestOptAdd_2_UShort");
+ "test of hestOptAdd_2_UShort");
int i2[2];
hestOptAdd_2_Int(&opt, "i2", "int1 int2", i2, "42 24", "test of hestOptAdd_2_Int");
unsigned int ui2[2];
@@ -180,8 +181,7 @@
hestOptAdd_2_UInt(&opt, "ui2", "uint1 uint2", ui2, "42 24",
"test of hestOptAdd_2_UInt");
long int l2[2];
- hestOptAdd_2_Long(&opt, "l2", "long1 long2", l2, "42 24",
- "test of hestOptAdd_2_Long");
+ hestOptAdd_2_Long(&opt, "l2", "long1 long2", l2, "42 24", "test of hestOptAdd_2_Long");
unsigned long int ul2[2];
hestOptAdd_2_ULong(&opt, "ul2", "ulong1 ulong2", ul2, "42 24",
"test of hestOptAdd_2_ULong");
@@ -214,10 +214,10 @@
"test of hestOptAdd_3_Bool");
short h3[3];
hestOptAdd_3_Short(&opt, "h3", "short1 short2 short3", h3, "43 3 34",
- "test of hestOptAdd_3_Short");
+ "test of hestOptAdd_3_Short");
unsigned short uh3[3];
hestOptAdd_3_UShort(&opt, "uh3", "ushort1 ushort2 ushort3", uh3, "43 3 34",
- "test of hestOptAdd_3_UShort");
+ "test of hestOptAdd_3_UShort");
int i3[3];
hestOptAdd_3_Int(&opt, "i3", "int1 int2 int3", i3, "43 3 34",
"test of hestOptAdd_3_Int");
@@ -307,8 +307,8 @@
hestOptAdd_N_UInt(&opt, "ui5", "uint1 uint2 uint3 uint4 uint5", 5, ui5,
"55 5 33 500 55", "test of hestOptAdd_N_UInt");
long int l5[5];
- hestOptAdd_N_Long(&opt, "l5", "long1 long2 long3 long4 long5", 5, l5,
- "55 5 33 500 55", "test of hestOptAdd_N_Long");
+ hestOptAdd_N_Long(&opt, "l5", "long1 long2 long3 long4 long5", 5, l5, "55 5 33 500 55",
+ "test of hestOptAdd_N_Long");
unsigned long int ul5[5];
hestOptAdd_N_ULong(&opt, "ul5", "ulong1 ulong2 ulong3 ulong4 ulong5", 5, ul5,
"55 5 33 500 55", "test of hestOptAdd_N_ULong");
@@ -340,8 +340,8 @@
"15.55 55.51 66.77 88.99 100.2", "test of hestOptAdd_N_Other B",
&quatCB);
-// HEY try both!
-// #define VMIN 0
+ // HEY try both!
+ // #define VMIN 0
#define VMIN 1
int *bv;
unsigned int bvSaw;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:04:42
|
Revision: 7526
http://sourceforge.net/p/teem/code/7526
Author: kindlmann
Date: 2025-09-30 04:04:39 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
added new airEnum
Modified Paths:
--------------
teem/trunk/src/meet/enumall.c
Modified: teem/trunk/src/meet/enumall.c
===================================================================
--- teem/trunk/src/meet/enumall.c 2025-09-30 04:03:33 UTC (rev 7525)
+++ teem/trunk/src/meet/enumall.c 2025-09-30 04:04:39 UTC (rev 7526)
@@ -43,7 +43,7 @@
** libraries. Can manually check that this really does list all the airEnums
** with: (TEEM_LIB_LIST)
-grep "airEnum *" {air,hest,biff,nrrd,ell,moss,unrrdu,alan,tijk,gage,dye,bane,limn,echo,hoover,seek,ten,elf,pull,coil,push,mite}/?*.h | grep EXPORT | more
+grep "airEnum *" {air,biff,hest,nrrd,ell,moss,unrrdu,alan,tijk,gage,dye,bane,limn,echo,hoover,seek,ten,elf,pull,coil,push,mite}/?*.h | grep EXPORT | more
** (with the ? in "}/?*.h" to stop compiler warnings about / * inside comment)
** We could grep specifically for "const airEnum *const", but its also good to
@@ -66,13 +66,14 @@
/* air */
ADD(airEndian);
+ ADD(airFPClass_ae);
ADD(airBool);
- ADD(airFPClass_ae);
- /* hest: no airEnums */
-
/* biff: no airEnums */
+ /* hest */
+ ADD(hestSource);
+
/* nrrd */
ADD(nrrdFormatType);
ADD(nrrdType);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:03:41
|
Revision: 7525
http://sourceforge.net/p/teem/code/7525
Author: kindlmann
Date: 2025-09-30 04:03:33 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
hest,biff library ordering, and removing extraneous ten -> dye dep
Modified Paths:
--------------
teem/trunk/python/cffi/exult.py
Modified: teem/trunk/python/cffi/exult.py
===================================================================
--- teem/trunk/python/cffi/exult.py 2025-09-30 04:02:23 UTC (rev 7524)
+++ teem/trunk/python/cffi/exult.py 2025-09-30 04:03:33 UTC (rev 7525)
@@ -54,15 +54,17 @@
# ell: ellMacros.h does not add to ell API
}
# as of Teem v2 the per-library "experimental" notion is gone, which simplifies
-# how the libraries and their dependencies are declared
+# how the libraries and their dependencies are declared. The info below should
+# be extracted from the per-library GNUmakefiles, ideally in an automated way,
+# but for now via: grep Depends */GNUmakefile | grep -v bin/GNUmakefile
_tldeps = {
'air': [], # (don't need airExistsConf.h)
- 'hest': ['air'],
'biff': ['air'],
+ 'hest': ['air', 'biff'],
'nrrd': ['biff', 'hest', 'air'],
'ell': ['nrrd', 'biff', 'air'],
'moss': ['ell', 'nrrd', 'biff', 'hest', 'air'],
- 'unrrdu': ['nrrd', 'hest', 'biff', 'air'],
+ 'unrrdu': ['moss', 'nrrd', 'hest', 'biff', 'air'],
# moss needed for linking (because of unu ilk) but not for declaring unrrdu API
'alan': ['ell', 'nrrd', 'biff', 'air'],
'tijk': ['ell', 'nrrd', 'air'],
@@ -70,11 +72,11 @@
'dye': ['ell', 'biff', 'air'],
# may not actually need ell; implementation of dye needs ellMacros.h
'bane': ['gage', 'unrrdu', 'nrrd', 'biff', 'air'],
- 'limn': ['gage', 'ell', 'unrrdu', 'nrrd', 'biff', 'hest', 'air'],
+ 'limn': ['ell', 'unrrdu', 'nrrd', 'biff', 'hest', 'air'],
'echo': ['limn', 'ell', 'nrrd', 'biff', 'air'],
'hoover': ['limn', 'ell', 'nrrd', 'biff', 'air'],
'seek': ['gage', 'limn', 'ell', 'nrrd', 'biff', 'hest', 'air'],
- 'ten': ['echo', 'limn', 'gage', 'dye', 'unrrdu', 'ell', 'nrrd', 'biff', 'air'],
+ 'ten': ['echo', 'limn', 'gage', 'unrrdu', 'ell', 'nrrd', 'biff', 'air'],
'elf': ['ten', 'tijk', 'limn', 'ell', 'nrrd', 'air'],
'pull': ['ten', 'limn', 'gage', 'ell', 'nrrd', 'biff', 'hest', 'air'],
'coil': ['ten', 'ell', 'nrrd', 'biff', 'air'],
@@ -81,7 +83,7 @@
'push': ['ten', 'gage', 'ell', 'nrrd', 'biff', 'air'],
'mite': ['ten', 'hoover', 'limn', 'gage', 'ell', 'nrrd', 'biff', 'air'],
# fmt: off
- 'meet': [ 'air', 'hest', 'biff', 'nrrd', 'ell', 'moss', 'unrrdu', 'alan', 'tijk',
+ 'meet': [ 'air', 'biff', 'hest', 'nrrd', 'ell', 'moss', 'unrrdu', 'alan', 'tijk',
'gage', 'dye', 'bane', 'limn', 'echo', 'hoover', 'seek', 'ten', 'elf',
'pull', 'coil', 'push', 'mite'],
# fmt: on
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:02:25
|
Revision: 7524
http://sourceforge.net/p/teem/code/7524
Author: kindlmann
Date: 2025-09-30 04:02:23 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
tweaking hest biff library order
Modified Paths:
--------------
teem/trunk/CMakeLists-v1.txt
teem/trunk/CMakeLists.txt
teem/trunk/python/ctypes/gen-teem.py
Modified: teem/trunk/CMakeLists-v1.txt
===================================================================
--- teem/trunk/CMakeLists-v1.txt 2025-09-30 04:01:04 UTC (rev 7523)
+++ teem/trunk/CMakeLists-v1.txt 2025-09-30 04:02:23 UTC (rev 7524)
@@ -263,14 +263,14 @@
# set the Teem library as a list (TEEM_LIB_LIST)
set(Teem_LIBRARIES
- "air" "hest" "biff" "nrrd" "ell" "moss" "unrrdu" "alan" "tijk" "gage" "dye"
+ "air" "biff" "hest" "nrrd" "ell" "moss" "unrrdu" "alan" "tijk" "gage" "dye"
"bane" "limn" "echo" "hoover" "seek" "ten" "elf" "pull" "coil" "push" "mite" "meet")
# set the Teem headers as a list
set(Teem_HEADER_FILES
"air/air.h"
+ "biff/biff.h"
"hest/hest.h"
- "biff/biff.h"
"nrrd/nrrd.h" "nrrd/nrrdDefines.h" "nrrd/nrrdMacros.h" "nrrd/nrrdEnums.h"
"ell/ell.h" "ell/ellMacros.h"
"moss/moss.h"
Modified: teem/trunk/CMakeLists.txt
===================================================================
--- teem/trunk/CMakeLists.txt 2025-09-30 04:01:04 UTC (rev 7523)
+++ teem/trunk/CMakeLists.txt 2025-09-30 04:02:23 UTC (rev 7524)
@@ -263,14 +263,14 @@
# set the Teem library as a list (TEEM_LIB_LIST)
set(Teem_LIBRARIES
- "air" "hest" "biff" "nrrd" "ell" "moss" "unrrdu" "alan" "tijk" "gage" "dye"
+ "air" "biff" "hest" "nrrd" "ell" "moss" "unrrdu" "alan" "tijk" "gage" "dye"
"bane" "limn" "echo" "hoover" "seek" "ten" "elf" "pull" "coil" "push" "mite" "meet")
# set the Teem headers as a list
set(Teem_HEADER_FILES
"air/air.h"
+ "biff/biff.h"
"hest/hest.h"
- "biff/biff.h"
"nrrd/nrrd.h" "nrrd/nrrdDefines.h" "nrrd/nrrdMacros.h" "nrrd/nrrdEnums.h"
"ell/ell.h" "ell/ellMacros.h"
"moss/moss.h"
Modified: teem/trunk/python/ctypes/gen-teem.py
===================================================================
--- teem/trunk/python/ctypes/gen-teem.py 2025-09-30 04:01:04 UTC (rev 7523)
+++ teem/trunk/python/ctypes/gen-teem.py 2025-09-30 04:02:23 UTC (rev 7524)
@@ -60,7 +60,7 @@
echo === DYLD_LIBRARY_PATH is obviously Mac specific, please fix
setenv DYLD_LIBRARY_PATH ${TEEM}/lib
python ${CTYPES}/scripts/xml2py.py teem.xml -llibteem.dylib -o pre-teem.py -m stdio \
- -r "(air|hest|biff|nrrd|ell|moss|unrrdu|alan|tijk|gage|dye|bane|limn|echo|hoover|seek|ten|elf|pull|coil|push|mite|meet).*"
+ -r "(air|biff|hest|nrrd|ell|moss|unrrdu|alan|tijk|gage|dye|bane|limn|echo|hoover|seek|ten|elf|pull|coil|push|mite|meet).*"
rm -rf teemincl
@@ -76,7 +76,7 @@
sys.exit("usage: gen-teem.py <ctypeslib-gccxml source dir> <teem install dir>")
## (TEEM_LIB_LIST)
-libs_list = ["air", "hest", "biff", "nrrd", "ell", "moss", "unrrdu", "alan", "tijk", "gage", "dye", "bane", "limn", "echo", "hoover", "seek", "ten", "elf", "pull", "coil", "push", "mite", "meet"]
+libs_list = ["air", "biff", "hest", "nrrd", "ell", "moss", "unrrdu", "alan", "tijk", "gage", "dye", "bane", "limn", "echo", "hoover", "seek", "ten", "elf", "pull", "coil", "push", "mite", "meet"]
#
# validate os
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 04:01:06
|
Revision: 7523
http://sourceforge.net/p/teem/code/7523
Author: kindlmann
Date: 2025-09-30 04:01:04 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
tweaking lib ordering
Modified Paths:
--------------
teem/trunk/src/alan/GNUmakefile
teem/trunk/src/meet/GNUmakefile
Modified: teem/trunk/src/alan/GNUmakefile
===================================================================
--- teem/trunk/src/alan/GNUmakefile 2025-09-30 03:34:41 UTC (rev 7522)
+++ teem/trunk/src/alan/GNUmakefile 2025-09-30 04:01:04 UTC (rev 7523)
@@ -42,7 +42,7 @@
#### Describe library L here
####
####
-$(L).Depends = air biff ell nrrd
+$(L).Depends = nrrd ell biff air
$(L).PublicHdr = alan.h
$(L).PrivateHdr =
$(L).Obj = $(patsubst %.c,%.o, \
Modified: teem/trunk/src/meet/GNUmakefile
===================================================================
--- teem/trunk/src/meet/GNUmakefile 2025-09-30 03:34:41 UTC (rev 7522)
+++ teem/trunk/src/meet/GNUmakefile 2025-09-30 04:01:04 UTC (rev 7523)
@@ -43,7 +43,7 @@
####
####
# TEEM_LIB_LIST (except meet)
-$(L).Depends = air hest biff nrrd ell moss unrrdu alan tijk gage dye bane limn echo hoover seek ten elf pull coil push mite
+$(L).Depends = air biff hest nrrd ell moss unrrdu alan tijk gage dye bane limn echo hoover seek ten elf pull coil push mite
$(L).PublicHdr = meet.h
$(L).PrivateHdr =
$(L).Obj = $(patsubst %.c,%.o, \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-30 03:34:44
|
Revision: 7522
http://sourceforge.net/p/teem/code/7522
Author: kindlmann
Date: 2025-09-30 03:34:41 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
another error check
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-29 08:20:17 UTC (rev 7521)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 03:34:41 UTC (rev 7522)
@@ -1220,6 +1220,10 @@
}
for (uint opi = 0; opi < optNum; opi++) {
identStr(ident, hopt + opi);
+ if (hestSourceUnknown == hopt[opi].source) {
+ biffAddf(HEST, "%s%s%s[%u] does not have a source set?", _ME_, ident, opi);
+ return 1;
+ }
/* (Yes, half of this test is redundant with check above on whether the default
string supplied at least hopt[opi].min args, but erring with doing more checks).
Now that we've made a hopt[opi].havec array, and will soon parse strings to set
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-29 08:20:20
|
Revision: 7521
http://sourceforge.net/p/teem/code/7521
Author: kindlmann
Date: 2025-09-29 08:20:17 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
now with clang-format
Modified Paths:
--------------
teem/trunk/src/ell/quat.c
teem/trunk/src/hest/hest.h
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/parseHest.c
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/usage.c
Modified: teem/trunk/src/ell/quat.c
===================================================================
--- teem/trunk/src/ell/quat.c 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/ell/quat.c 2025-09-29 08:20:17 UTC (rev 7521)
@@ -388,8 +388,8 @@
ELL_3V_SET(axis, 1.0f, 0.0f, 0.0f); \
} \
sb = AIR_CAST(type, sin(b)); \
- ELL_4V_SET(q2, AIR_CAST(type, ea *cos(b)), ea *sb *axis[0], ea *sb *axis[1], \
- ea *sb *axis[2])
+ ELL_4V_SET(q2, AIR_CAST(type, ea *cos(b)), ea * sb * axis[0], ea * sb * axis[1], \
+ ea * sb * axis[2])
void
ell_q_exp_f(float q2[4], const float q1[4]) {
Modified: teem/trunk/src/hest/hest.h
===================================================================
--- teem/trunk/src/hest/hest.h 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/hest/hest.h 2025-09-29 08:20:17 UTC (rev 7521)
@@ -212,15 +212,15 @@
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 */
+ 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 added here (by _hestParseSingle[type]) with
@@ -229,7 +229,7 @@
had fussy semantics that complicated hestParseFree()'s work.
Now hestParseFree just calls airMopDone on all these (non-NULL)
per-option parseMops. */
- hestArgVec *havec; // the (non-flag) parm args attributed to this option
+ 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
@@ -381,7 +381,8 @@
HEST_EXPORT unsigned int hestOptNum(const hestOpt *hopt);
HEST_EXPORT hestOpt *hestOptFree(hestOpt *hopt);
HEST_EXPORT int hestOptCheck(const hestOpt *hopt, char **errP);
-HEST_EXPORT int hestOptParmCheck(const hestOpt *hopt, const hestParm *hparm, char **errP);
+HEST_EXPORT int hestOptParmCheck(const hestOpt *hopt, const hestParm *hparm,
+ char **errP);
// parseHest.c
HEST_EXPORT int hestParse(hestOpt *hopt, int argc, const char **argv, char **errP,
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-29 08:20:17 UTC (rev 7521)
@@ -170,7 +170,8 @@
strlen(str) + strlen(hpp->hopt->CB->type) + 100));
} else {
snprintf(hpp->err, AIR_STRLEN_HUGE + 1,
- "error parsing \"%s\" as %s: returned %d\n", str, hpp->hopt->CB->type, ret);
+ "error parsing \"%s\" as %s: returned %d\n", str, hpp->hopt->CB->type,
+ ret);
}
} else {
if (hpp->hopt->CB->destroy) {
@@ -177,7 +178,8 @@
/* out is the address of a void*, we manage the void* */
if (!hpp->hopt->parseMop) hpp->hopt->parseMop = airMopNew();
airMopAdd(hpp->hopt->parseMop, (void **)out, (airMopper)airSetNull, airMopAlways);
- airMopAdd(hpp->hopt->parseMop, *((void **)out), hpp->hopt->CB->destroy, airMopAlways);
+ airMopAdd(hpp->hopt->parseMop, *((void **)out), hpp->hopt->CB->destroy,
+ airMopAlways);
}
}
return ret;
@@ -451,7 +453,7 @@
hopt->enm = NULL;
hopt->CB = NULL;
hopt->sawP = NULL;
- hopt->kind = 0; /* means that this hestOpt has not been set */
+ hopt->kind = 0; /* means that this hestOpt has not been set */
hopt->parseMop = NULL; // will create with airMopNew() only as needed
hopt->havec = NULL;
hopt->arrAlloc = hopt->arrLen = 0;
@@ -536,14 +538,14 @@
hopt->kind = minmaxKind(min, max);
// deal with (what used to be) var args
hopt->sawP = (5 == hopt->kind /* */
- ? sawP
+ ? sawP
+ : NULL);
+ hopt->enm = (airTypeEnum == type /* */
+ ? enm
: NULL);
- hopt->enm = (airTypeEnum == type /* */
- ? enm
+ hopt->CB = (airTypeOther == type /* */
+ ? CB
: NULL);
- hopt->CB = (airTypeOther == type /* */
- ? CB
- : NULL);
// hopt->parseMop may be added to by hestParse and the parseSingleT functions it calls
hopt->havec = hestArgVecNew();
// leave arrAlloc, arrLen untouched: managed by caller
@@ -584,7 +586,7 @@
retIdx = optarrIncr(hoptP);
/* set all elements of the opt */
hestOptSingleSet(*hoptP + retIdx, flag, name, type, min, max, /* */
- valueP, dflt, info, /* */
+ valueP, dflt, info, /* */
sawP, enm, CB);
return retIdx;
}
@@ -635,7 +637,7 @@
va_end(ap);
}
return hestOptAdd_nva(hoptP, flag, name, type, min, max, /* */
- valueP, dflt, info, /* */
+ valueP, dflt, info, /* */
sawP, enm, CB);
}
Modified: teem/trunk/src/hest/parseHest.c
===================================================================
--- teem/trunk/src/hest/parseHest.c 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/hest/parseHest.c 2025-09-29 08:20:17 UTC (rev 7521)
@@ -1172,7 +1172,8 @@
case airTypeOther:
cP = (char *)(*((void **)vP));
optParmsCopy = airStrdup(optParms[op]);
- /* opt[op].alloc = (opt[op].CB->destroy ? 3 : 1); SORRY old code will leak */
+ /* opt[op].alloc = (opt[op].CB->destroy ? 3 : 1); SORRY old code will leak
+ */
for (p = 0; p < (int)optParmNum[op]; p++) { /* HEY scrutinize casts */
tok = airStrtok(!p ? optParmsCopy : NULL, " ", &last);
/* (Note from 2023-06-24: "hammerhead" was hammerhead.ucsd.edu, an Intel
@@ -1453,17 +1454,18 @@
hestOpt *
hestParseFree(hestOpt *opt) {
if (opt) {
- uint optNum = opt->arrLen;
- for (uint opi = 0; opi < optNum; opi++) {
- airArrayLenSet(opt[opi].havec->hargArr, 0); // but not hestArgVecNix(opt[opi].havec);
- opt[opi].parmStr = airFree(opt[opi].parmStr);
- /* this gloriously replaces what used to be a lot of dense logic around
- opt[opi].alloc, opt[opi].type, and opt[opi].CB->destroy */
- if (opt[opi].parseMop) {
- opt[opi].parseMop = airMopOkay(opt[opi].parseMop);
+ uint optNum = opt->arrLen;
+ for (uint opi = 0; opi < optNum; opi++) {
+ airArrayLenSet(opt[opi].havec->hargArr,
+ 0); // but not hestArgVecNix(opt[opi].havec);
+ opt[opi].parmStr = airFree(opt[opi].parmStr);
+ /* this gloriously replaces what used to be a lot of dense logic around
+ opt[opi].alloc, opt[opi].type, and opt[opi].CB->destroy */
+ if (opt[opi].parseMop) {
+ opt[opi].parseMop = airMopOkay(opt[opi].parseMop);
+ }
}
}
- }
return opt;
}
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/hest/parsest.c 2025-09-29 08:20:17 UTC (rev 7521)
@@ -976,7 +976,7 @@
havecExtractUnflagged(hestOpt *hopt, hestArgVec *havec, const hestParm *hparm) {
char *havStr = NULL, ident[AIR_STRLEN_HUGE + 1];
uint optNum = hopt->arrLen; // number of options (flagged or unflagged)
- uint ufOptNum = 0; // number of unflagged options
+ uint ufOptNum = 0; // number of unflagged options
for (uint opi = 0; opi < optNum; opi++) {
if (!hopt[opi].flag) {
ufOptNum += 1;
@@ -1048,7 +1048,8 @@
if (havecTransfer(hopt + opi, havec, 0, hopt[opi].min, hparm)) {
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for %sunflagged %s[%u]", _ME_,
- !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi), opi);
+ !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi),
+ opi);
return (free(havStr), free(ufOpi2), 1);
}
havStr = airFree(havStr);
@@ -1078,7 +1079,8 @@
if (havecTransfer(hopt + opi, havec, idx0, hopt[opi].min, hparm)) {
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for (later) %sunflagged %s[%u]", _ME_,
- !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi), opi);
+ !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi),
+ opi);
return (free(havStr), free(ufOpi2), 1);
}
havStr = airFree(havStr);
@@ -1103,7 +1105,7 @@
// else minArg <= havec->len, or, minArg > havec->len and do have default
if (minArg <= havec->len) {
// can satisfy option from havec, no need to use default
- uint getArg = havec->len; // want to grab as many args as possible
+ uint getArg = havec->len; // want to grab as many args as possible
if (-1 != hopt[ufVarOpi].max) { // but no more than the option asks for
getArg = AIR_MIN(getArg, AIR_UINT(hopt[ufVarOpi].max));
}
@@ -1151,8 +1153,8 @@
/* optProcessDefaults
All the command-line arguments (and any response files invoked therein) should now be
-processed (by transferring the arguments to per-option hopt->havec arrays), but we need to
-ensure that every option has information from which to set values. The per-option
+processed (by transferring the arguments to per-option hopt->havec arrays), but we need
+to ensure that every option has information from which to set values. The per-option
hopt->dflt string is what we look to now, to finish setting per-option hopt->havec arrays
for all the options for which hopt->havec have not already been set. We use
`!hopt->source` (aka hestSourceUnknown) as the indicator of not already being set.
@@ -1175,9 +1177,9 @@
hopt[opi].source = hestSourceDefault;
if (1 == hopt[opi].kind) {
/* There is no meaningful "default" for stand-alone flags (and in fact
- hopt[opi].dflt is enforced to be NULL) so there is no default string to tokenize,
- but we above set source to default for sake of completeness, and to signal that
- the flag was not given by user */
+ hopt[opi].dflt is enforced to be NULL) so there is no default string to
+ tokenize, but we above set source to default for sake of completeness, and to
+ signal that the flag was not given by user */
goto nextopt;
}
identStr(ident, hopt + opi);
@@ -1188,9 +1190,9 @@
return 1;
}
/* in some circumstances the default may be empty "", even if non-NULL, which means
- that no args will be put into hopt[opi].havec, and that's okay, but that's part of why
- we set the source above to hestSourceDefault, so that we'd know the source even if it
- isn't apparent in any of the (non-existant) args. */
+ that no args will be put into hopt[opi].havec, and that's okay, but that's part of
+ why we set the source above to hestSourceDefault, so that we'd know the source even
+ if it isn't apparent in any of the (non-existant) args. */
if (hparm->verbosity) {
printf("%s: looking at %s[%u] default string |%s|\n", __func__, ident, opi,
hopt[opi].dflt);
@@ -1354,8 +1356,7 @@
return 1;
}
}
- }
- break;
+ } break;
// (case 4 handled above)
case 5: { // -------- multiple variadic parameters --------
// we allocate the array to hold multiple values
@@ -1389,8 +1390,7 @@
char **argv = (char **)cvalueP;
argv[hopt[opi].havec->len] = NULL;
}
- }
- break;
+ } break;
} // end switch
} // for opi ...
return 0;
Modified: teem/trunk/src/hest/usage.c
===================================================================
--- teem/trunk/src/hest/usage.c 2025-09-29 08:13:39 UTC (rev 7520)
+++ teem/trunk/src/hest/usage.c 2025-09-29 08:20:17 UTC (rev 7521)
@@ -305,7 +305,7 @@
(airTypeEnum == hopt[i].type
? hopt[i].enm->name
: (airTypeOther == hopt[i].type ? hopt[i].CB->type
- : _hestTypeStr[hopt[i].type])),
+ : _hestTypeStr[hopt[i].type])),
(_hestMax(hopt[i].max) > 1
? (airTypeOther == hopt[i].type
&& 'y' == hopt[i].CB->type[airStrlen(hopt[i].CB->type) - 1]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-29 08:13:42
|
Revision: 7520
http://sourceforge.net/p/teem/code/7520
Author: kindlmann
Date: 2025-09-29 08:13:39 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
The new implementation of hestParse, currently called hestParse2, seems to
finally be working. The old hestParse remains, although with some of the
changes below it may leak memory in ways it previously didn't. After further
debugging it will be removed (so parseHest.c) will be much shorter.
- ABI CHANGE: since hest's birth, the hestOpt struct has had an `int alloc`
that helped keep track of what was allocated as a result of parsing, and what
had to be freed. It could take on magic values 1, 2, 3, or 4, and the logic
that hestParseFree had to implement to keep track of all this (in a way that
depended on the option type, and the non-NULL-ity of CB->destroy in the case
of airTypeOther) was just hideous. Instead, now a `airArray *parseMop` is
used, to remember what needs to be freed. Free'ing or destroy'ing callbacks
added here (by _hestParseSingle[type]) with when=airMopAlways. And now,
hestParse(2) just adds hestParseFree to its in-case-of-error mop. This is so
so much simpler and easier than the original code.
- API CHANGE: hestParseFree now returns the the given `hestOpt *hopt`, instead
of void. This facilitates its use in mops.
- API CHANGE: removed the void*-taking-and-returning hestParmFree_vp and
hestOptFree_vp. These were experiments to make their use with an airMop less
clunky, because you no longer need the `(airMopper)` cast, but this was a
dumb idea: adding these _vp variants is work, so hundreds of other functions
in Teem do not have such a _vp variant, plus the `(airMopper)` cast idiom
is well-established.
- in many functions renamed parameter `hestOpt *opt` to `hestOpt *hopt`
for consistency with other hest parameters and variables
Modified Paths:
--------------
teem/trunk/src/hest/hest.h
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/parseHest.c
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/privateHest.h
teem/trunk/src/hest/test/ex6.c
teem/trunk/src/hest/usage.c
Modified: teem/trunk/src/hest/hest.h
===================================================================
--- teem/trunk/src/hest/hest.h 2025-09-29 07:59:10 UTC (rev 7519)
+++ teem/trunk/src/hest/hest.h 2025-09-29 08:13:39 UTC (rev 7520)
@@ -212,7 +212,7 @@
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:
+ 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
@@ -221,15 +221,14 @@
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 */
- alloc; /* Information (set by hestParse) about how (if at all) 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 */
+ 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
+ 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. */
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
@@ -258,8 +257,8 @@
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" from the string
- here. */
+ 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
@@ -360,9 +359,8 @@
HEST_EXPORT int hestSourceUser(int src);
HEST_EXPORT hestParm *hestParmNew(void);
HEST_EXPORT hestParm *hestParmFree(hestParm *hparm);
-HEST_EXPORT void *hestParmFree_vp(void *hparm);
HEST_EXPORT int hestParmColumnsIoctl(hestParm *hparm, unsigned int nonIoctlColumns);
-HEST_EXPORT void hestOptSingleSet(hestOpt *opt, const char *flag, const char *name,
+HEST_EXPORT 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);
@@ -380,30 +378,29 @@
... /* unsigned int *sawP,
const airEnum *enm,
const hestCB *CB */);
-HEST_EXPORT unsigned int hestOptNum(const hestOpt *opt);
-HEST_EXPORT hestOpt *hestOptFree(hestOpt *opt);
-HEST_EXPORT void *hestOptFree_vp(void *opt);
-HEST_EXPORT int hestOptCheck(const hestOpt *opt, char **errP);
-HEST_EXPORT int hestOptParmCheck(const hestOpt *opt, const hestParm *hparm, char **errP);
+HEST_EXPORT unsigned int hestOptNum(const hestOpt *hopt);
+HEST_EXPORT hestOpt *hestOptFree(hestOpt *hopt);
+HEST_EXPORT int hestOptCheck(const hestOpt *hopt, char **errP);
+HEST_EXPORT int hestOptParmCheck(const hestOpt *hopt, const hestParm *hparm, char **errP);
// parseHest.c
-HEST_EXPORT int hestParse(hestOpt *opt, int argc, const char **argv, char **errP,
+HEST_EXPORT int hestParse(hestOpt *hopt, int argc, const char **argv, char **errP,
const hestParm *hparm);
-HEST_EXPORT void *hestParseFree(hestOpt *opt);
-HEST_EXPORT void hestParseOrDie(hestOpt *opt, int argc, const char **argv,
+HEST_EXPORT hestOpt *hestParseFree(hestOpt *hopt);
+HEST_EXPORT void hestParseOrDie(hestOpt *hopt, int argc, const char **argv,
hestParm *hparm, const char *me, const char *info,
int doInfo, int doUsage, int doGlossary);
// parsest.c
-HEST_EXPORT int hestParse2(hestOpt *opt, int argc, const char **argv, char **errP,
+HEST_EXPORT int hestParse2(hestOpt *hopt, int argc, const char **argv, char **errP,
const hestParm *hparm);
// usage.c
HEST_EXPORT void _hestPrintStr(FILE *f, unsigned int indent, unsigned int already,
unsigned int width, const char *_str, int bslash);
-HEST_EXPORT void hestUsage(FILE *file, const hestOpt *opt, const char *argv0,
+HEST_EXPORT void hestUsage(FILE *file, const hestOpt *hopt, const char *argv0,
const hestParm *hparm);
-HEST_EXPORT void hestGlossary(FILE *file, const hestOpt *opt, const hestParm *hparm);
+HEST_EXPORT void hestGlossary(FILE *file, const hestOpt *hopt, const hestParm *hparm);
HEST_EXPORT void hestInfo(FILE *file, const char *argv0, const char *info,
const hestParm *hparm);
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-29 07:59:10 UTC (rev 7519)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-29 08:13:39 UTC (rev 7520)
@@ -72,9 +72,9 @@
tokens, and to properly tokenize default strings and response files, we should stop using
the airParseStrT functions that internally use airStrtok(): we have exactly one token to
parse. These functions thus return non-zero in case of error, instead of returning the
-number of parsed values. See also comment about _hestP(arse)Pack in privateHest.h */
+number of parsed values. See also comment about _hestP(arse)Pair in privateHest.h */
static int
-parseSingleB(void *_out, const char *str, _hestPPack *hpp) {
+parseSingleB(void *_out, const char *str, _hestPPair *hpp) {
if (!(_out && str && hpp)) return 1;
int *out = (int *)_out;
*out = airEnumVal(airBool, str);
@@ -88,7 +88,7 @@
return ret;
}
-#define _PARSE_1_ARGS void *out, const char *str, _hestPPack *hpp
+#define _PARSE_1_ARGS void *out, const char *str, _hestPPair *hpp
#define _PARSE_1_BODY(typstr, format) \
if (!(out && str && hpp)) return 1; \
int ret = (1 != airSingleSscanf(str, format, out)); \
@@ -111,7 +111,7 @@
static int parseSingleD (_PARSE_1_ARGS) { _PARSE_1_BODY("double", "%lf"); }
// clang-format on
static int
-parseSingleC(void *_out, const char *str, _hestPPack *hpp) {
+parseSingleC(void *_out, const char *str, _hestPPair *hpp) {
if (!(_out && str && hpp)) return 1;
size_t slen = strlen(str);
int ret;
@@ -129,7 +129,7 @@
return ret;
}
static int
-parseSingleS(void *_out, const char *str, _hestPPack *hpp) {
+parseSingleS(void *_out, const char *str, _hestPPair *hpp) {
if (!(_out && str && hpp)) return 1;
char **out = (char **)_out;
*out = airStrdup(str);
@@ -137,21 +137,21 @@
if (ret) {
snprintf(hpp->err, AIR_STRLEN_HUGE + 1, "airStrdup failed!");
} else {
- hpp->alloc = 1;
- airMopMem(hpp->cmop, *out, airMopOnError);
+ if (!hpp->hopt->parseMop) hpp->hopt->parseMop = airMopNew();
+ airMopMem(hpp->hopt->parseMop, out, airMopAlways);
hpp->err[0] = '\0';
}
return ret;
}
static int
-parseSingleE(void *_out, const char *str, _hestPPack *hpp) {
+parseSingleE(void *_out, const char *str, _hestPPair *hpp) {
if (!(_out && str && hpp)) return 1;
int *out = (int *)_out;
- *out = airEnumVal(hpp->enm, str);
- int ret = (airEnumUnknown(hpp->enm) == *out);
+ *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->enm->name);
+ hpp->hopt->enm->name);
} else {
hpp->err[0] = '\0';
}
@@ -158,32 +158,32 @@
return ret;
}
static int
-parseSingleO(void *out, const char *str, _hestPPack *hpp) {
+parseSingleO(void *out, const char *str, _hestPPair *hpp) {
if (!(out && str && hpp)) return 1;
char myerr[AIR_STRLEN_HUGE + 1];
- int ret = hpp->CB->parse(out, str, myerr);
+ 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->CB->type,
- airStrtrunc(myerr, AIR_STRLEN_HUGE + 1,
- strlen(str) + strlen(hpp->CB->type) + 100));
+ hpp->hopt->CB->type,
+ airStrunc(myerr, AIR_STRLEN_HUGE + 1,
+ strlen(str) + strlen(hpp->hopt->CB->type) + 100));
} else {
snprintf(hpp->err, AIR_STRLEN_HUGE + 1,
- "error parsing \"%s\" as %s: returned %d\n", str, hpp->CB->type, ret);
+ "error parsing \"%s\" as %s: returned %d\n", str, hpp->hopt->CB->type, ret);
}
} else {
- if (hpp->CB->destroy) {
+ if (hpp->hopt->CB->destroy) {
/* out is the address of a void*, we manage the void* */
- hpp->alloc = 1;
- airMopAdd(hpp->cmop, (void **)out, (airMopper)airSetNull, airMopOnError);
- airMopAdd(hpp->cmop, *((void **)out), hpp->CB->destroy, airMopOnError);
+ if (!hpp->hopt->parseMop) hpp->hopt->parseMop = airMopNew();
+ airMopAdd(hpp->hopt->parseMop, (void **)out, (airMopper)airSetNull, airMopAlways);
+ airMopAdd(hpp->hopt->parseMop, *((void **)out), hpp->hopt->CB->destroy, airMopAlways);
}
}
return ret;
}
-int (*const _hestParseSingle[_HEST_TYPE_MAX + 1])(void *, const char *, _hestPPack *) = {
+int (*const _hestParseSingle[_HEST_TYPE_MAX + 1])(void *, const char *, _hestPPair *) = {
NULL, //
parseSingleB, //
parseSingleH, //
@@ -438,26 +438,26 @@
/* initializes all of a hestOpt, even arrAlloc and arrLen */
static void
-optInit(hestOpt *opt) {
+optInit(hestOpt *hopt) {
- opt->flag = NULL;
- opt->name = NULL;
- opt->type = airTypeUnknown; /* h== 0 */
- opt->min = 0;
- opt->max = 0;
- opt->valueP = NULL;
- opt->dflt = opt->info = NULL;
- opt->sawP = NULL;
- opt->enm = NULL;
- opt->CB = NULL;
- opt->sawP = NULL;
- opt->kind = 0; /* means that this hestOpt has not been set */
- opt->alloc = 0;
- opt->havec = NULL;
- opt->arrAlloc = opt->arrLen = 0;
- opt->source = hestSourceUnknown;
- opt->parmStr = NULL;
- opt->helpWanted = AIR_FALSE;
+ hopt->flag = NULL;
+ hopt->name = NULL;
+ hopt->type = airTypeUnknown; /* h== 0 */
+ hopt->min = 0;
+ hopt->max = 0;
+ hopt->valueP = NULL;
+ hopt->dflt = hopt->info = NULL;
+ hopt->sawP = NULL;
+ hopt->enm = NULL;
+ hopt->CB = NULL;
+ hopt->sawP = NULL;
+ hopt->kind = 0; /* means that this hestOpt has not been set */
+ hopt->parseMop = NULL; // will create with airMopNew() only as needed
+ hopt->havec = NULL;
+ hopt->arrAlloc = hopt->arrLen = 0;
+ hopt->source = hestSourceUnknown;
+ hopt->parmStr = NULL;
+ hopt->helpWanted = AIR_FALSE;
}
/*
@@ -469,8 +469,8 @@
terminating hestOpt, but with the introduction of arrAlloc and arrLen that is moot.
*/
unsigned int
-hestOptNum(const hestOpt *opt) {
- return opt ? opt->arrLen : 0;
+hestOptNum(const hestOpt *hopt) {
+ return hopt ? hopt->arrLen : 0;
}
/* like airArrayNew: create an initial segment of the hestOpt array */
@@ -518,39 +518,39 @@
*THIS* is the function that sets opt->kind.
*/
void
-hestOptSingleSet(hestOpt *opt, const char *flag, const char *name, int type,
+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) {
- if (!opt) return;
- opt->flag = airStrdup(flag);
- opt->name = airStrdup(name);
- opt->type = type;
- opt->min = min;
- opt->max = max;
- opt->valueP = valueP;
- opt->dflt = airStrdup(dflt);
- opt->info = airStrdup(info);
+ if (!hopt) return;
+ hopt->flag = airStrdup(flag);
+ hopt->name = airStrdup(name);
+ hopt->type = type;
+ hopt->min = min;
+ hopt->max = max;
+ hopt->valueP = valueP;
+ hopt->dflt = airStrdup(dflt);
+ hopt->info = airStrdup(info);
// need to set kind now so can be used in later conditionals
- opt->kind = minmaxKind(min, max);
+ hopt->kind = minmaxKind(min, max);
// deal with (what used to be) var args
- opt->sawP = (5 == opt->kind /* */
+ hopt->sawP = (5 == hopt->kind /* */
? sawP
: NULL);
- opt->enm = (airTypeEnum == type /* */
+ hopt->enm = (airTypeEnum == type /* */
? enm
: NULL);
- opt->CB = (airTypeOther == type /* */
+ hopt->CB = (airTypeOther == type /* */
? CB
: NULL);
- // alloc set by hestParse
- opt->havec = hestArgVecNew();
+ // hopt->parseMop may be added to by hestParse and the parseSingleT functions it calls
+ hopt->havec = hestArgVecNew();
// leave arrAlloc, arrLen untouched: managed by caller
// yes, redundant with optInit()
- opt->source = hestSourceUnknown;
- opt->parmStr = NULL;
- opt->helpWanted = AIR_FALSE;
+ hopt->source = hestSourceUnknown;
+ hopt->parmStr = NULL;
+ hopt->helpWanted = AIR_FALSE;
return;
}
@@ -568,7 +568,7 @@
done later, in _hestOPCheck.
*/
unsigned int
-hestOptAdd_nva(hestOpt **optP, const char *flag, const char *name, int type,
+hestOptAdd_nva(hestOpt **hoptP, 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) {
@@ -575,15 +575,15 @@
unsigned int retIdx;
/* NULL address of opt array: can't proceed */
- if (!optP) return UINT_MAX;
+ if (!hoptP) return UINT_MAX;
/* initialize hestOpt array if necessary */
- if (!(*optP)) {
- optarrNew(optP);
+ if (!(*hoptP)) {
+ optarrNew(hoptP);
}
/* increment logical length of hestOpt array; return index of opt being set here */
- retIdx = optarrIncr(optP);
+ retIdx = optarrIncr(hoptP);
/* set all elements of the opt */
- hestOptSingleSet(*optP + retIdx, flag, name, type, min, max, /* */
+ hestOptSingleSet(*hoptP + retIdx, flag, name, type, min, max, /* */
valueP, dflt, info, /* */
sawP, enm, CB);
return retIdx;
@@ -606,7 +606,7 @@
* parsed. Returns UINT_MAX in case of error.
*/
unsigned int
-hestOptAdd(hestOpt **optP, const char *flag, const char *name, int type,
+hestOptAdd(hestOpt **hoptP, const char *flag, const char *name, int type,
unsigned int min, int max, void *valueP, const char *dflt, const char *info,
...) {
unsigned int *sawP = NULL;
@@ -614,7 +614,7 @@
const hestCB *CB = NULL;
va_list ap;
- if (!optP) return UINT_MAX;
+ if (!hoptP) return UINT_MAX;
/* deal with var args */
if (5 == minmaxKind(min, max)) {
va_start(ap, info);
@@ -634,30 +634,33 @@
CB = va_arg(ap, hestCB *);
va_end(ap);
}
- return hestOptAdd_nva(optP, flag, name, type, min, max, /* */
+ return hestOptAdd_nva(hoptP, flag, name, type, min, max, /* */
valueP, dflt, info, /* */
sawP, enm, CB);
}
static void
-_hestOptFree(hestOpt *opt) {
+_hestOptFree(hestOpt *hopt) {
- opt->flag = (char *)airFree(opt->flag);
- opt->name = (char *)airFree(opt->name);
- opt->dflt = (char *)airFree(opt->dflt);
- opt->info = (char *)airFree(opt->info);
- opt->havec = hestArgVecNix(opt->havec);
+ hopt->flag = (char *)airFree(hopt->flag);
+ hopt->name = (char *)airFree(hopt->name);
+ hopt->dflt = (char *)airFree(hopt->dflt);
+ hopt->info = (char *)airFree(hopt->info);
+ if (hopt->parseMop) {
+ hopt->parseMop = airMopOkay(hopt->parseMop);
+ }
+ hopt->havec = hestArgVecNix(hopt->havec);
return;
}
hestOpt *
-hestOptFree(hestOpt *opt) {
- if (!opt) return NULL;
- uint num = opt->arrLen;
+hestOptFree(hestOpt *hopt) {
+ if (!hopt) return NULL;
+ uint num = hopt->arrLen;
for (uint opi = 0; opi < num; opi++) {
- _hestOptFree(opt + opi);
+ _hestOptFree(hopt + opi);
}
- free(opt);
+ free(hopt);
return NULL;
}
@@ -664,7 +667,7 @@
/* _hestOPCheck
New biff-based container for all logic that originated in _hestOptCheck (which is the
2025 rename of what had long been called _hestPanic): the validation of the given hestOpt
-array `opt` itself (but *not* anything about the command-line or its parsing), relative
+array `hopt` itself (but *not* anything about the command-line or its parsing), relative
to the given (non-NULL) hestParm `hparm`.
Pre-2025, hest did not depend on biff, and this instead took a 'char *err' that somehow
@@ -684,54 +687,54 @@
more appropriately done at the time the option is added.
*/
int
-_hestOPCheck(const hestOpt *opt, const hestParm *hparm) {
- if (!(opt && hparm)) {
- biffAddf(HEST, "%s%sgot NULL opt (%p) or hparm (%p)", _ME_, AIR_VOIDP(opt),
+_hestOPCheck(const hestOpt *hopt, const hestParm *hparm) {
+ if (!(hopt && hparm)) {
+ biffAddf(HEST, "%s%sgot NULL hopt (%p) or hparm (%p)", _ME_, AIR_VOIDP(hopt),
AIR_VOIDP(hparm));
return 1;
}
- uint optNum = opt->arrLen;
+ uint optNum = hopt->arrLen;
uint ufvarNum = 0; // number of unflagged variadic-parameter options
for (uint opi = 0; opi < optNum; opi++) {
- if (!(AIR_IN_OP(airTypeUnknown, opt[opi].type, airTypeLast))) {
+ if (!(AIR_IN_OP(airTypeUnknown, hopt[opi].type, airTypeLast))) {
biffAddf(HEST, "%s%sopt[%u].type (%d) not in valid range [%d,%d]", _ME_, opi,
- opt[opi].type, airTypeUnknown + 1, airTypeLast - 1);
+ hopt[opi].type, airTypeUnknown + 1, airTypeLast - 1);
return 1;
}
// `kind` set by hestOptSingleSet
- if (-1 == opt[opi].kind) {
+ if (-1 == hopt[opi].kind) {
biffAddf(HEST, "%s%sopt[%u]'s min (%d) and max (%d) incompatible", _ME_, opi,
- opt[opi].min, opt[opi].max);
+ hopt[opi].min, hopt[opi].max);
return 1;
}
- if (!(opt[opi].valueP)) {
+ if (!(hopt[opi].valueP)) {
biffAddf(HEST, "%s%sopt[%u]'s valueP is NULL!", _ME_, opi);
return 1;
}
- if (1 == opt[opi].kind) {
- if (!opt[opi].flag) {
+ if (1 == hopt[opi].kind) {
+ if (!hopt[opi].flag) {
biffAddf(HEST, "%s%sstand-alone flag opt[%u] must have a flag", _ME_, opi);
return 1;
}
- if (opt[opi].dflt) {
+ if (hopt[opi].dflt) {
biffAddf(HEST, "%s%sstand-alone flag (opt[%u] %s) should not have a default",
- _ME_, opi, opt[opi].flag);
+ _ME_, opi, hopt[opi].flag);
return 1;
}
- if (opt[opi].name) {
+ if (hopt[opi].name) {
biffAddf(HEST, "%s%sstand-alone flag (opt[%u] %s) should not have a name", _ME_,
- opi, opt[opi].flag);
+ opi, hopt[opi].flag);
return 1;
}
- } else { // ------ end of if (1 == opt[opi].kind)
- if (!opt[opi].name) {
+ } else { // ------ end of if (1 == hopt[opi].kind)
+ if (!hopt[opi].name) {
biffAddf(HEST, "%s%sopt[%u] isn't stand-alone flag: must have \"name\"", _ME_,
opi);
return 1;
}
}
- if (opt[opi].flag) {
- const char *flag = opt[opi].flag;
+ if (hopt[opi].flag) {
+ const char *flag = hopt[opi].flag;
uint fslen = AIR_UINT(strlen(flag));
if (fslen > AIR_STRLEN_SMALL / 2) {
biffAddf(HEST, "%s%sstrlen(opt[%u].flag) %u is too big", _ME_, opi, fslen);
@@ -782,7 +785,7 @@
return (free(tbuff), 1);
}
} else {
- if (!strlen(opt[opi].flag)) {
+ if (!strlen(hopt[opi].flag)) {
biffAddf(HEST, "%s%sopt[%u].flag is zero length", _ME_, opi);
return (free(tbuff), 1);
}
@@ -795,106 +798,106 @@
_ME_, opi, flag);
return (free(tbuff), 1);
}
- } else { // ------ end of if (opt[opi].flag)
- // opt[opi] is unflagged
- if (!opt[opi].min) {
+ } else { // ------ end of if (hopt[opi].flag)
+ // hopt[opi] is unflagged
+ if (!hopt[opi].min) {
// this rules out all unflagged kind 1 and kind 4
// and prevents unflagged kind 5 w/ min=0
biffAddf(HEST, "%s%sunflagged opt[%u] (name %s) must have min >= 1, not 0", _ME_,
- opi, opt[opi].name ? opt[opi].name : "not set");
+ opi, hopt[opi].name ? hopt[opi].name : "not set");
return 1;
}
}
- if (4 == opt[opi].kind) { // single variadic parameter
+ if (4 == hopt[opi].kind) { // single variadic parameter
// immediately above have just ruled out unflagged kind 4
- if (!opt[opi].dflt) {
+ if (!hopt[opi].dflt) {
biffAddf(HEST,
"%s%sopt[%u] -%s is single variadic parameter, but "
"no default set",
- _ME_, opi, opt[opi].flag);
+ _ME_, opi, hopt[opi].flag);
return 1;
}
- if (!(strlen(opt[opi].dflt) && _hestPlainWord(opt[opi].dflt))) {
+ if (!(strlen(hopt[opi].dflt) && _hestPlainWord(hopt[opi].dflt))) {
biffAddf(HEST,
"%s%sopt[%u] -%s is single variadic parameter, but "
"default \"%s\" needs to be non-empty single value",
- _ME_, opi, opt[opi].flag, opt[opi].dflt);
+ _ME_, opi, hopt[opi].flag, hopt[opi].dflt);
return 1;
}
/* pre 2025, these types were allowed for kind 4, but the semantics are just so
weird and thus hard to test + debug. It no longer makes sense to support them */
- if (airTypeChar == opt[opi].type || airTypeString == opt[opi].type
- || airTypeEnum == opt[opi].type || airTypeOther == opt[opi].type) {
+ if (airTypeChar == hopt[opi].type || airTypeString == hopt[opi].type
+ || airTypeEnum == hopt[opi].type || airTypeOther == hopt[opi].type) {
biffAddf(HEST,
"%s%sopt[%u] -%s is single variadic parameter, but sorry, "
"type %s no longer supported",
- _ME_, opi, opt[opi].flag, _hestTypeStr[opt[opi].type]);
+ _ME_, opi, hopt[opi].flag, _hestTypeStr[hopt[opi].type]);
return 1;
}
}
- if (5 == opt[opi].kind && !(opt[opi].sawP)) {
+ if (5 == hopt[opi].kind && !(hopt[opi].sawP)) {
biffAddf(HEST,
"%s%sopt[%u] has multiple variadic parameters (min=%u,max=%d), "
"but sawP is NULL",
- _ME_, opi, opt[opi].min, opt[opi].max);
+ _ME_, opi, hopt[opi].min, hopt[opi].max);
return 1;
}
- if (opt[opi].sawP && 5 != opt[opi].kind) {
+ if (hopt[opi].sawP && 5 != hopt[opi].kind) {
biffAddf(HEST,
"%s%sopt[%u] has non-NULL sawP but is not a (kind=5) "
"multiple variadic parm option (min=%u,max=%d)",
- _ME_, opi, opt[opi].min, opt[opi].max);
+ _ME_, opi, hopt[opi].min, hopt[opi].max);
return 1;
}
- if (airTypeEnum == opt[opi].type && !(opt[opi].enm)) {
+ if (airTypeEnum == hopt[opi].type && !(hopt[opi].enm)) {
biffAddf(HEST,
"%s%sopt[%u] (%s) is type \"enum\", but no "
"airEnum pointer given",
- _ME_, opi, opt[opi].flag ? opt[opi].flag : "unflagged");
+ _ME_, opi, hopt[opi].flag ? hopt[opi].flag : "unflagged");
return 1;
}
- if (opt[opi].enm && airTypeEnum != opt[opi].type) {
+ if (hopt[opi].enm && airTypeEnum != hopt[opi].type) {
biffAddf(HEST,
"%s%sopt[%u] (%s) has non-NULL airEnum pointer, but is not airTypeEnum",
- _ME_, opi, opt[opi].flag ? opt[opi].flag : "unflagged");
+ _ME_, opi, hopt[opi].flag ? hopt[opi].flag : "unflagged");
return 1;
}
- if (airTypeOther == opt[opi].type) {
- if (!(opt[opi].CB)) {
+ if (airTypeOther == hopt[opi].type) {
+ if (!(hopt[opi].CB)) {
biffAddf(HEST,
"%s%sopt[%u] (%s) is type \"other\", but no "
"callbacks given",
- _ME_, opi, opt[opi].flag ? opt[opi].flag : "unflagged");
+ _ME_, opi, hopt[opi].flag ? hopt[opi].flag : "unflagged");
return 1;
}
- if (!(opt[opi].CB->size > 0)) {
+ if (!(hopt[opi].CB->size > 0)) {
biffAddf(HEST, "%s%sopt[%u]'s \"size\" (%u) invalid", _ME_, opi,
- (uint)(opt[opi].CB->size));
+ (uint)(hopt[opi].CB->size));
return 1;
}
- if (!(opt[opi].CB->type)) {
+ if (!(hopt[opi].CB->type)) {
biffAddf(HEST, "%s%sopt[%u]'s \"type\" is NULL", _ME_, opi);
return 1;
}
- if (!(opt[opi].CB->parse)) {
+ if (!(hopt[opi].CB->parse)) {
biffAddf(HEST, "%s%sopt[%u]'s \"parse\" callback NULL", _ME_, opi);
return 1;
}
- if (opt[opi].CB->destroy && (sizeof(void *) != opt[opi].CB->size)) {
+ if (hopt[opi].CB->destroy && (sizeof(void *) != hopt[opi].CB->size)) {
biffAddf(HEST,
"%s%sopt[%u] has a \"destroy\", but size %lu isn't "
"sizeof(void*)",
- _ME_, opi, (unsigned long)(opt[opi].CB->size));
+ _ME_, opi, (unsigned long)(hopt[opi].CB->size));
return 1;
}
}
- if (opt[opi].CB && airTypeOther != opt[opi].type) {
+ if (hopt[opi].CB && airTypeOther != hopt[opi].type) {
biffAddf(HEST, "%s%sopt[%u] (%s) has non-NULL callbacks, but is not airTypeOther",
- _ME_, opi, opt[opi].flag ? opt[opi].flag : "unflagged");
+ _ME_, opi, hopt[opi].flag ? hopt[opi].flag : "unflagged");
return 1;
}
// kind 4 = single variadic parm; kind 5 = multiple variadic parm
- ufvarNum += (opt[opi].kind > 3 && (!opt[opi].flag));
+ ufvarNum += (hopt[opi].kind > 3 && (!hopt[opi].flag));
}
if (ufvarNum > 1) {
biffAddf(HEST, "%s%scan have at most 1 unflagged min<max options, not %u", _ME_,
@@ -904,25 +907,14 @@
return 0;
}
-/* experiments in adding a nixer/free-er that exactly matches the airMopper type,
- as part of trying to avoid all "undefined behavior" */
-void *
-hestParmFree_vp(void *_hparm) {
- return AIR_VOIDP(hestParmFree((hestParm *)_hparm));
-}
-void *
-hestOptFree_vp(void *_opt) {
- return AIR_VOIDP(hestOptFree((hestOpt *)_opt));
-}
-
/*
- * hestOptCheck: check given hestOpt array `opt`, using the default hestParm.
+ * hestOptCheck: check given hestOpt array `hopt`, using the default hestParm.
* Puts any errors into newly allocated (caller responsible to free) `*errP`.
*/
int
-hestOptCheck(const hestOpt *opt, char **errP) {
+hestOptCheck(const hestOpt *hopt, char **errP) {
hestParm *hparm = hestParmNew();
- if (_hestOPCheck(opt, hparm)) {
+ if (_hestOPCheck(hopt, hparm)) {
char *err = biffGetDone(HEST);
if (errP) {
/* they did give a pointer address; they'll free it */
@@ -942,14 +934,14 @@
}
/*
- * hestOptParmCheck: check given hestOpt array `opt` in combination with the given
+ * hestOptParmCheck: check given hestOpt array `hopt` in combination with the given
* hestParm `hparm`. Puts any errors into newly allocated (caller responsible to free)
* `*errP`.
* HEY copy-pasta
*/
int
-hestOptParmCheck(const hestOpt *opt, const hestParm *hparm, char **errP) {
- if (_hestOPCheck(opt, hparm)) {
+hestOptParmCheck(const hestOpt *hopt, const hestParm *hparm, char **errP) {
+ if (_hestOPCheck(hopt, hparm)) {
char *err = biffGetDone(HEST);
if (errP) {
/* they did give a pointer address; they'll free it */
Modified: teem/trunk/src/hest/parseHest.c
===================================================================
--- teem/trunk/src/hest/parseHest.c 2025-09-29 07:59:10 UTC (rev 7519)
+++ teem/trunk/src/hest/parseHest.c 2025-09-29 08:13:39 UTC (rev 7520)
@@ -894,7 +894,6 @@
optNum - 1, optParms[op], ident, opt[op].kind, type, (unsigned int)size);
}
/* we may over-write these */
- opt[op].alloc = 0;
if (opt[op].sawP) {
*(opt[op].sawP) = 0;
}
@@ -933,7 +932,7 @@
}
if (opt[op].CB->destroy) {
/* vP is the address of a void*, we manage the void * */
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
airMopAdd(pmop, (void **)vP, (airMopper)airSetNull, airMopOnError);
airMopAdd(pmop, *((void **)vP), opt[op].CB->destroy, airMopOnError);
}
@@ -949,7 +948,7 @@
}
/* vP is the address of a char* (a char **), but what we
manage with airMop is the char * */
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
airMopMem(pmop, vP, airMopOnError);
break;
default:
@@ -1001,7 +1000,7 @@
free(optParmsCopy);
if (opt[op].CB->destroy) {
/* vP is an array of void*s, we manage the individual void*s */
- opt[op].alloc = 2;
+ /* opt[op].alloc = 2; SORRY old code will leak */
for (p = 0; p < (int)opt[op].min; p++) { /* HEY scrutinize casts */
airMopAdd(pmop, ((void **)vP) + p, (airMopper)airSetNull, airMopOnError);
airMopAdd(pmop, *(((void **)vP) + p), opt[op].CB->destroy, airMopOnError);
@@ -1018,7 +1017,7 @@
}
/* vP is an array of char*s, (a char**), and what we manage
with airMop are the individual vP[p]. */
- opt[op].alloc = 2;
+ /* opt[op].alloc = 2; SORRY old code will leak */
for (p = 0; p < (int)opt[op].min; p++) { /* HEY scrutinize casts */
airMopMem(pmop, &(((char **)vP)[p]), airMopOnError);
}
@@ -1049,7 +1048,7 @@
ident);
return 1;
}
- opt[op].alloc = 0;
+ /* opt[op].alloc = 0; dropped with 2025 rewrite */
break;
case airTypeString:
/* this is a bizarre case: optional single string, with some kind of value
@@ -1067,11 +1066,11 @@
ident);
return 1;
}
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
if (opt[op].flag && 1 == whichCase(opt, optDfltd, optParmNum, appr, op)) {
/* we just parsed the default, but now we want to "invert" it */
*((char **)vP) = (char *)airFree(*((char **)vP));
- opt[op].alloc = 0;
+ /* opt[op].alloc = 0; this is so needlessly confusing */
}
/* vP is the address of a char* (a char**), and what we
manage with airMop is the char * */
@@ -1105,7 +1104,7 @@
}
if (opt[op].CB->destroy) {
/* vP is the address of a void*, we manage the void* */
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
airMopAdd(pmop, vP, (airMopper)airSetNull, airMopOnError);
airMopAdd(pmop, *((void **)vP), opt[op].CB->destroy, airMopOnError);
}
@@ -1117,7 +1116,7 @@
ident);
return 1;
}
- opt[op].alloc = 0;
+ /* opt[op].alloc = 0; dropped with 2025 rewrite */
/* HEY sorry about confusion about hestOpt->parmStr versus the value set
here, due to this "inversion" */
if (1 == whichCase(opt, optDfltd, optParmNum, appr, op)) {
@@ -1160,7 +1159,7 @@
/* so far everything we've done is regardless of type */
switch (type) {
case airTypeEnum:
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
if (optParmNum[op]
!= airParseStrE((int *)(*((void **)vP)), optParms[op], " ",
optParmNum[op], opt[op].enm)) {
@@ -1173,7 +1172,7 @@
case airTypeOther:
cP = (char *)(*((void **)vP));
optParmsCopy = airStrdup(optParms[op]);
- opt[op].alloc = (opt[op].CB->destroy ? 3 : 1);
+ /* opt[op].alloc = (opt[op].CB->destroy ? 3 : 1); SORRY old code will leak */
for (p = 0; p < (int)optParmNum[op]; p++) { /* HEY scrutinize casts */
tok = airStrtok(!p ? optParmsCopy : NULL, " ", &last);
/* (Note from 2023-06-24: "hammerhead" was hammerhead.ucsd.edu, an Intel
@@ -1218,7 +1217,7 @@
}
break;
case airTypeString:
- opt[op].alloc = 3;
+ /* opt[op].alloc = 3; SORRY old code will leak */
if (optParmNum[op]
!= airParseStrS((char **)(*((void **)vP)), optParms[op], " ",
optParmNum[op] /*, hparm->greedySingleString */)) {
@@ -1237,7 +1236,7 @@
(*((char ***)vP))[optParmNum[op]] = NULL;
break;
default:
- opt[op].alloc = 1;
+ /* opt[op].alloc = 1; SORRY old code will leak */
if (optParmNum[op]
!= _hestParseStr[type](*((void **)vP), optParms[op], " ",
optParmNum[op])) {
@@ -1449,67 +1448,23 @@
**
** free()s whatever was allocated by hestParse()
**
-** ignore-able quirk: returns NULL, to facilitate use with the airMop functions
+** ignore-able quirk: returns given pointer, to facilitate use with the airMop functions
*/
-void *
+hestOpt *
hestParseFree(hestOpt *opt) {
+ if (opt) {
uint optNum = opt->arrLen;
- for (uint op = 0; op < optNum; op++) {
- airArrayLenSet(opt[op].havec->hargArr, 0); // but not hestArgVecNix(opt[op].havec);
- opt[op].parmStr = airFree(opt[op].parmStr);
- /*
- printf("!hestParseFree: op = %d/%d -> kind = %d; type = %d; alloc = %d\n",
- op, optNum-1, opt[op].kind, opt[op].type, opt[op].alloc);
- */
- void **vP = (void **)opt[op].valueP;
- void ***vAP = (void ***)opt[op].valueP;
- char **str = (char **)opt[op].valueP;
- char ***strP = (char ***)opt[op].valueP;
- switch (opt[op].alloc) {
- case 0:
- /* nothing was allocated */
- break;
- case 1:
- if (airTypeOther != opt[op].type) {
- *vP = airFree(*vP);
- } else {
- /* alloc is one either because we parsed one thing, and we have a
- destroy callback, or, because we parsed a dynamically-created array
- of things, and we don't have a destroy callback */
- if (opt[op].CB->destroy) {
- *vP = opt[op].CB->destroy(*vP);
- } else {
- *vP = airFree(*vP);
- }
- }
- break;
- case 2:
- if (airTypeString == opt[op].type) {
- for (int i = 0; i < (int)opt[op].min; i++) { /* HEY scrutinize casts */
- str[i] = (char *)airFree(str[i]);
- }
- } else {
- for (int i = 0; i < (int)opt[op].min; i++) { /* HEY scrutinize casts */
- vP[i] = opt[op].CB->destroy(vP[i]);
- }
- }
- break;
- case 3:
- if (airTypeString == opt[op].type) {
- for (uint ui = 0; ui < *(opt[op].sawP); ui++) {
- (*strP)[ui] = (char *)airFree((*strP)[ui]);
- }
- *strP = (char **)airFree(*strP);
- } else {
- for (uint ui = 0; ui < *(opt[op].sawP); ui++) {
- (*vAP)[ui] = opt[op].CB->destroy((*vAP)[ui]);
- }
- *vAP = (void **)airFree(*vAP);
- }
- break;
+ for (uint opi = 0; opi < optNum; opi++) {
+ airArrayLenSet(opt[opi].havec->hargArr, 0); // but not hestArgVecNix(opt[opi].havec);
+ opt[opi].parmStr = airFree(opt[opi].parmStr);
+ /* this gloriously replaces what used to be a lot of dense logic around
+ opt[opi].alloc, opt[opi].type, and opt[opi].CB->destroy */
+ if (opt[opi].parseMop) {
+ opt[opi].parseMop = airMopOkay(opt[opi].parseMop);
}
}
- return NULL;
+ }
+ return opt;
}
/*
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-29 07:59:10 UTC (rev 7519)
+++ teem/trunk/src/hest/parsest.c 2025-09-29 08:13:39 UTC (rev 7520)
@@ -671,12 +671,12 @@
/* whichOptFlag(): for which option (by index) is this the flag?
Given an arg string `flarg` (which may be an flag arg (like "-size") or not (like "512"),
-this finds which one, of the options in the given hestOpt array `opt`, is identified by
+this finds which one, of the options in the given hestOpt array `hopt`, is identified by
`flarg`. If there is a match, returns the index of that option, else returns UINT_MAX.
*/
static uint
-whichOptFlag(const hestOpt *opt, const char *flarg, const hestParm *hparm) {
- uint optNum = opt->arrLen;
+whichOptFlag(const hestOpt *hopt, const char *flarg, const hestParm *hparm) {
+ uint optNum = hopt->arrLen;
if (hparm->verbosity > 3)
printf("%s: looking for maybe-is-flag |%s| in optNum=%u options\n", __func__, flarg,
optNum);
@@ -683,8 +683,8 @@
for (uint optIdx = 0; optIdx < optNum; optIdx++) {
if (hparm->verbosity > 3)
printf("%s: optIdx %u |%s| ?\n", __func__, optIdx,
- opt[optIdx].flag ? opt[optIdx].flag : "(nullflag)");
- const char *optFlag = opt[optIdx].flag;
+ hopt[optIdx].flag ? hopt[optIdx].flag : "(nullflag)");
+ const char *optFlag = hopt[optIdx].flag;
if (!optFlag) continue; // it can't be for this unflagged option
if (strchr(optFlag, MULTI_FLAG_SEP)) {
// look for both long and short versions
@@ -713,36 +713,36 @@
}
/* identStr sprints into `ident` (and returns same `ident`)
- a way to identify `opt` in error and usage messages */
+ a way to identify `hopt` in error and usage messages */
static char *
-identStr(char *ident, const hestOpt *opt) {
- if (opt->flag) {
- if (strchr(opt->flag, MULTI_FLAG_SEP)) {
- char *fcopy = airStrdup(opt->flag);
+identStr(char *ident, const hestOpt *hopt) {
+ if (hopt->flag) {
+ if (strchr(hopt->flag, MULTI_FLAG_SEP)) {
+ char *fcopy = airStrdup(hopt->flag);
char *sep = strchr(fcopy, MULTI_FLAG_SEP);
*sep = '\0';
sprintf(ident, "\"-%s%c--%s\" option", fcopy, MULTI_FLAG_SEP, sep + 1);
free(fcopy);
} else {
- sprintf(ident, "\"-%s\" option", opt->flag);
+ sprintf(ident, "\"-%s\" option", hopt->flag);
}
} else {
- sprintf(ident, "\"<%s>\" option", opt->name);
+ sprintf(ident, "\"<%s>\" option", hopt->name);
}
return ident;
}
/* havecTransfer
-(if `num`) moves `num` args from `hvsrc` (starting at `srcIdx`) to `opt->havec`. This
-takes `hestOpt *opt` instead of `opt->havec` so that we can also set `opt->source`
+(if `num`) moves `num` args from `hvsrc` (starting at `srcIdx`) to `hopt->havec`. This
+takes `hestOpt *hopt` instead of `hopt->havec` so that we can also set `hopt->source`
according to the incoming `hvsrc->harg[]->source`. To minimize cleverness, we set
-`opt->source` with every transferred argument, which means that the per-option source
+`hopt->source` with every transferred argument, which means that the per-option source
remembered is the source of the *last* argument of the option. */
static int
-havecTransfer(hestOpt *opt, hestArgVec *hvsrc, uint srcIdx, uint num,
+havecTransfer(hestOpt *hopt, hestArgVec *hvsrc, uint srcIdx, uint num,
const hestParm *hparm) {
- if (!(opt && hvsrc)) {
- biffAddf(HEST, "%s%sgot NULL opt %p or hvsrc %p", _ME_, AIR_VOIDP(opt),
+ if (!(hopt && hvsrc)) {
+ biffAddf(HEST, "%s%sgot NULL hopt %p or hvsrc %p", _ME_, AIR_VOIDP(hopt),
AIR_VOIDP(hvsrc));
return 1;
}
@@ -758,11 +758,11 @@
return 1;
}
// okay now do the work, starting with emptying destination havec
- hestArgVecReset(opt->havec);
+ hestArgVecReset(hopt->havec);
for (uint ai = 0; ai < num; ai++) {
hestArg *harg = hestArgVecRemove(hvsrc, srcIdx);
- hestArgVecAppendArg(opt->havec, harg);
- opt->source = harg->source;
+ hestArgVecAppendArg(hopt->havec, harg);
+ hopt->source = harg->source;
}
}
return 0;
@@ -769,25 +769,25 @@
}
static void
-optPrint(const hestOpt *opt, uint opi) {
+optPrint(const hestOpt *hopt, uint opi) {
printf("--- opt %u:", opi);
- printf("\t%s%s", opt->flag ? "flag-" : "", opt->flag ? opt->flag : "UNflag");
- printf("\tname|%s|\t k%d (%u)--(%d) \t%s ", opt->name ? opt->name : "(null)",
- opt->kind, opt->min, opt->max, _hestTypeStr[opt->type]);
- printf("\t%sdflt%s%s%s\n", opt->dflt ? "" : "NO-", opt->dflt ? "|" : "",
- opt->dflt ? opt->dflt : "", opt->dflt ? "|" : "");
- printf(" source %s\n", airEnumStr(hestSource, opt->source));
- hestArgVecPrint("", " havec:", opt->havec);
+ printf("\t%s%s", hopt->flag ? "flag-" : "", hopt->flag ? hopt->flag : "UNflag");
+ printf("\tname|%s|\t k%d (%u)--(%d) \t%s ", hopt->name ? hopt->name : "(null)",
+ hopt->kind, hopt->min, hopt->max, _hestTypeStr[hopt->type]);
+ printf("\t%sdflt%s%s%s\n", hopt->dflt ? "" : "NO-", hopt->dflt ? "|" : "",
+ hopt->dflt ? hopt->dflt : "", hopt->dflt ? "|" : "");
+ printf(" source %s\n", airEnumStr(hestSource, hopt->source));
+ hestArgVecPrint("", " havec:", hopt->havec);
return;
}
static void
-optAllPrint(const char *func, const char *ctx, const hestOpt *optall) {
+optAllPrint(const char *func, const char *ctx, const hestOpt *hoptall) {
printf("%s: %s:\n", func, ctx);
printf("%s: v.v.v.v.v.v.v.v.v hestOpt %p has %u options (allocated for %u):\n", func,
- AIR_VOIDP(optall), optall->arrLen, optall->arrAlloc);
- for (uint opi = 0; opi < optall->arrLen; opi++) {
- optPrint(optall + opi, opi);
+ AIR_VOIDP(hoptall), hoptall->arrLen, hoptall->arrAlloc);
+ for (uint opi = 0; opi < hoptall->arrLen; opi++) {
+ optPrint(hoptall + opi, opi);
}
printf("%s: ^'^'^'^'^'^'^'^'^\n", func);
return;
@@ -796,7 +796,7 @@
/* havecExtractFlagged
Extracts the parameter args associated with all flagged options from the given
`hestArgVec *havec` (as generated by histProc()) and stores them the corresponding
-opt->havec. Also sets opt->source according to where that flag arg appeared in the case
+hopt->havec. Also sets hopt->source according to where that flag arg appeared in the case
of stand-alone flags, or (via havecTransfer) wherever the last parm arg came from.
In the case of variadic parameter options, this does the work of figuring out which args
@@ -814,7 +814,7 @@
option. AND, the "--" marker is removed from `havec`.
*/
static int
-havecExtractFlagged(hestOpt *opt, hestArgVec *havec, const hestParm *hparm) {
+havecExtractFlagged(hestOpt *hopt, hestArgVec *havec, const hestParm *hparm) {
char *havStr, ident1[AIR_STRLEN_HUGE + 1], ident2[AIR_STRLEN_HUGE + 1];
uint argIdx = 0;
hestOpt *theOpt = NULL;
@@ -823,7 +823,7 @@
printf("%s: ------------- argIdx = %u (of %u) -> argv[argIdx] = |%s|\n", __func__,
argIdx, havec->len, havec->harg[argIdx]->str);
}
- uint optIdx = whichOptFlag(opt, havec->harg[argIdx]->str, hparm);
+ uint optIdx = whichOptFlag(hopt, havec->harg[argIdx]->str, hparm);
if (UINT_MAX == optIdx) {
// havec->harg[argIdx]->str is not a flag for any option, move on to next arg
if (hparm->verbosity > 2) {
@@ -834,7 +834,7 @@
continue;
}
// else havec->harg[argIdx]->str is a flag for option with index optIdx aka theOpt
- theOpt = opt + optIdx;
+ theOpt = hopt + optIdx;
if (hparm->verbosity)
printf("%s: argv[%u]=|%s| is flag of opt %u \"%s\"\n", __func__, argIdx,
havec->harg[argIdx]->str, optIdx, theOpt->flag);
@@ -841,7 +841,7 @@
/* see if we can associate some parameters with the flag */
if (hparm->verbosity) printf("%s: any associated parms?\n", __func__);
int hitEnd = AIR_FALSE;
- int varParm = (5 == opt[optIdx].kind);
+ int varParm = (5 == hopt[optIdx].kind);
const char VPS[3] = {'-', VAR_PARM_STOP_FLAG, '\0'};
int hitVPS = AIR_FALSE;
uint nextOptIdx = 0, // what is index of option who's flag we hit next
@@ -856,7 +856,7 @@
&& (!varParm || // or, it is a varparm opt, and we aren't looking at "--"
!(hitVPS = !strcmp(VPS, havec->harg[pai]->str)))
&& UINT_MAX // and we aren't looking at start of another flagged option
- == (nextOptIdx = whichOptFlag(opt, havec->harg[pai]->str, hparm))) {
+ == (nextOptIdx = whichOptFlag(hopt, havec->harg[pai]->str, hparm))) {
if (hparm->verbosity)
printf("%s: optIdx %d |%s|; argIdx %u < %u |%s| --> parmNum --> %d\n", __func__,
optIdx, theOpt->flag, argIdx, pai, havec->harg[pai]->str, parmNum + 1);
@@ -887,7 +887,7 @@
identStr(ident1, theOpt), parmNum);
} else if (UINT_MAX != nextOptIdx) {
biffAddf(HEST, "%s%ssaw %s before getting %u parameter%s for %s (got %d)", _ME_,
- identStr(ident2, opt + nextOptIdx), theOpt->min,
+ identStr(ident2, hopt + nextOptIdx), theOpt->min,
theOpt->min > 1 ? "s" : "", identStr(ident1, theOpt), parmNum);
} else {
biffAddf(HEST,
@@ -936,9 +936,9 @@
}
/* make sure that flagged options without default were given */
- uint optNum = opt->arrLen;
+ uint optNum = hopt->arrLen;
for (uint opi = 0; opi < optNum; opi++) {
- theOpt = opt + opi;
+ theOpt = hopt + opi;
if (theOpt->flag) { // this is a flagged option we should have handled above
int needing = (1 != theOpt->kind // this kind of option can take a parm
&& !(theOpt->dflt)); // and this option has no default
@@ -957,7 +957,7 @@
}
if (hparm->verbosity) {
- optAllPrint(__func__, "end of havecExtractFlagged", opt);
+ optAllPrint(__func__, "end of havecExtractFlagged", hopt);
hestArgVecPrint(__func__, "end of havecExtractFlagged", havec);
}
return 0;
@@ -964,9 +964,9 @@
}
/* havecExtractUnflagged()
-Extracts the parameter args associated with all unflagged options (of `hestOpt *opt`)
+Extracts the parameter args associated with all unflagged options (of `hestOpt *hopt`)
from the given `hestArgVec *havec` and (like havecExtractFlagged) extracts those args and
-saves them in the corresponding opt[].havec
+saves them in the corresponding hopt[].havec
This is the function that has to handle the trickly logic of allowing there to be
multiple unflagged options, only one of which may have a variadic number of parms; that
@@ -973,12 +973,12 @@
one has to be extracted last.
*/
static int
-havecExtractUnflagged(hestOpt *opt, hestArgVec *havec, const hestParm *hparm) {
+havecExtractUnflagged(hestOpt *hopt, hestArgVec *havec, const hestParm *hparm) {
char *havStr = NULL, ident[AIR_STRLEN_HUGE + 1];
- uint optNum = opt->arrLen; // number of options (flagged or unflagged)
+ uint optNum = hopt->arrLen; // number of options (flagged or unflagged)
uint ufOptNum = 0; // number of unflagged options
for (uint opi = 0; opi < optNum; opi++) {
- if (!opt[opi].flag) {
+ if (!hopt[opi].flag) {
ufOptNum += 1;
}
}
@@ -993,7 +993,7 @@
assert(ufOpi2);
uint upii = 0; // index into ufOpi2
for (uint opi = 0; opi < optNum; opi++) {
- if (!opt[opi].flag) {
+ if (!hopt[opi].flag) {
ufOpi2[2 * upii + 0] = opi;
upii++;
}
@@ -1016,7 +1016,7 @@
uint ufVarOpi = optNum; // index (if < optNum) of the unflagged variadic parm option
for (upii = 0; upii < ufOptNum; upii++) {
uint opi = ufOpi2[2 * upii + 0];
- if (5 == opt[opi].kind) { // (unflagged) multiple variadic parm
+ if (5 == hopt[opi].kind) { // (unflagged) multiple variadic parm
ufVarOpi = opi;
break;
}
@@ -1030,7 +1030,7 @@
: "is index of single unflagged variadic opt"));
}
- // grab parameters for all unflagged opts before opt[ufVarOpi]
+ // grab parameters for all unflagged opts before hopt[ufVarOpi]
for (upii = 0; upii < ufOptNum; upii++) {
uint opi = ufOpi2[2 * upii + 0]; // 0: increasing index direction
if (opi == ufVarOpi) {
@@ -1037,18 +1037,18 @@
break;
}
if (hparm->verbosity) {
- printf("%s: looking at opi = %u kind %d\n", __func__, opi, opt[opi].kind);
+ printf("%s: looking at opi = %u kind %d\n", __func__, opi, hopt[opi].kind);
}
/* Either we have enough args to satisfy this option (and thus don't care if it has a
default), or, we do *not* have enough args and hence want to use the default. In the
later case, we don't have a default, that's a problem that needs an error message.
So, either way, we try extracting the args and report any problems encountered. */
- if (opt[opi].min /* == max */ < havec->len || !opt[opi].dflt) {
+ if (hopt[opi].min /* == max */ < havec->len || !hopt[opi].dflt) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
- if (havecTransfer(opt + opi, havec, 0, opt[opi].min, hparm)) {
+ if (havecTransfer(hopt + opi, havec, 0, hopt[opi].min, hparm)) {
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for %sunflagged %s[%u]", _ME_,
- !opt[opi].dflt ? "default-less " : "", identStr(ident, opt + opi), opi);
+ !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi), opi);
return (free(havStr), free(ufOpi2), 1);
}
havStr = airFree(havStr);
@@ -1067,18 +1067,18 @@
break;
}
if (hparm->verbosity) {
- printf("%s: looking at (later) opi = %u kind %d\n", __func__, opi, opt[opi].kind);
+ printf("%s: looking at (later) opi = %u kind %d\n", __func__, opi, hopt[opi].kind);
}
// same logic as above
- if (opt[opi].min /* == max */ < havec->len || !opt[opi].dflt) {
- uint idx0 = (opt[opi].min < havec->len // index of first arg for this option
- ? havec->len - opt[opi].min //
+ if (hopt[opi].min /* == max */ < havec->len || !hopt[opi].dflt) {
+ uint idx0 = (hopt[opi].min < havec->len // index of first arg for this option
+ ? havec->len - hopt[opi].min //
: 0);
havStr = hestArgVecSprint(havec, AIR_TRUE);
- if (havecTransfer(opt + opi, havec, idx0, opt[opi].min, hparm)) {
+ if (havecTransfer(hopt + opi, havec, idx0, hopt[opi].min, hparm)) {
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for (later) %sunflagged %s[%u]", _ME_,
- !opt[opi].dflt ? "default-less " : "", identStr(ident, opt + opi), opi);
+ !hopt[opi].dflt ? "default-less " : "", identStr(ident, hopt + opi), opi);
return (free(havStr), free(ufOpi2), 1);
}
havStr = airFree(havStr);
@@ -1088,16 +1088,16 @@
// We're here because there is an unflagged variadic option (index ufVarOpi < optNum)
if (hparm->verbosity) {
printf("%s: ufVarOpi=%u min, have, max = %u %u %d\n", __func__, ufVarOpi,
- opt[ufVarOpi].min, havec->len, _hestMax(opt[ufVarOpi].max));
+ hopt[ufVarOpi].min, havec->len, _hestMax(hopt[ufVarOpi].max));
}
- uint minArg = opt[ufVarOpi].min; /* min < max ! */
- if (minArg > havec->len && !opt[ufVarOpi].dflt) {
+ uint minArg = hopt[ufVarOpi].min; /* min < max ! */
+ if (minArg > havec->len && !hopt[ufVarOpi].dflt) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST,
"%s%shave only %u args left but need %u for "
"(default-less) variadic unflagged %s[%u]",
- _ME_, havec->len, minArg, identStr(ident, opt + ufVarOpi), ufVarOpi);
+ _ME_, havec->len, minArg, identStr(ident, hopt + ufVarOpi), ufVarOpi);
return (free(havStr), free(ufOpi2), 1);
}
// else minArg <= havec->len, or, minArg > havec->len and do have default
@@ -1104,19 +1104,19 @@
if (minArg <= havec->len) {
// can satisfy option from havec, no need to use default
uint getArg = havec->len; // want to grab as many args as possible
- if (-1 != opt[ufVarOpi].max) { // but no more than the option asks for
- getArg = AIR_MIN(getArg, AIR_UINT(opt[ufVarOpi].max));
+ if (-1 != hopt[ufVarOpi].max) { // but no more than the option asks for
+ getArg = AIR_MIN(getArg, AIR_UINT(hopt[ufVarOpi].max));
}
- if (havecTransfer(opt + ufVarOpi, havec, 0, getArg, hparm)) {
+ if (havecTransfer(hopt + ufVarOpi, havec, 0, getArg, hparm)) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for unflagged variadic %s[%u]", _ME_,
- identStr(ident, opt + ufVarOpi), ufVarOpi);
+ identStr(ident, hopt + ufVarOpi), ufVarOpi);
return (free(havStr), free(ufOpi2), 1);
}
}
/* else minArg > havec->len so can't satisfy from havec, but that's ok for
- opt[ufVarOpi] since it has default. The erroneous presence of extraneous args will be
+ hopt[ufVarOpi] since it has default. The erroneous presence of extraneous args will be
caught next */
finishingup:
@@ -1124,9 +1124,9 @@
// make sure that unflagged options without default were given
for (upii = 0; upii < ufOptNum; upii++) {
uint opi = ufOpi2[2 * upii + 0];
- if (!(opt[opi].dflt) && hestSourceUnknown == opt[opi].source) {
+ if (!(hopt[opi].dflt) && hestSourceUnknown == hopt[opi].source) {
biffAddf(HEST, "%s%sdidn't get required (default-less) unflagged %s[%u]", _ME_,
- identStr(ident, opt + opi), opi);
+ identStr(ident, hopt + opi), opi);
return (free(ufOpi2), 1);
}
}
@@ -1143,7 +1143,7 @@
}
if (hparm->verbosity) {
- optAllPrint(__func__, "end of havecExtractUnflagged", opt);
+ optAllPrint(__func__, "end of havecExtractUnflagged", hopt);
hestArgVecPrint(__func__, "end of havecExtractUnflagged", havec);
}
return (airFree(havStr), airFree(ufOpi2), 0);
@@ -1151,52 +1151,52 @@
/* optProcessDefaults
All the command-line arguments (and any response files invoked therein) should now be
-processed (by transferring the arguments to per-option opt->havec arrays), but we need to
+processed (by transferring the arguments to per-option hopt->havec arrays), but we need to
ensure that every option has information from which to set values. The per-option
-opt->dflt string is what we look to now, to finish setting per-option opt->havec arrays
-for all the options for which opt->havec have not already been set. We use
-`!opt->source` (aka hestSourceUnknown) as the indicator of not already being set.
+hopt->dflt string is what we look to now, to finish setting per-option hopt->havec arrays
+for all the options for which hopt->havec have not already been set. We use
+`!hopt->source` (aka hestSourceUnknown) as the indicator of not already being set.
*/
static int
-optProcessDefaults(hestOpt *opt, hestArg *tharg, hestInputStack *hist,
+optProcessDefaults(hestOpt *hopt, hestArg *tharg, hestInputStack *hist,
const hestParm *hparm) {
char ident[AIR_STRLEN_HUGE + 1];
- uint optNum = opt->arrLen;
+ uint optNum = hopt->arrLen;
for (uint opi = 0; opi < optNum; opi++) {
if (hparm->verbosity) {
printf(" -> %s incoming", __func__);
- optPrint(opt + opi, opi);
+ optPrint(hopt + opi, opi);
}
- if (opt[opi].source) {
+ if (hopt[opi].source) {
/* the source is already set (to something other than hestSourceUnknown),
so there's no need for using the default */
continue;
}
- opt[opi].source = hestSourceDefault;
- if (1 == opt[opi].kind) {
+ hopt[opi].source = hestSourceDefault;
+ if (1 == hopt[opi].kind) {
/* There is no meaningful "default" for stand-alone flags (and in fact
- opt[opi].dflt is enforced to be NULL) so there is no default string to tokenize,
+ hopt[opi].dflt is enforced to be NULL) so there is no default string to tokenize,
but we above set source to default for sake of completeness, and to signal that
the flag was not given by user */
goto nextopt;
}
- identStr(ident, opt + opi);
+ identStr(ident, hopt + opi);
// should have already checked for this but just to make sure
- if (!opt[opi].dflt) {
+ if (!hopt[opi].dflt) {
biffAddf(HEST, "%s%s %s[%u] needs default string but it is NULL", _ME_, ident,
opi);
return 1;
}
/* in some circumstan...
[truncated message content] |
|
From: <kin...@us...> - 2025-09-29 07:59:13
|
Revision: 7519
http://sourceforge.net/p/teem/code/7519
Author: kindlmann
Date: 2025-09-29 07:59:10 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
hest has removed the experimental hestParmFree_vp, so now using traditional albeit clunky (airMopper)hestParmFree
Modified Paths:
--------------
teem/trunk/src/bin/unu.c
Modified: teem/trunk/src/bin/unu.c
===================================================================
--- teem/trunk/src/bin/unu.c 2025-09-29 07:58:41 UTC (rev 7518)
+++ teem/trunk/src/bin/unu.c 2025-09-29 07:59:10 UTC (rev 7519)
@@ -53,7 +53,7 @@
mop = airMopNew();
hparm = hestParmNew();
- airMopAdd(mop, hparm, hestParmFree_vp, airMopAlways);
+ airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
hparm->elideSingleEnumType = AIR_TRUE;
hparm->elideSingleOtherType = AIR_TRUE;
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-29 07:58:46
|
Revision: 7518
http://sourceforge.net/p/teem/code/7518
Author: kindlmann
Date: 2025-09-29 07:58:41 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
hest has removed the experimental hestOptFree_vp, so now using traditional albeit clunky (airMopper)hestOptFree
Modified Paths:
--------------
teem/trunk/src/unrrdu/1op.c
teem/trunk/src/unrrdu/2op.c
teem/trunk/src/unrrdu/3op.c
teem/trunk/src/unrrdu/aabplot.c
teem/trunk/src/unrrdu/acrop.c
teem/trunk/src/unrrdu/affine.c
teem/trunk/src/unrrdu/axdelete.c
teem/trunk/src/unrrdu/axinfo.c
teem/trunk/src/unrrdu/axinsert.c
teem/trunk/src/unrrdu/axmerge.c
teem/trunk/src/unrrdu/axsplit.c
teem/trunk/src/unrrdu/basinfo.c
teem/trunk/src/unrrdu/block.c
teem/trunk/src/unrrdu/ccadj.c
teem/trunk/src/unrrdu/ccfind.c
teem/trunk/src/unrrdu/ccmerge.c
teem/trunk/src/unrrdu/ccsettle.c
teem/trunk/src/unrrdu/cksum.c
teem/trunk/src/unrrdu/cmedian.c
teem/trunk/src/unrrdu/convert.c
teem/trunk/src/unrrdu/crop.c
teem/trunk/src/unrrdu/data.c
teem/trunk/src/unrrdu/dering.c
teem/trunk/src/unrrdu/dhisto.c
teem/trunk/src/unrrdu/dice.c
teem/trunk/src/unrrdu/diff.c
teem/trunk/src/unrrdu/dist.c
teem/trunk/src/unrrdu/dnorm.c
teem/trunk/src/unrrdu/fft.c
teem/trunk/src/unrrdu/flip.c
teem/trunk/src/unrrdu/gamma.c
teem/trunk/src/unrrdu/grid.c
teem/trunk/src/unrrdu/hack.c
teem/trunk/src/unrrdu/head.c
teem/trunk/src/unrrdu/heq.c
teem/trunk/src/unrrdu/histax.c
teem/trunk/src/unrrdu/histo.c
teem/trunk/src/unrrdu/i2w.c
teem/trunk/src/unrrdu/ilk.c
teem/trunk/src/unrrdu/imap.c
teem/trunk/src/unrrdu/inset.c
teem/trunk/src/unrrdu/jhisto.c
teem/trunk/src/unrrdu/join.c
teem/trunk/src/unrrdu/lut.c
teem/trunk/src/unrrdu/lut2.c
teem/trunk/src/unrrdu/make.c
teem/trunk/src/unrrdu/minmax.c
teem/trunk/src/unrrdu/mlut.c
teem/trunk/src/unrrdu/mrmap.c
teem/trunk/src/unrrdu/pad.c
teem/trunk/src/unrrdu/permute.c
teem/trunk/src/unrrdu/project.c
teem/trunk/src/unrrdu/quantize.c
teem/trunk/src/unrrdu/resample.c
teem/trunk/src/unrrdu/reshape.c
teem/trunk/src/unrrdu/rmap.c
teem/trunk/src/unrrdu/save.c
teem/trunk/src/unrrdu/shuffle.c
teem/trunk/src/unrrdu/slice.c
teem/trunk/src/unrrdu/splice.c
teem/trunk/src/unrrdu/sselect.c
teem/trunk/src/unrrdu/subst.c
teem/trunk/src/unrrdu/swap.c
teem/trunk/src/unrrdu/tile.c
teem/trunk/src/unrrdu/unblock.c
teem/trunk/src/unrrdu/uncmt.c
teem/trunk/src/unrrdu/undos.c
teem/trunk/src/unrrdu/unorient.c
teem/trunk/src/unrrdu/unquantize.c
teem/trunk/src/unrrdu/untile.c
teem/trunk/src/unrrdu/vidicon.c
teem/trunk/src/unrrdu/w2i.c
Modified: teem/trunk/src/unrrdu/1op.c
===================================================================
--- teem/trunk/src/unrrdu/1op.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/1op.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -72,7 +72,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_1opInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/2op.c
===================================================================
--- teem/trunk/src/unrrdu/2op.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/2op.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -87,7 +87,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_2opInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/3op.c
===================================================================
--- teem/trunk/src/unrrdu/3op.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/3op.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -86,7 +86,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_3opInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/aabplot.c
===================================================================
--- teem/trunk/src/unrrdu/aabplot.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/aabplot.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -52,7 +52,7 @@
nrrdHestNrrdNoTTY);
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_aabplotInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/acrop.c
===================================================================
--- teem/trunk/src/unrrdu/acrop.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/acrop.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -77,7 +77,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_acropInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/affine.c
===================================================================
--- teem/trunk/src/unrrdu/affine.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/affine.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -61,7 +61,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_affineInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/axdelete.c
===================================================================
--- teem/trunk/src/unrrdu/axdelete.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/axdelete.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -47,7 +47,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_axdeleteInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/axinfo.c
===================================================================
--- teem/trunk/src/unrrdu/axinfo.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/axinfo.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -69,7 +69,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_axinfoInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/axinsert.c
===================================================================
--- teem/trunk/src/unrrdu/axinsert.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/axinsert.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -63,7 +63,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_axinsertInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/axmerge.c
===================================================================
--- teem/trunk/src/unrrdu/axmerge.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/axmerge.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -48,7 +48,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_axmergeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/axsplit.c
===================================================================
--- teem/trunk/src/unrrdu/axsplit.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/axsplit.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -45,7 +45,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_axsplitInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/basinfo.c
===================================================================
--- teem/trunk/src/unrrdu/basinfo.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/basinfo.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -77,7 +77,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
nio = nrrdIoStateNew();
airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways);
Modified: teem/trunk/src/unrrdu/block.c
===================================================================
--- teem/trunk/src/unrrdu/block.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/block.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -46,7 +46,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_blockInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/ccadj.c
===================================================================
--- teem/trunk/src/unrrdu/ccadj.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/ccadj.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -44,7 +44,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_ccadjInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/ccfind.c
===================================================================
--- teem/trunk/src/unrrdu/ccfind.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/ccfind.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -55,7 +55,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_ccfindInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/ccmerge.c
===================================================================
--- teem/trunk/src/unrrdu/ccmerge.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/ccmerge.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -71,7 +71,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_ccmergeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/ccsettle.c
===================================================================
--- teem/trunk/src/unrrdu/ccsettle.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/ccsettle.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -41,7 +41,7 @@
"from new (settled) values to old values, in the form of a "
"1-D lookup table");
OPT_ADD_NOUT(out, "output nrrd");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_ccsettleInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/cksum.c
===================================================================
--- teem/trunk/src/unrrdu/cksum.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/cksum.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -83,7 +83,7 @@
"endianness");
hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-",
"input nrrd(s). By default tries to read from stdin", &ninLen);
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_cksumInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/cmedian.c
===================================================================
--- teem/trunk/src/unrrdu/cmedian.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/cmedian.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -78,7 +78,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_cmedianInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/convert.c
===================================================================
--- teem/trunk/src/unrrdu/convert.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/convert.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -48,7 +48,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_convertInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/crop.c
===================================================================
--- teem/trunk/src/unrrdu/crop.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/crop.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -64,7 +64,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_cropInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/data.c
===================================================================
--- teem/trunk/src/unrrdu/data.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/data.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -48,7 +48,7 @@
mop = airMopNew();
hestOptAdd_1_String(&opt, NULL, "nin", &inS, NULL, "input nrrd");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_dataInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/dering.c
===================================================================
--- teem/trunk/src/unrrdu/dering.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/dering.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -78,7 +78,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_deringInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/dhisto.c
===================================================================
--- teem/trunk/src/unrrdu/dhisto.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/dhisto.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -53,7 +53,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_dhistoInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/dice.c
===================================================================
--- teem/trunk/src/unrrdu/dice.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/dice.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -62,7 +62,7 @@
"with \"/\".");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_diceInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/diff.c
===================================================================
--- teem/trunk/src/unrrdu/diff.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/diff.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -55,7 +55,7 @@
"there was a significant difference (as if it's an error)");
hestOptAdd_Flag(&opt, "od,onlydata", &onlyData,
"Compare data values only, excluding array meta-data");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_diffInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/dist.c
===================================================================
--- teem/trunk/src/unrrdu/dist.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/dist.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -60,7 +60,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_distInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/dnorm.c
===================================================================
--- teem/trunk/src/unrrdu/dnorm.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/dnorm.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -68,7 +68,7 @@
OPT_ADD_NOUT(outS, "output filename");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_dnormInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/fft.c
===================================================================
--- teem/trunk/src/unrrdu/fft.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/fft.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -108,7 +108,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
if (nrrdFFTWEnabled) {
USAGE_OR_PARSE(_unrrdu_fftInfoL_yes);
Modified: teem/trunk/src/unrrdu/flip.c
===================================================================
--- teem/trunk/src/unrrdu/flip.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/flip.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -38,7 +38,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_flipInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/gamma.c
===================================================================
--- teem/trunk/src/unrrdu/gamma.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/gamma.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -58,7 +58,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_gammaInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/grid.c
===================================================================
--- teem/trunk/src/unrrdu/grid.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/grid.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -165,7 +165,7 @@
OPT_ADD_NOUT(outS, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_gridInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/hack.c
===================================================================
--- teem/trunk/src/unrrdu/hack.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/hack.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -42,7 +42,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_hackInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/head.c
===================================================================
--- teem/trunk/src/unrrdu/head.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/head.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -96,7 +96,7 @@
hparm->noArgsIsNoProblem = AIR_TRUE;
hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-",
"input nrrd(s). By default tries to read from stdin", &ninLen);
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_headInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/heq.c
===================================================================
--- teem/trunk/src/unrrdu/heq.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/heq.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -67,7 +67,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_heqInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/histax.c
===================================================================
--- teem/trunk/src/unrrdu/histax.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/histax.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -74,7 +74,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_histaxInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/histo.c
===================================================================
--- teem/trunk/src/unrrdu/histo.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/histo.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -75,7 +75,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_histoInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/i2w.c
===================================================================
--- teem/trunk/src/unrrdu/i2w.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/i2w.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -56,7 +56,7 @@
"number of intervals into which position has been quantized");
hestOptAdd_1_Double(&opt, NULL, "index", &indx, NULL,
"the input index position, to be converted to world");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_i2wInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/ilk.c
===================================================================
--- teem/trunk/src/unrrdu/ilk.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/ilk.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -309,7 +309,7 @@
OPT_ADD_NOUT(outS, "output image");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_ilkInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/imap.c
===================================================================
--- teem/trunk/src/unrrdu/imap.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/imap.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -75,7 +75,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_imapInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/inset.c
===================================================================
--- teem/trunk/src/unrrdu/inset.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/inset.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -50,7 +50,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_insetInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/jhisto.c
===================================================================
--- teem/trunk/src/unrrdu/jhisto.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/jhisto.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -74,7 +74,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_jhistoInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/join.c
===================================================================
--- teem/trunk/src/unrrdu/join.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/join.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -68,7 +68,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_joinInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/lut.c
===================================================================
--- teem/trunk/src/unrrdu/lut.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/lut.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -71,7 +71,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_lutInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/lut2.c
===================================================================
--- teem/trunk/src/unrrdu/lut2.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/lut2.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -72,7 +72,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_lut2InfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/make.c
===================================================================
--- teem/trunk/src/unrrdu/make.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/make.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -237,7 +237,7 @@
"this option allows you to explicitly name the data file, "
"instead of (by default, not using this option) having it be "
"the same filename base as the header file.");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
// Gone in TeemV2: airStrtokQuoting = AIR_TRUE;
/* hparm->verbosity = 3; / * HEY JUST FOR DEBUGGING */
Modified: teem/trunk/src/unrrdu/minmax.c
===================================================================
--- teem/trunk/src/unrrdu/minmax.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/minmax.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -110,7 +110,7 @@
"only if there were non-existent values. If there are multiple inputs, "
"the input filename is printed first on the per-input single line.");
hestOptAdd_Nv_String(&opt, NULL, "nin1", 1, -1, &inS, "-", "input nrrd(s)", &ninLen);
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_minmaxInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/mlut.c
===================================================================
--- teem/trunk/src/unrrdu/mlut.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/mlut.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -74,7 +74,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_mlutInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/mrmap.c
===================================================================
--- teem/trunk/src/unrrdu/mrmap.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/mrmap.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -78,7 +78,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_mrmapInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/pad.c
===================================================================
--- teem/trunk/src/unrrdu/pad.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/pad.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -61,7 +61,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_padInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/permute.c
===================================================================
--- teem/trunk/src/unrrdu/permute.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/permute.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -42,7 +42,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_permuteInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/project.c
===================================================================
--- teem/trunk/src/unrrdu/project.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/project.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -63,7 +63,7 @@
"has to match number of axes specified.",
&outLen);
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_projectInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/quantize.c
===================================================================
--- teem/trunk/src/unrrdu/quantize.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/quantize.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -110,7 +110,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_quantizeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/resample.c
===================================================================
--- teem/trunk/src/unrrdu/resample.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/resample.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -181,7 +181,7 @@
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_resampleInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/reshape.c
===================================================================
--- teem/trunk/src/unrrdu/reshape.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/reshape.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -44,7 +44,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_reshapeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/rmap.c
===================================================================
--- teem/trunk/src/unrrdu/rmap.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/rmap.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -82,7 +82,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_rmapInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/save.c
===================================================================
--- teem/trunk/src/unrrdu/save.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/save.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -96,7 +96,7 @@
"instead of (by default, not using this option) having it be "
"the same filename base as the header file.");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_saveInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/shuffle.c
===================================================================
--- teem/trunk/src/unrrdu/shuffle.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/shuffle.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -54,7 +54,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_shuffleInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/slice.c
===================================================================
--- teem/trunk/src/unrrdu/slice.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/slice.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -60,7 +60,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_sliceInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/splice.c
===================================================================
--- teem/trunk/src/unrrdu/splice.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/splice.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -51,7 +51,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_spliceInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/sselect.c
===================================================================
--- teem/trunk/src/unrrdu/sselect.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/sselect.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -50,7 +50,7 @@
"Use \"x\" to say that no output is desired.");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_sselectInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/subst.c
===================================================================
--- teem/trunk/src/unrrdu/subst.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/subst.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -44,7 +44,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_substInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/swap.c
===================================================================
--- teem/trunk/src/unrrdu/swap.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/swap.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -39,7 +39,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_swapInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/tile.c
===================================================================
--- teem/trunk/src/unrrdu/tile.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/tile.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -50,7 +50,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_tileInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/unblock.c
===================================================================
--- teem/trunk/src/unrrdu/unblock.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/unblock.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -44,7 +44,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_unblockInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/uncmt.c
===================================================================
--- teem/trunk/src/unrrdu/uncmt.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/uncmt.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -372,7 +372,7 @@
"Single output filename; use \"-\" for stdout");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_uncmtInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/undos.c
===================================================================
--- teem/trunk/src/unrrdu/undos.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/undos.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -284,7 +284,7 @@
&lenName);
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_undosInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/unorient.c
===================================================================
--- teem/trunk/src/unrrdu/unorient.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/unorient.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -54,7 +54,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_unorientInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/unquantize.c
===================================================================
--- teem/trunk/src/unrrdu/unquantize.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/unquantize.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -59,7 +59,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_unquantizeInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/untile.c
===================================================================
--- teem/trunk/src/unrrdu/untile.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/untile.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -53,7 +53,7 @@
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_untileInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
Modified: teem/trunk/src/unrrdu/vidicon.c
===================================================================
--- teem/trunk/src/unrrdu/vidicon.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/vidicon.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -72,7 +72,7 @@
hestOptAdd_1_String(&opt, "o", "output", &out, NULL, "output nrrd");
mop = airMopNew();
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_vidiconInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
ntmp = nrrdNew();
Modified: teem/trunk/src/unrrdu/w2i.c
===================================================================
--- teem/trunk/src/unrrdu/w2i.c 2025-09-29 06:27:50 UTC (rev 7517)
+++ teem/trunk/src/unrrdu/w2i.c 2025-09-29 07:58:41 UTC (rev 7518)
@@ -56,7 +56,7 @@
"number of intervals into which position has been quantized");
hestOptAdd_1_Double(&opt, NULL, "world", &pos, NULL,
"the input world position, to be converted to index");
- airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
+ airMopAdd(mop, opt, (airMopper)hestOptFree, airMopAlways);
USAGE_OR_PARSE(_unrrdu_w2iInfoL);
airMopAdd(mop, opt, (airMopper)hestParseFree, airMopAlways);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-29 06:27:57
|
Revision: 7517
http://sourceforge.net/p/teem/code/7517
Author: kindlmann
Date: 2025-09-29 06:27:50 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
API CHANGE: airMopDone now returns NULL, as do the wrapper functions airMopError and airMopOkay. When an airMop* is a field somewhere, it is good to NULL it out as soon as its done. Also renamed the new airStrtrunc to just airStrunc
Modified Paths:
--------------
teem/trunk/src/air/air.h
teem/trunk/src/air/mop.c
teem/trunk/src/air/string.c
Modified: teem/trunk/src/air/air.h
===================================================================
--- teem/trunk/src/air/air.h 2025-09-29 04:38:01 UTC (rev 7516)
+++ teem/trunk/src/air/air.h 2025-09-29 06:27:50 UTC (rev 7517)
@@ -514,7 +514,7 @@
AIR_EXPORT char *airStrdup(const char *s);
AIR_EXPORT size_t airStrlen(const char *s);
/* ---- BEGIN non-NrrdIO */
-AIR_EXPORT char *airStrtrunc(char *s, size_t bsize, size_t drop);
+AIR_EXPORT char *airStrunc(char *s, size_t bsize, size_t drop);
AIR_EXPORT int airStrcmp(const char *s1, const char *s2);
/* ---- END non-NrrdIO */
AIR_EXPORT char *airStrtok(char *s, const char *ct, char **last);
@@ -649,9 +649,9 @@
AIR_EXPORT void airMopMem(airArray *arr, void *_ptrP, int when);
AIR_EXPORT void airMopUnMem(airArray *arr, void *_ptrP);
AIR_EXPORT void airMopPrint(airArray *arr, const void *_str, int when);
-AIR_EXPORT void airMopDone(airArray *arr, int error);
-AIR_EXPORT void airMopError(airArray *arr);
-AIR_EXPORT void airMopOkay(airArray *arr);
+AIR_EXPORT airArray *airMopDone(airArray *arr, int error);
+AIR_EXPORT airArray *airMopError(airArray *arr);
+AIR_EXPORT airArray *airMopOkay(airArray *arr);
AIR_EXPORT void airMopDebug(airArray *arr);
/* ---- BEGIN non-NrrdIO */
AIR_EXPORT void airMopSingleDone(airArray *arr, void *ptr, int error);
Modified: teem/trunk/src/air/mop.c
===================================================================
--- teem/trunk/src/air/mop.c 2025-09-29 04:38:01 UTC (rev 7516)
+++ teem/trunk/src/air/mop.c 2025-09-29 06:27:50 UTC (rev 7517)
@@ -248,7 +248,7 @@
printf("airMopDebug: ^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
-void
+airArray *
airMopDone(airArray *arr, int error) {
airMop *mops;
unsigned int ii;
@@ -275,19 +275,19 @@
printf("airMopDone(%p): done!\n", (void*)arr);
*/
}
- return;
+ return NULL;
}
-void
+airArray *
airMopError(airArray *arr) {
- airMopDone(arr, AIR_TRUE);
+ return airMopDone(arr, AIR_TRUE);
}
-void
+airArray *
airMopOkay(airArray *arr) {
- airMopDone(arr, AIR_FALSE);
+ return airMopDone(arr, AIR_FALSE);
}
/* ---- BEGIN non-NrrdIO */
Modified: teem/trunk/src/air/string.c
===================================================================
--- teem/trunk/src/air/string.c 2025-09-29 04:38:01 UTC (rev 7516)
+++ teem/trunk/src/air/string.c 2025-09-29 06:27:50 UTC (rev 7517)
@@ -70,7 +70,7 @@
to hide compile-time info about static buffer sizes to avoid warnings about:
snprintf ...'%s' directive output may be truncated writing up to ... */
char *
-airStrtrunc(char *str, size_t bsize, size_t drop) {
+airStrunc(char *str, size_t bsize, size_t drop) {
if (str) {
if (1 + drop < bsize) {
str[bsize - (1 + drop)] = '\0';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-29 04:38:04
|
Revision: 7516
http://sourceforge.net/p/teem/code/7516
Author: kindlmann
Date: 2025-09-29 04:38:01 +0000 (Mon, 29 Sep 2025)
Log Message:
-----------
still hacking
Modified Paths:
--------------
teem/trunk/src/hest/README.md
teem/trunk/src/hest/argvHest.c
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/privateHest.h
teem/trunk/src/hest/test/ex6.c
Modified: teem/trunk/src/hest/README.md
===================================================================
--- teem/trunk/src/hest/README.md 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/README.md 2025-09-29 04:38:01 UTC (rev 7516)
@@ -29,7 +29,7 @@
## The different `kind`s of options, and how to `hestOptAdd` them.
-There are lot of moving pieces inside `hestParse`, and the description of how it works is complicated by how flexible a `hestOpt` can be. Two of the fields in the `hestOpt` are `min` and `max`: the min and max number of parameters that may be parsed for that option. All the different traditional uses of the command-line can be parameterized in terms of `min` and `max`, but the full range of possibilities of `min`,`max` (which `hest` supports) include some less conventional uses. Once the possibility of mapping out all possibilities for command-line options in terms of `min` and `max` was recognized, `hest` implementation was organized around that, even if typical uses of `hest` are not thought of that way. See also the **concrete examples** below.
+There are lot of moving pieces inside `hestParse`, and the description of how it works is complicated by how flexible a `hestOpt` can be. Two of the most important yet unconventional fields in the `hestOpt` are `min` and `max`: the min and max number of parameters that may be parsed for that option. All the different traditional uses of the command-line can be parameterized in terms of `min` and `max`, but the full range of possibilities of `min`,`max` (which `hest` supports) include unusual use-cases. Once the possibility of mapping out all possibilities for command-line options in terms of `min` and `max` was recognized, `hest` implementation was organized around that, even if typical uses of `hest` are not thought of that way. Refer also to the **concrete examples** above and below.
The _`kind`_ is `hest`'s term for a numeric identifier for the kind of option that a `hestOpt` describes. The following ASCII-art illustrates how `min` and `max` determine:
Modified: teem/trunk/src/hest/argvHest.c
===================================================================
--- teem/trunk/src/hest/argvHest.c 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/argvHest.c 2025-09-29 04:38:01 UTC (rev 7516)
@@ -180,7 +180,7 @@
/* hestArgVecSprint goes is opposite of the shell-style tokenization of
parsest.c/argstGo: generate a single human-friendly string that could be tokenized to
recover the hestArgVec we started with.
-ChatGPT helped with prototyping plainWord and argAddQuotedString
+ChatGPT helped with prototyping _hestPlainWord and argAddQuotedString
(and in this file, only those two functions)
Here are instructive examples of the same kind of argv pretty-printing:
https://github.com/git/git/blob/master/quote.c
@@ -188,9 +188,9 @@
with its (more baroque) quotearg_buffer_restyled() function
*/
-// plainWord(str) is true if nothing in str needs quoting or escaping
-static int
-plainWord(const char *s) {
+// _hestPlainWord(str) is true if nothing in str needs quoting or escaping
+int
+_hestPlainWord(const char *s) {
if (*s == '\0') {
// wut - we got the empty string, yes needs quoting
return 0;
@@ -258,7 +258,7 @@
hestArgAddChar(retArg, ':');
}
const char *astr = havec->harg[ai]->str;
- if (plainWord(astr)) {
+ if (_hestPlainWord(astr)) {
hestArgAddString(retArg, astr);
} else {
argAddQuotedString(retArg, astr);
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-29 04:38:01 UTC (rev 7516)
@@ -663,9 +663,9 @@
/* _hestOPCheck
New biff-based container for all logic that originated in _hestOptCheck (which is the
-2025 rename of _hestPanic): the validation of the given hestOpt array `opt` itself (but
-*not* anything about the command-line or its parsing), relative to the given (non-NULL)
-hestParm `hparm`.
+2025 rename of what had long been called _hestPanic): the validation of the given hestOpt
+array `opt` itself (but *not* anything about the command-line or its parsing), relative
+to the given (non-NULL) hestParm `hparm`.
Pre-2025, hest did not depend on biff, and this instead took a 'char *err' that somehow
magically had to be allocated for the size of any possible error message generated here.
@@ -795,22 +795,6 @@
_ME_, opi, flag);
return (free(tbuff), 1);
}
- if (4 == opt[opi].kind) {
- if (!opt[opi].dflt) {
- biffAddf(HEST,
- "%s%sflagged single variadic parameter must "
- "specify a default",
- _ME_);
- return 1;
- }
- if (!strlen(opt[opi].dflt)) {
- biffAddf(HEST,
- "%s%sflagged single variadic parameter default "
- "must be non-zero length",
- _ME_);
- return 1;
- }
- }
} else { // ------ end of if (opt[opi].flag)
// opt[opi] is unflagged
if (!opt[opi].min) {
@@ -822,7 +806,7 @@
}
}
if (4 == opt[opi].kind) { // single variadic parameter
- // immediately above have ruled out unflagged kind 4
+ // immediately above have just ruled out unflagged kind 4
if (!opt[opi].dflt) {
biffAddf(HEST,
"%s%sopt[%u] -%s is single variadic parameter, but "
@@ -830,8 +814,15 @@
_ME_, opi, opt[opi].flag);
return 1;
}
- /* pre 2025, these types were allowed kind 4, but the semantics are just so weird
- and thus hard to test + debug, that it no longer makes sense to support them */
+ if (!(strlen(opt[opi].dflt) && _hestPlainWord(opt[opi].dflt))) {
+ biffAddf(HEST,
+ "%s%sopt[%u] -%s is single variadic parameter, but "
+ "default \"%s\" needs to be non-empty single value",
+ _ME_, opi, opt[opi].flag, opt[opi].dflt);
+ return 1;
+ }
+ /* pre 2025, these types were allowed for kind 4, but the semantics are just so
+ weird and thus hard to test + debug. It no longer makes sense to support them */
if (airTypeChar == opt[opi].type || airTypeString == opt[opi].type
|| airTypeEnum == opt[opi].type || airTypeOther == opt[opi].type) {
biffAddf(HEST,
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/parsest.c 2025-09-29 04:38:01 UTC (rev 7516)
@@ -1262,8 +1262,11 @@
line. The inscrutability of the hest code (or really the self-reinforcing
learned fear of working with the hest code) seems to have been the barrier.
(2025 GLK notes that the fear was justified, given how long the re-write took ...) */
- opt[opi].parmStr = hestArgVecSprint(opt[opi].havec, AIR_FALSE);
- /* not: airStrdup(optParms[opi]); since 2025 havec adoption */
+ if (4 != opt[opi].kind) {
+ // single variadic options are weird, handled differently below
+ opt[opi].parmStr = hestArgVecSprint(opt[opi].havec, AIR_FALSE);
+ }
+ /* since 2025 havec adoption, not: airStrdup(optParms[opi]); */
int type = opt[opi].type;
size_t size = (airTypeEnum == type /* */
? sizeof(int)
@@ -1341,6 +1344,8 @@
if (invert) {
_hestInvertScalar[type](valueP);
}
+ // special handling of parmStr for kind 4
+ opt[opi].parmStr = airStrdup(strsrc);
} // end case 4 {
break;
case 2: // -------- one required parameter --------
@@ -1384,7 +1389,7 @@
}
*(opt[opi].sawP) = opt[opi].havec->len;
cvalueP = *((void **)valueP);
- // RIP hammerhead.ucsd.edu and Intel Itanium
+ // (RIP hammerhead.ucsd.edu, Intel Itanium, and last days of grad school)
for (uint argi = 0; argi < opt[opi].havec->len; argi++) {
if (_hestParseSingle[type](cvalueP + size * argi,
opt[opi].havec->harg[argi]->str, hpp)) {
@@ -1416,7 +1421,9 @@
The basic phases of parsing are:
-0) Error checking on given `opt` array
+0) Error checking on given `opt` 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
response files; this all goes into the `hestArgVec *havec`.
@@ -1465,7 +1472,7 @@
if (_hestOPCheck(opt, HPARM)) {
DO_ERR("problem with given hestOpt array");
airMopError(mop);
- return 1;
+ return 2;
}
if (HPARM->verbosity > 1) {
printf("%s: _hestOPCheck passed\n", __func__);
Modified: teem/trunk/src/hest/privateHest.h
===================================================================
--- teem/trunk/src/hest/privateHest.h 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/privateHest.h 2025-09-29 04:38:01 UTC (rev 7516)
@@ -98,6 +98,9 @@
extern int _hestMax(int max);
extern int _hestOPCheck(const hestOpt *opt, const hestParm *parm);
+// argvHest.c
+extern int _hestPlainWord(const char *s);
+
/* wacky hack to use with biffAddf(HEST), so that normal hest users, who haven't
cranked up hestParm->verbosity to debug hest itself and don't want error messages
prefixed by a lot of weird hest function names:
Modified: teem/trunk/src/hest/test/ex6.c
===================================================================
--- teem/trunk/src/hest/test/ex6.c 2025-09-28 18:28:35 UTC (rev 7515)
+++ teem/trunk/src/hest/test/ex6.c 2025-09-29 04:38:01 UTC (rev 7516)
@@ -88,7 +88,6 @@
hestParmColumnsIoctl(hparm, 80);
opt = NULL;
- /* going past C89 to have declarations here */
int flag;
hestOptAdd_Flag(&opt, "f,flag", &flag, "a flag created via hestOptAdd_Flag");
@@ -324,62 +323,65 @@
"15.55 55.51 66.77 88.99 100.2", "test of hestOptAdd_N_Other B",
&quatCB);
- /* HEY also try 0, -1 */
+// HEY try both!
+// #define VMIN 0
+#define VMIN 1
int *bv;
unsigned int bvSaw;
- hestOptAdd_Nv_Bool(&opt, "bv", "bool1", 1, -1, &bv, "true false",
+ hestOptAdd_Nv_Bool(&opt, "bv", "bool1", VMIN, -1, &bv, "true false",
"test of hestOptAdd_Nv_Bool", &bvSaw);
int *iv;
unsigned int ivSaw;
- hestOptAdd_Nv_Int(&opt, "iv", "int1", 1, -1, &iv, "42 24", "test of hestOptAdd_Nv_Int",
- &ivSaw);
+ hestOptAdd_Nv_Int(&opt, "iv", "int1", VMIN, -1, &iv, "42 24",
+ "test of hestOptAdd_Nv_Int", &ivSaw);
unsigned int *uiv;
unsigned int uivSaw;
- hestOptAdd_Nv_UInt(&opt, "uiv", "uint1", 1, -1, &uiv, "42 24",
+ hestOptAdd_Nv_UInt(&opt, "uiv", "uint1", VMIN, -1, &uiv, "42 24",
"test of hestOptAdd_Nv_UInt", &uivSaw);
long int *liv;
unsigned int livSaw;
- hestOptAdd_Nv_Long(&opt, "liv", "lint1", 1, -1, &liv, "42 24",
+ hestOptAdd_Nv_Long(&opt, "liv", "lint1", VMIN, -1, &liv, "42 24",
"test of hestOptAdd_Nv_Long", &livSaw);
unsigned long int *uliv;
unsigned int ulivSaw;
- hestOptAdd_Nv_ULong(&opt, "uliv", "ulint1", 1, -1, &uliv, "42 24",
+ hestOptAdd_Nv_ULong(&opt, "uliv", "ulint1", VMIN, -1, &uliv, "42 24",
"test of hestOptAdd_Nv_ULong", &ulivSaw);
size_t *szv;
unsigned int szvSaw;
- hestOptAdd_Nv_Size_t(&opt, "szv", "size1", 1, -1, &szv, "42 24",
+ hestOptAdd_Nv_Size_t(&opt, "szv", "size1", VMIN, -1, &szv, "42 24",
"test of hestOptAdd_Nv_Size_t", &szvSaw);
float *flv;
unsigned int flvSaw;
- hestOptAdd_Nv_Float(&opt, "flv", "float1", 1, -1, &flv, "4.2 2.4",
+ hestOptAdd_Nv_Float(&opt, "flv", "float1", VMIN, -1, &flv, "4.2 2.4",
"test of hestOptAdd_Nv_Float", &flvSaw);
double *dbv;
unsigned int dbvSaw;
- hestOptAdd_Nv_Double(&opt, "dbv", "double1", 1, -1, &dbv, "4.2 2.4",
+ hestOptAdd_Nv_Double(&opt, "dbv", "double1", VMIN, -1, &dbv, "4.2 2.4",
"test of hestOptAdd_Nv_Double", &dbvSaw);
char *cv;
unsigned int cvSaw;
- hestOptAdd_Nv_Char(&opt, "cv", "char1", 1, -1, &cv, "x y",
+ hestOptAdd_Nv_Char(&opt, "cv", "char1", VMIN, -1, &cv, "x y",
"test of hestOptAdd_Nv_Char", &cvSaw);
char **sv;
unsigned int svSaw;
- hestOptAdd_Nv_String(&opt, "sv", "str1", 1, -1, &sv, "bingo bob",
+ hestOptAdd_Nv_String(&opt, "sv", "str1", VMIN, -1, &sv, "bingo bob",
"test of hestOptAdd_Nv_String", &svSaw);
int *ev;
unsigned int evSaw;
- hestOptAdd_Nv_Enum(&opt, "ev", "enum1", 1, -1, &ev, "little big",
+ hestOptAdd_Nv_Enum(&opt, "ev", "enum1", VMIN, -1, &ev, "little big",
"test of hestOptAdd_Nv_Enum", &evSaw, airEndian);
double *pv;
unsigned int pvSaw;
- hestOptAdd_Nv_Other(&opt, "pv", "pos1", 1, -1, &pv, "1.5,5.25 2.9,9.2",
+ hestOptAdd_Nv_Other(&opt, "pv", "pos1", VMIN, -1, &pv, "1.5,5.25 2.9,9.2",
"test of hestOptAdd_Nv_Other A", &pvSaw, &posCB);
Quat **qv;
unsigned int qvSaw;
- hestOptAdd_Nv_Other(&opt, "qv", "quat1", 1, -1, &qv, "12.34 43.21",
+ hestOptAdd_Nv_Other(&opt, "qv", "quat1", VMIN, -1, &qv, "12.34 43.21",
"test of hestOptAdd_Nv_Other B", &qvSaw, &quatCB);
- if (hestParse2(opt, argc - 1, argv + 1, NULL, hparm)) {
+ int eret;
+ if ((eret = hestParse2(opt, argc - 1, argv + 1, NULL, hparm))) {
// have already fprintf'd to stderr
- hestUsage(stderr, opt, argv[0], hparm);
+ if (2 != eret) hestUsage(stderr, opt, argv[0], hparm);
hestParmFree(hparm);
hestOptFree(opt);
exit(0);
@@ -395,7 +397,7 @@
AIR_TRUE);
*/
- if (0) {
+ if (1) {
unsigned int opi, numO;
numO = hestOptNum(opt);
for (opi = 0; opi < numO; opi++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-28 18:28:37
|
Revision: 7515
http://sourceforge.net/p/teem/code/7515
Author: kindlmann
Date: 2025-09-28 18:28:35 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
removing left-over debugging msg
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-28 18:16:31 UTC (rev 7514)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-28 18:28:35 UTC (rev 7515)
@@ -551,10 +551,6 @@
opt->source = hestSourceUnknown;
opt->parmStr = NULL;
opt->helpWanted = AIR_FALSE;
-
- if (airTypeInt == type && 1 == min && 1 == max) {
- printf("!something like %s: got valueP %p\n", "hestOptAdd_1_Int", AIR_VOIDP(valueP));
- }
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-28 18:16:34
|
Revision: 7514
http://sourceforge.net/p/teem/code/7514
Author: kindlmann
Date: 2025-09-28 18:16:31 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
still debugging
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/test/ex6.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-28 17:31:23 UTC (rev 7513)
+++ teem/trunk/src/hest/parsest.c 2025-09-28 18:16:31 UTC (rev 7514)
@@ -872,7 +872,7 @@
__func__, optIdx, theOpt->flag, parmNum, hitEnd, hitVPS, nextOptIdx);
if (parmNum < theOpt->min) { // didn't get required min # parameters
havStr = hestArgVecSprint(havec, AIR_TRUE);
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
if (hitEnd) {
biffAddf(HEST,
"%s%shit end of args before getting %u parameter%s "
@@ -914,7 +914,7 @@
hestArgNix(hestArgVecRemove(havec, argIdx));
havStr = hestArgVecSprint(havec, AIR_TRUE);
if (havecTransfer(theOpt, havec, argIdx, parmNum, hparm)) {
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble transferring %u args for %s", _ME_, parmNum,
identStr(ident1, theOpt));
return (free(havStr), 1);
@@ -1046,7 +1046,7 @@
if (opt[opi].min /* == max */ < havec->len || !opt[opi].dflt) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
if (havecTransfer(opt + opi, havec, 0, opt[opi].min, hparm)) {
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for %sunflagged %s[%u]", _ME_,
!opt[opi].dflt ? "default-less " : "", identStr(ident, opt + opi), opi);
return (free(havStr), free(ufOpi2), 1);
@@ -1076,7 +1076,7 @@
: 0);
havStr = hestArgVecSprint(havec, AIR_TRUE);
if (havecTransfer(opt + opi, havec, idx0, opt[opi].min, hparm)) {
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for (later) %sunflagged %s[%u]", _ME_,
!opt[opi].dflt ? "default-less " : "", identStr(ident, opt + opi), opi);
return (free(havStr), free(ufOpi2), 1);
@@ -1093,7 +1093,7 @@
uint minArg = opt[ufVarOpi].min; /* min < max ! */
if (minArg > havec->len && !opt[ufVarOpi].dflt) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST,
"%s%shave only %u args left but need %u for "
"(default-less) variadic unflagged %s[%u]",
@@ -1109,7 +1109,7 @@
}
if (havecTransfer(opt + ufVarOpi, havec, 0, getArg, hparm)) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST, "%s%strouble getting args for unflagged variadic %s[%u]", _ME_,
identStr(ident, opt + ufVarOpi), ufVarOpi);
return (free(havStr), free(ufOpi2), 1);
@@ -1133,7 +1133,7 @@
// currently it's an error to have un-accounted-for args left overå
if (havec->len) {
havStr = hestArgVecSprint(havec, AIR_TRUE);
- biffAddf(HEST, "%s%sgiven (labeled) argv=|%s|", _ME_, havStr);
+ biffAddf(HEST, "%s%sgiven (index: labeled) argv=|%s|", _ME_, havStr);
biffAddf(HEST,
"%s%safter getting %u unflagged opts, have %u unexpected arg%s "
"%s\"%s\"",
@@ -1250,7 +1250,6 @@
*/
void *valueP;
char *cvalueP;
- int *ivalueP;
uint optNum = opt->arrLen;
for (uint opi = 0; opi < optNum; opi++) {
identStr(ident, opt + opi);
@@ -1272,8 +1271,6 @@
? opt[opi].CB->size
: _hestTypeSize[type]));
valueP = opt[opi].valueP;
- cvalueP = (char *)valueP;
- ivalueP = (int *)valueP;
if (hparm->verbosity) {
printf("%s: opt[%u/%u]: havec_%c|%s| \t|%s| \t--> kind=%d, type=%d, size=%u\n",
__func__, opi, optNum, airEnumStr(hestSource, opt[opi].source)[0],
@@ -1297,13 +1294,14 @@
// hpp->err set by parseSingleT
}
switch (opt[opi].kind) {
- case 1: // -------- parameter-less boolean flags --------
+ case 1: { // -------- parameter-less boolean flags --------
/* valueP is always assumed to be an int* */
+ int *ivalueP = (int *)valueP;
*ivalueP = hestSourceDefault != opt[opi].source;
if (hparm->verbosity) {
printf(" --> set value %d\n", *ivalueP);
}
- break;
+ } break;
case 4: { // -------- optional single variadics --------
const char *strsrc;
int invert;
@@ -1343,8 +1341,8 @@
if (invert) {
_hestInvertScalar[type](valueP);
}
- break;
} // end case 4 {
+ break;
case 2: // -------- one required parameter --------
if (_hestParseSingle[type](valueP, opt[opi].havec->harg[0]->str, hpp)) {
biffAddf(HEST, "%s%sproblem parsing for %s[%u]: %s", _ME_, ident, opi, hpp->err);
@@ -1354,6 +1352,8 @@
break;
case 3:
/* -------- multiple required parameters -------- */
+ // user already allocated array at valueP
+ cvalueP = (char *)valueP;
for (uint argi = 0; argi < opt[opi].havec->len; argi++) {
if (_hestParseSingle[type](cvalueP + size * argi,
opt[opi].havec->harg[argi]->str, hpp)) {
@@ -1365,130 +1365,42 @@
// (review alloc semantics in hest.h)
opt[opi].alloc = 2 * hpp->alloc;
break;
-#if 0
+ // (case 4 handled above)
case 5:
/* -------- multiple variadic parameters -------- */
- if (optParms[opi] && valueP) {
- if (1 == whichCase(opt, optDfltd, optParmNum, appr, opi)) {
- *((void **)valueP) = NULL;
- /* alloc and sawP set above */
- } else {
- if (airTypeString == type) {
- /* this is sneakiness: we allocate one more element so that
- the resulting char** is, like argv, NULL-terminated */
- *((void **)valueP) = calloc(optParmNum[opi] + 1, size);
- } else {
- if (optParmNum[opi]) {
- /* only allocate if there's something to allocate */
- *((void **)valueP) = calloc(optParmNum[opi], size);
- } else {
- *((void **)valueP) = NULL;
- }
- }
- if (hparm->verbosity) {
- printf("%s: optParmNum[%d] = %u\n", me, opi, optParmNum[opi]);
- printf("%s: new array (size %u*%u) is at 0x%p\n", me, optParmNum[opi],
- (unsigned int)size, *((void **)valueP));
- }
- if (*((void **)valueP)) {
- airMopMem(pmop, valueP, airMopOnError);
- }
- *(opt[opi].sawP) = optParmNum[opi];
- /* so far everything we've done is regardless of type */
- switch (type) {
- case airTypeEnum:
- opt[opi].alloc = 1;
- if (optParmNum[opi]
- != airParseStrE((int *)(*((void **)valueP)), optParms[opi], " ",
- optParmNum[opi], opt[opi].enm)) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %u %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], optParmNum[opi],
- opt[opi].enm->name, optParmNum[opi] > 1 ? "s" : "", ident);
- return 1;
- }
- break;
- case airTypeOther:
- cvalueP = (char *)(*((void **)valueP));
- optParmsCopy = airStrdup(optParms[opi]);
- opt[opi].alloc = (opt[opi].CB->destroy ? 3 : 1);
- for (p = 0; p < (int)optParmNum[opi]; p++) { /* HEY scrutinize casts */
- tok = airStrtok(!p ? optParmsCopy : NULL, " ", &last);
- /* (Note from 2023-06-24: "hammerhead" was hammerhead.ucsd.edu, an Intel
- Itanium ("IA-64") machine that GLK had access to in 2003, presumably with
- an Intel compiler, providing a different debugging opportunity for this
- code. Revision r1985 from 2003-12-20 documented some issues discovered, in
- comments like the one below. Valgrind has hopefully resolved these issues
- now, but the comment below is preserved out of respect for the goals of
- Itanium, and nostalgia for that time at the end of grad school.)
- hammerhead problems went away when this line
- was replaced by the following one:
- strcpy(cberr, "");
- */
- cberr[0] = 0;
- ret = opt[opi].CB->parse(cvalueP + p * size, tok, cberr);
- if (ret) {
- if (strlen(cberr))
- fprintf(stderr,
- "%serror parsing \"%s\" (in \"%s\") as %s "
- "for %s:\n%s\n",
- ME, tok, optParms[opi], opt[opi].CB->type, ident, cberr);
-
- else
- fprintf(stderr,
- "%serror parsing \"%s\" (in \"%s\") as %s "
- "for %s: returned %d\n",
- ME, tok, optParms[opi], opt[opi].CB->type, ident, ret);
- free(optParmsCopy);
- return 1;
- }
- }
- free(optParmsCopy);
- if (opt[opi].CB->destroy) {
- for (p = 0; p < (int)optParmNum[opi]; p++) { /* HEY scrutinize casts */
- /* avert your eyes. vP is the address of an array of void*s.
- We manage the void*s */
- airMopAdd(pmop, (*((void ***)valueP)) + p, (airMopper)airSetNull,
- airMopOnError);
- airMopAdd(pmop, *((*((void ***)valueP)) + p), opt[opi].CB->destroy,
- airMopOnError);
- }
- }
- break;
- case airTypeString:
- opt[opi].alloc = 3;
- if (optParmNum[opi]
- != airParseStrS((char **)(*((void **)valueP)), optParms[opi], " ",
- optParmNum[opi] /*, hparm->greedySingleString */)) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %d %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], optParmNum[opi],
- _hestTypeStr[type], optParmNum[opi] > 1 ? "s" : "", ident);
- return 1;
- }
- /* vP is the address of an array of char*s (a char ***), and
- what we manage with airMop is the individual (*vP)[p],
- as well as vP itself (above). */
- for (p = 0; p < (int)optParmNum[opi]; p++) { /* HEY scrutinize casts */
- airMopAdd(pmop, (*((char ***)valueP))[p], airFree, airMopOnError);
- }
- /* do the NULL-termination described above */
- (*((char ***)valueP))[optParmNum[opi]] = NULL;
- break;
- default:
- opt[opi].alloc = 1;
- if (optParmNum[opi]
- != _hestParseStr[type](*((void **)valueP), optParms[opi], " ",
- optParmNum[opi])) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %d %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], optParmNum[opi],
- _hestTypeStr[type], optParmNum[opi] > 1 ? "s" : "", ident);
- return 1;
- }
- break;
- }
+ // we allocate the array to hold multiple values
+ // initialize pointer to NULL in case we have zero
+ *((void **)valueP) = NULL;
+ if (airTypeString == type) {
+ /* this is sneakiness: we allocate one more element so that
+ the resulting char** is, like argv, NULL-terminated */
+ *((void **)valueP) = calloc(opt[opi].havec->len + 1, size);
+ } else if (opt[opi].havec->len) {
+ // only allocate if there's a need to
+ *((void **)valueP) = calloc(opt[opi].havec->len, size);
+ }
+ if (*((void **)valueP)) {
+ airMopMem(cmop, valueP, airMopOnError);
+ }
+ *(opt[opi].sawP) = opt[opi].havec->len;
+ cvalueP = *((void **)valueP);
+ // RIP hammerhead.ucsd.edu and Intel Itanium
+ for (uint argi = 0; argi < opt[opi].havec->len; argi++) {
+ if (_hestParseSingle[type](cvalueP + size * argi,
+ opt[opi].havec->harg[argi]->str, hpp)) {
+ biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for %s[%u]: %s", _ME_, argi,
+ opt[opi].havec->len, ident, opi, hpp->err);
+ return 1;
}
}
+ if (airTypeString == type) {
+ // finish NULL-termination sneakiness
+ char **argv = (char **)cvalueP;
+ argv[opt[opi].havec->len] = NULL;
+ }
+ // (review alloc semantics in hest.h)
+ opt[opi].alloc = 2 + hpp->alloc;
break;
-#endif
} // end switch
} // for opi ...
return 0;
Modified: teem/trunk/src/hest/test/ex6.c
===================================================================
--- teem/trunk/src/hest/test/ex6.c 2025-09-28 17:31:23 UTC (rev 7513)
+++ teem/trunk/src/hest/test/ex6.c 2025-09-28 18:16:31 UTC (rev 7514)
@@ -324,7 +324,6 @@
"15.55 55.51 66.77 88.99 100.2", "test of hestOptAdd_N_Other B",
&quatCB);
-#if 0
/* HEY also try 0, -1 */
int *bv;
unsigned int bvSaw;
@@ -378,7 +377,6 @@
unsigned int qvSaw;
hestOptAdd_Nv_Other(&opt, "qv", "quat1", 1, -1, &qv, "12.34 43.21",
"test of hestOptAdd_Nv_Other B", &qvSaw, &quatCB);
-#endif
if (hestParse2(opt, argc - 1, argv + 1, NULL, hparm)) {
// have already fprintf'd to stderr
hestUsage(stderr, opt, argv[0], hparm);
@@ -509,7 +507,6 @@
q5[1]->val, q5[1]->str, q5[2]->val, q5[2]->str, q5[3]->val, q5[3]->str,
q5[4]->val, q5[4]->str);
-#if 0
unsigned int ii;
printf("bv (%u) =", bvSaw);
for (ii = 0; ii < bvSaw; ii++) {
@@ -577,7 +574,6 @@
}
printf("\n");
-#endif
/* free the memory allocated by parsing ... */
hestParseFree(opt);
/* ... and the other stuff */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-28 17:31:26
|
Revision: 7513
http://sourceforge.net/p/teem/code/7513
Author: kindlmann
Date: 2025-09-28 17:31:23 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
maybe working more
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/test/ex6.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-28 09:02:02 UTC (rev 7512)
+++ teem/trunk/src/hest/parsest.c 2025-09-28 17:31:23 UTC (rev 7513)
@@ -1314,7 +1314,7 @@
--> value is set from the default
- option flag appears, but with no parm
--> default is parsed, say, as value V, then the value is set to !V
- (*this* is the "inversion" that is mentioned at places in the code)
+ (*this* is the mysterious "inversion" mentioned at places in the code)
- option flag appears, with single parm
--> value is set from parsing that parm
In any case, some string has to be parsed; we call it `strsrc` */
@@ -1352,81 +1352,20 @@
}
opt[opi].alloc = hpp->alloc;
break;
-#if 0
case 3:
/* -------- multiple required parameters -------- */
- if (optParms[opi] && valueP) {
- switch (type) {
- case airTypeEnum:
- if (opt[opi].min != /* min == max */
- airParseStrE((int *)valueP, optParms[opi], " ", opt[opi].min,
- opt[opi].enm)) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %d %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], opt[opi].min,
- opt[opi].enm->name, opt[opi].min > 1 ? "s" : "", ident);
- return 1;
- }
- break;
- case airTypeOther:
- optParmsCopy = airStrdup(optParms[opi]);
- for (p = 0; p < (int)opt[opi].min; p++) { /* HEY scrutinize casts */
- tok = airStrtok(!p ? optParmsCopy : NULL, " ", &last);
- strcpy(cberr, "");
- ret = opt[opi].CB->parse(cvalueP + p * size, tok, cberr);
- if (ret) {
- if (strlen(cberr))
- fprintf(stderr,
- "%serror parsing \"%s\" (in \"%s\") as %s "
- "for %s:\n%s\n",
- ME, tok, optParms[opi], opt[opi].CB->type, ident, cberr);
- else
- fprintf(stderr,
- "%serror parsing \"%s\" (in \"%s\") as %s "
- "for %s: returned %d\n",
- ME, tok, optParms[opi], opt[opi].CB->type, ident, ret);
- free(optParmsCopy);
- return 1;
- }
- }
- free(optParmsCopy);
- if (opt[opi].CB->destroy) {
- /* vP is an array of void*s, we manage the individual void*s */
- opt[opi].alloc = 2;
- for (p = 0; p < (int)opt[opi].min; p++) { /* HEY scrutinize casts */
- airMopAdd(pmop, ((void **)valueP) + p, (airMopper)airSetNull,
- airMopOnError);
- airMopAdd(pmop, *(((void **)valueP) + p), opt[opi].CB->destroy,
- airMopOnError);
- }
- }
- break;
- case airTypeString:
- if (opt[opi].min != /* min == max */
- _hestParseStr[type](valueP, optParms[opi], " ", opt[opi].min)) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %d %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], opt[opi].min,
- _hestTypeStr[type], opt[opi].min > 1 ? "s" : "", ident);
- return 1;
- }
- /* vP is an array of char*s, (a char**), and what we manage
- with airMop are the individual vP[p]. */
- opt[opi].alloc = 2;
- for (p = 0; p < (int)opt[opi].min; p++) { /* HEY scrutinize casts */
- airMopMem(pmop, &(((char **)valueP)[p]), airMopOnError);
- }
- break;
- default:
- if (opt[opi].min != /* min == max */
- _hestParseStr[type](valueP, optParms[opi], " ", opt[opi].min)) {
- fprintf(stderr, "%scouldn't parse %s\"%s\" as %d %s%s for %s\n", ME,
- optDfltd[opi] ? "(default) " : "", optParms[opi], opt[opi].min,
- _hestTypeStr[type], opt[opi].min > 1 ? "s" : "", ident);
- return 1;
- }
- break;
+ for (uint argi = 0; argi < opt[opi].havec->len; argi++) {
+ if (_hestParseSingle[type](cvalueP + size * argi,
+ opt[opi].havec->harg[argi]->str, hpp)) {
+ biffAddf(HEST, "%s%sproblem parsing arg %u (of %u) for %s[%u]: %s", _ME_, argi,
+ opt[opi].havec->len, ident, opi, hpp->err);
+ return 1;
}
}
+ // (review alloc semantics in hest.h)
+ opt[opi].alloc = 2 * hpp->alloc;
break;
+#if 0
case 5:
/* -------- multiple variadic parameters -------- */
if (optParms[opi] && valueP) {
Modified: teem/trunk/src/hest/test/ex6.c
===================================================================
--- teem/trunk/src/hest/test/ex6.c 2025-09-28 09:02:02 UTC (rev 7512)
+++ teem/trunk/src/hest/test/ex6.c 2025-09-28 17:31:23 UTC (rev 7513)
@@ -85,6 +85,7 @@
hparm->noArgsIsNoProblem = AIR_TRUE;
hparm->dieLessVerbose = AIR_TRUE;
hparm->verbosity = 0;
+ hestParmColumnsIoctl(hparm, 80);
opt = NULL;
/* going past C89 to have declarations here */
@@ -160,7 +161,6 @@
hestOptAdd_1_Other(&opt, "q1", "quat", &q1, "12.34", "test of hestOptAdd_1_Other B",
&quatCB);
-#if 0
int b2[2];
hestOptAdd_2_Bool(&opt, "b2", "bool1 bool2", b2, "true false",
"test of hestOptAdd_2_Bool");
@@ -324,6 +324,7 @@
"15.55 55.51 66.77 88.99 100.2", "test of hestOptAdd_N_Other B",
&quatCB);
+#if 0
/* HEY also try 0, -1 */
int *bv;
unsigned int bvSaw;
@@ -444,7 +445,6 @@
printf("q1 (@ %p) = %g(%s)\n", q1, q1->val, q1->str);
printf("\n");
-#if 0
printf("b2 = %d %d\n", b2[0], b2[1]);
printf("i2 = %d %d\n", i2[0], i2[1]);
printf("ui2 = %u %u\n", ui2[0], ui2[1]);
@@ -509,6 +509,7 @@
q5[1]->val, q5[1]->str, q5[2]->val, q5[2]->str, q5[3]->val, q5[3]->str,
q5[4]->val, q5[4]->str);
+#if 0
unsigned int ii;
printf("bv (%u) =", bvSaw);
for (ii = 0; ii < bvSaw; ii++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2025-09-28 09:02:04
|
Revision: 7512
http://sourceforge.net/p/teem/code/7512
Author: kindlmann
Date: 2025-09-28 09:02:02 +0000 (Sun, 28 Sep 2025)
Log Message:
-----------
more descriptive comments
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/privateHest.h
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-28 08:52:54 UTC (rev 7511)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-28 09:02:02 UTC (rev 7512)
@@ -72,7 +72,7 @@
tokens, and to properly tokenize default strings and response files, we should stop using
the airParseStrT functions that internally use airStrtok(): we have exactly one token to
parse. These functions thus return non-zero in case of error, instead of returning the
-number of parsed values. */
+number of parsed values. See also comment about _hestP(arse)Pack in privateHest.h */
static int
parseSingleB(void *_out, const char *str, _hestPPack *hpp) {
if (!(_out && str && hpp)) return 1;
Modified: teem/trunk/src/hest/privateHest.h
===================================================================
--- teem/trunk/src/hest/privateHest.h 2025-09-28 08:52:54 UTC (rev 7511)
+++ teem/trunk/src/hest/privateHest.h 2025-09-28 09:02:02 UTC (rev 7512)
@@ -72,6 +72,15 @@
HEST_EXPORT const char _hestTypeStr[_HEST_TYPE_MAX + 1][AIR_STRLEN_SMALL + 1];
HEST_EXPORT const size_t _hestTypeSize[_HEST_TYPE_MAX + 1];
HEST_EXPORT void (*const _hestInvertScalar[_HEST_TYPE_MAX + 1])(void *);
+/* the _hestPPack (hest parse pack) struct is a 2025 idea for addressing one of the most
+annoying parts of hest's code: the special-casing of how values are parsed from strings,
+depending on type (scalar vs enum vs other-via-callbacks). Old code has long had nested
+switch statements: first for option kind, and then for option type. Fresh scrutiny of
+this code revealed how, now that there is no more airStrtok/airStrntok action because all
+individual args have been saved into per-option arg vectors, the parsing problem is just
+to get a single value, and, how to get a single value can be made entirely uniform across
+type; via the _hestParseSingle[] array. By putting the caller's mop in here too, that
+removes one layer of allocation tracking from hest's setting-values function. */
typedef struct {
airArray *cmop; // caller's mop to clean up things if airMopError
const airEnum *enm; // for parsing an airTypeEnum value
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|