summaryrefslogtreecommitdiffstats
path: root/generic/tclEnsemble.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-05-13 15:41:44 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-05-13 15:41:44 (GMT)
commit444e06f208e9503a7e93cd68a51ed73c3c82298b (patch)
tree5b346cf1401c23c69c43d84a1eb6986e442c7dfd /generic/tclEnsemble.c
parent6b9279d4f7c2ab12d40ffbce3629b8c79bc94136 (diff)
downloadtcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.zip
tcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.tar.gz
tcl-444e06f208e9503a7e93cd68a51ed73c3c82298b.tar.bz2
Clean up a lot of small whitespace issues
This is the dullest commit ever. Sorry.
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r--generic/tclEnsemble.c224
1 files changed, 112 insertions, 112 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 1ff0921..94dca96 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -85,7 +85,7 @@ static const Tcl_ObjType ensembleCmdType = {
TCL_OBJTYPE_V0
};
-#define ECRSetInternalRep(objPtr, ecRepPtr) \
+#define ECRSetInternalRep(objPtr, ecRepPtr) \
do { \
Tcl_ObjInternalRep ir; \
ir.twoPtrValue.ptr1 = (ecRepPtr); \
@@ -93,11 +93,11 @@ static const Tcl_ObjType ensembleCmdType = {
Tcl_StoreInternalRep((objPtr), &ensembleCmdType, &ir); \
} while (0)
-#define ECRGetInternalRep(objPtr, ecRepPtr) \
+#define ECRGetInternalRep(objPtr, ecRepPtr) \
do { \
- const Tcl_ObjInternalRep *irPtr; \
- irPtr = TclFetchInternalRep((objPtr), &ensembleCmdType); \
- (ecRepPtr) = irPtr ? (EnsembleCmdRep *)irPtr->twoPtrValue.ptr1 : NULL; \
+ const Tcl_ObjInternalRep *irPtr; \
+ irPtr = TclFetchInternalRep((objPtr), &ensembleCmdType); \
+ (ecRepPtr) = irPtr ? (EnsembleCmdRep *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
/*
@@ -106,14 +106,14 @@ static const Tcl_ObjType ensembleCmdType = {
*/
typedef struct {
- Tcl_Size epoch; /* Used to confirm when the data in this
- * really structure matches up with the
- * ensemble. */
- Command *token; /* Reference to the command for which this
- * structure is a cache of the resolution. */
- Tcl_Obj *fix; /* Corrected spelling, if needed. */
- Tcl_HashEntry *hPtr; /* Direct link to entry in the subcommand hash
- * table. */
+ Tcl_Size epoch; /* Used to confirm when the data in this
+ * really structure matches up with the
+ * ensemble. */
+ Command *token; /* Reference to the command for which this
+ * structure is a cache of the resolution. */
+ Tcl_Obj *fix; /* Corrected spelling, if needed. */
+ Tcl_HashEntry *hPtr; /* Direct link to entry in the subcommand hash
+ * table. */
} EnsembleCmdRep;
static inline Tcl_Obj *
@@ -529,7 +529,7 @@ TclNamespaceEnsembleCmd(
for (; objc>0 ; objc-=2,objv+=2) {
enum EnsConfigOpts idx;
- if (Tcl_GetIndexFromObj(interp, objv[0],ensembleConfigOptions,
+ if (Tcl_GetIndexFromObj(interp, objv[0], ensembleConfigOptions,
"option", 0, &idx) != TCL_OK) {
freeMapAndError:
if (allocatedMapFlag) {
@@ -2484,15 +2484,15 @@ ClearTable(
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
if (hash->numEntries != 0) {
- Tcl_HashSearch search;
- Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(hash, &search);
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(hash, &search);
- while (hPtr != NULL) {
- Tcl_Obj *prefixObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
- Tcl_DecrRefCount(prefixObj);
- hPtr = Tcl_NextHashEntry(&search);
- }
- Tcl_Free(ensemblePtr->subcommandArrayPtr);
+ while (hPtr != NULL) {
+ Tcl_Obj *prefixObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
+ Tcl_DecrRefCount(prefixObj);
+ hPtr = Tcl_NextHashEntry(&search);
+ }
+ Tcl_Free(ensemblePtr->subcommandArrayPtr);
}
Tcl_DeleteHashTable(hash);
}
@@ -2595,100 +2595,100 @@ BuildEnsembleConfig(
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
if (subList) {
- Tcl_Size subc;
- Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
- const char *name;
-
- /*
- * There is a list of exactly what subcommands go in the table.
- * Determine the target for each.
- */
-
- TclListObjGetElements(NULL, subList, &subc, &subv);
- if (subList == mapDict) {
- /*
- * Unusual case where explicit list of subcommands is same value
- * as the dict mapping to targets.
- */
-
- for (i = 0; i < subc; i += 2) {
- name = TclGetString(subv[i]);
- hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
- if (!isNew) {
- cmdObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
- Tcl_DecrRefCount(cmdObj);
- }
- Tcl_SetHashValue(hPtr, subv[i+1]);
- Tcl_IncrRefCount(subv[i+1]);
-
- name = TclGetString(subv[i+1]);
- hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
- if (isNew) {
- cmdObj = Tcl_NewStringObj(name, -1);
- cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
- Tcl_SetHashValue(hPtr, cmdPrefixObj);
- Tcl_IncrRefCount(cmdPrefixObj);
- }
- }
- } else {
- /*
+ Tcl_Size subc;
+ Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj;
+ const char *name;
+
+ /*
+ * There is a list of exactly what subcommands go in the table.
+ * Determine the target for each.
+ */
+
+ TclListObjGetElements(NULL, subList, &subc, &subv);
+ if (subList == mapDict) {
+ /*
+ * Unusual case where explicit list of subcommands is same value
+ * as the dict mapping to targets.
+ */
+
+ for (i = 0; i < subc; i += 2) {
+ name = TclGetString(subv[i]);
+ hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
+ if (!isNew) {
+ cmdObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
+ Tcl_DecrRefCount(cmdObj);
+ }
+ Tcl_SetHashValue(hPtr, subv[i+1]);
+ Tcl_IncrRefCount(subv[i+1]);
+
+ name = TclGetString(subv[i+1]);
+ hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
+ if (isNew) {
+ cmdObj = Tcl_NewStringObj(name, -1);
+ cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
+ Tcl_SetHashValue(hPtr, cmdPrefixObj);
+ Tcl_IncrRefCount(cmdPrefixObj);
+ }
+ }
+ } else {
+ /*
* Usual case where we can freely act on the list and dict.
*/
- for (i = 0; i < subc; i++) {
- name = TclGetString(subv[i]);
- hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
- if (!isNew) {
- continue;
- }
+ for (i = 0; i < subc; i++) {
+ name = TclGetString(subv[i]);
+ hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
+ if (!isNew) {
+ continue;
+ }
- /*
+ /*
* Lookup target in the dictionary.
*/
- if (mapDict) {
- Tcl_DictObjGet(NULL, mapDict, subv[i], &target);
- if (target) {
- Tcl_SetHashValue(hPtr, target);
- Tcl_IncrRefCount(target);
- continue;
- }
- }
-
- /*
- * Target was not in the dictionary. Map onto the namespace.
- * In this case there is no guarantee that the command
- * is actually there. It is the responsibility of the
+ if (mapDict) {
+ Tcl_DictObjGet(NULL, mapDict, subv[i], &target);
+ if (target) {
+ Tcl_SetHashValue(hPtr, target);
+ Tcl_IncrRefCount(target);
+ continue;
+ }
+ }
+
+ /*
+ * Target was not in the dictionary. Map onto the namespace.
+ * In this case there is no guarantee that the command
+ * is actually there. It is the responsibility of the
* programmer (or [::unknown] of course) to provide the procedure.
- */
-
- cmdObj = Tcl_NewStringObj(name, -1);
- cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
- Tcl_SetHashValue(hPtr, cmdPrefixObj);
- Tcl_IncrRefCount(cmdPrefixObj);
- }
- }
+ */
+
+ cmdObj = Tcl_NewStringObj(name, -1);
+ cmdPrefixObj = Tcl_NewListObj(1, &cmdObj);
+ Tcl_SetHashValue(hPtr, cmdPrefixObj);
+ Tcl_IncrRefCount(cmdPrefixObj);
+ }
+ }
} else if (mapDict) {
- /*
- * No subcmd list, but there is a mapping dictionary, so
- * use the keys of that. Convert the contents of the dictionary into the
- * form required for the internal hashtable of the ensemble.
- */
-
- Tcl_DictSearch dictSearch;
- Tcl_Obj *keyObj, *valueObj;
- int done;
-
- Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch,
- &keyObj, &valueObj, &done);
- while (!done) {
- const char *name = TclGetString(keyObj);
-
- hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
- Tcl_SetHashValue(hPtr, valueObj);
- Tcl_IncrRefCount(valueObj);
- Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done);
- }
+ /*
+ * No subcmd list, but there is a mapping dictionary, so
+ * use the keys of that. Convert the contents of the dictionary into the
+ * form required for the internal hashtable of the ensemble.
+ */
+
+ Tcl_DictSearch dictSearch;
+ Tcl_Obj *keyObj, *valueObj;
+ int done;
+
+ Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch,
+ &keyObj, &valueObj, &done);
+ while (!done) {
+ const char *name = TclGetString(keyObj);
+
+ hPtr = Tcl_CreateHashEntry(hash, name, &isNew);
+ Tcl_SetHashValue(hPtr, valueObj);
+ Tcl_IncrRefCount(valueObj);
+ Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done);
+ }
} else {
/*
* Use the array of patterns and the hash table whose keys are the
@@ -3011,7 +3011,7 @@ TclCompileEnsemble(
* Exact match! Excellent!
*/
- result = Tcl_DictObjGet(NULL, mapObj,elems[i], &targetCmdObj);
+ result = Tcl_DictObjGet(NULL, mapObj, elems[i], &targetCmdObj);
if (result != TCL_OK || targetCmdObj == NULL) {
goto tryCompileToInv;
}
@@ -3193,9 +3193,9 @@ TclCompileEnsemble(
*/
while (mapPtr->nuloc > eclIndex + 1) {
- mapPtr->nuloc--;
- Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
- mapPtr->loc[mapPtr->nuloc].line = NULL;
+ mapPtr->nuloc--;
+ Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
+ mapPtr->loc[mapPtr->nuloc].line = NULL;
}
/*
@@ -3451,7 +3451,7 @@ CompileToInvokedCommand(
* Do the replacing dispatch.
*/
- TclEmitInvoke(envPtr, INST_INVOKE_REPLACE, parsePtr->numWords,numWords+1);
+ TclEmitInvoke(envPtr, INST_INVOKE_REPLACE, parsePtr->numWords, numWords+1);
}
/*