|
From: <kin...@us...> - 2025-09-23 10:48:07
|
Revision: 7473
http://sourceforge.net/p/teem/code/7473
Author: kindlmann
Date: 2025-09-23 10:48:04 +0000 (Tue, 23 Sep 2025)
Log Message:
-----------
fewer bugs
Modified Paths:
--------------
teem/trunk/src/hest/methodsHest.c
teem/trunk/src/hest/parsest.c
teem/trunk/src/hest/test/tparse.c
Modified: teem/trunk/src/hest/methodsHest.c
===================================================================
--- teem/trunk/src/hest/methodsHest.c 2025-09-23 10:27:36 UTC (rev 7472)
+++ teem/trunk/src/hest/methodsHest.c 2025-09-23 10:48:04 UTC (rev 7473)
@@ -367,7 +367,9 @@
opt->valueP = valueP;
opt->dflt = airStrdup(dflt);
opt->info = airStrdup(info);
- /* deal with (what used to be) var args */
+ // need to set kind now so can be used in later conditionals
+ opt->kind = opt_kind(min, max);
+ // deal with (what used to be) var args
opt->sawP = (5 == opt->kind /* */
? sawP
: NULL);
@@ -377,11 +379,10 @@
opt->CB = (airTypeOther == type /* */
? CB
: NULL);
- opt->kind = opt_kind(min, max);
- /* alloc set by hestParse */
+ // alloc set by hestParse
opt->havec = hestArgVecNew();
- /* leave arrAlloc, arrLen untouched: managed by caller */
- /* yes, redundant with opt_init() */
+ // leave arrAlloc, arrLen untouched: managed by caller
+ // yes, redundant with opt_init()
opt->source = hestSourceUnknown;
opt->parmStr = NULL;
opt->helpWanted = AIR_FALSE;
@@ -541,9 +542,9 @@
}
if (5 == opt[opi].kind && !(opt[opi].sawP)) {
biffAddf(HEST,
- "%s: have multiple variable parameters, "
+ "%s: opt[%u] has multiple variable parameters (min=%u,max=%d), "
"but sawP is NULL",
- __func__);
+ __func__, opi, opt[opi].min, opt[opi].max);
return 1;
}
if (airTypeEnum == opt[opi].type) {
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-23 10:27:36 UTC (rev 7472)
+++ teem/trunk/src/hest/parsest.c 2025-09-23 10:48:04 UTC (rev 7473)
@@ -831,14 +831,16 @@
uint optNum = opt->arrLen;
for (uint opi = 0; opi < optNum; opi++) {
theOpt = opt + opi;
- if (1 != theOpt->kind // this kind of option can take a parm
- && theOpt->flag // and this is a flagged option we should have handled above
- && !(theOpt->dflt)) { // and this option has no default
+ 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
if (hparm->verbosity > 1) {
- printf("%s: opt %u |%s| (flagged opt w/ parm but no default) source = %s\n",
- __func__, opi, theOpt->flag, airEnumStr(hestSource, theOpt->source));
+ printf("%s: flagged opt %u |%s| source = %s%s\n",
+ __func__, opi, theOpt->flag, airEnumStr(hestSource, theOpt->source),
+ needing ? " <-- w/ parm but w/out default" : "");
}
- if (hestSourceUnknown == theOpt->source) { // but this option hasn't been set
+ // if needs to be set but hasn't been
+ if (needing && hestSourceUnknown == theOpt->source) {
biffAddf(HEST, "%s: didn't get required %s\n", __func__,
identStr(ident1, theOpt));
return 1;
@@ -845,7 +847,6 @@
}
}
}
-
return 0;
}
Modified: teem/trunk/src/hest/test/tparse.c
===================================================================
--- teem/trunk/src/hest/test/tparse.c 2025-09-23 10:27:36 UTC (rev 7472)
+++ teem/trunk/src/hest/test/tparse.c 2025-09-23 10:48:04 UTC (rev 7473)
@@ -38,8 +38,8 @@
int verb;
hestOptAdd_1_Int(&opt, "v", "verb", &verb, "0", "verbosity");
- int res[2];
- hestOptAdd_2_Int(&opt, "s,size", "sx sy", res, NULL, "image resolution");
+ int *res; unsigned int slen;
+ hestOptAdd_Nv_Int(&opt, "s,sizes", "sx sy", 2, -1, &res, NULL, "image resolutions", &slen);
int flag;
hestOptAdd_Flag(&opt, "b,bingo", &flag, "a flag");
char *err = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|