|
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.
|