|
From: <kin...@us...> - 2025-09-30 18:04:34
|
Revision: 7545
http://sourceforge.net/p/teem/code/7545
Author: kindlmann
Date: 2025-09-30 18:04:33 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
maybe finally, finally corrrectly handling case of single empty string default, which is what was screwing up unu make -k, which is what triggered the 2025 hest re-write
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 16:40:47 UTC (rev 7544)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 18:04:33 UTC (rev 7545)
@@ -138,15 +138,18 @@
if (EOF == icc) {
int ret;
switch (*stateP) {
+ case argstInside:
case argstStart:
- case argstComment:
- // oh well, we didn't get to start an arg
- *nastP = nastTryAgain; // input will be popped, try again with next stack element
+ /* EOF ends the arg we're argstInside (which is fine), or it ends the arg we're
+ just argstStart'ing, and that's fine too: it's how to get an empty string arg,
+ which is a legit arg (e.g. unu make -k <kind> default is "" for single empty
+ string; the mishandling of that triggered the 2025 hest re-write) */
+ *nastP = nastBehold;
ret = 0;
break;
- case argstInside:
- // the EOF ends the arg and that's ok
- *nastP = nastBehold;
+ case argstComment:
+ /* hit EOF will inside a #-comment, which is totally fine, move along ... */
+ *nastP = nastTryAgain;
ret = 0;
break;
case argstSingleQ:
@@ -338,6 +341,8 @@
}
return 1;
}
+ /* printf("!%s: icc = %d --> argstGo --> *nastP = %s; tharg:|%s|\n", __func__, icc,
+ airEnumStr(nast_ae, *nastP), tharg->str); */
if (EOF != icc) {
hin->carIdx++;
} else {
@@ -372,7 +377,7 @@
return 1;
}
if (hparm->verbosity > 1) {
- printf("%s: histProcNextArgSub set *nastP = %s\n", __func__,
+ printf("%s: histProcNextArgTry set *nastP = %s\n", __func__,
airEnumStr(nast_ae, *nastP));
}
} while (*nastP == nastTryAgain);
@@ -553,7 +558,7 @@
? hist->hin + hist->len - 1
: NULL);
// printf("!%s: nast = %s, |stack| = %u, topHin = %p\n", __func__,
- // airEnumStr(nast_ae, nast), hist->len, AIR_VOIDP(topHin));
+ // airEnumStr(nast_ae, nast), hist->len, AIR_VOIDP(topHin));
// we have a token, is it turning off commenting?
if (hparm->respectDashBraceComments && !strcmp("}-", tharg->str)) {
if (!topHin) {
@@ -1197,6 +1202,8 @@
printf("%s: looking at %s[%u] default string |%s|\n", __func__, ident, opi,
hopt[opi].dflt);
}
+ /* printf("!%s: hopt[%u].havec %p havec->len = %u\n", __func__, opi,
+ hopt[opi].havec, hopt[opi].havec->len); */
if (histPushDefault(hist, hopt[opi].dflt, hparm)
|| histProcess(hopt[opi].havec, NULL, tharg, hist, hparm)) {
biffAddf(HEST, "%s%sproblem tokenizing %s[%u] default string", _ME_, ident, opi);
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-30 16:40:47 UTC (rev 7544)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-30 18:04:33 UTC (rev 7545)
@@ -36,6 +36,7 @@
hparm->responseFileEnable = AIR_TRUE;
hparm->verbosity = 4;
+ /*
int flag;
hestOptAdd_Flag(&opt, "b,bingo", &flag, "a flag");
int verb;
@@ -47,6 +48,7 @@
unsigned int slen;
hestOptAdd_Nv_Int(&opt, "s,sizes", "sx sy", 2, -1, &size, NULL, "image resolutions",
&slen);
+ */
#if 0
int *unpB;
unsigned int sawB;
@@ -55,8 +57,10 @@
#endif
/* int unpB[2];
hestOptAdd_2_Int(&opt, NULL, "B B", unpB, NULL, "unflagged B"); */
+#if 0
int unpC[2];
hestOptAdd_2_Int(&opt, NULL, "C C", unpC, /* "dfltC0 dfltC1" */ NULL, "unflagged C");
+#endif
/*
int *unpC;
unsigned int sawC;
@@ -64,7 +68,7 @@
*/
char **kinds;
unsigned int kindsLen;
- hestOptAdd_Nv_String(&opt, "k,kind", "k0 k1", 1, -1, &kinds, "boo",
+ hestOptAdd_Nv_String(&opt, "k,kind", "k0 k1", 1, -1, &kinds, "",
"what \"kind\" is each axis, from the nrrdKind airEnum "
"(e.g. space, time, 3-vector, 3D-masked-symmetric-matrix, "
"or \"none\" to signify no kind)",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|