summaryrefslogtreecommitdiffstats
path: root/generic/tclGet.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-07 18:59:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-07 18:59:37 (GMT)
commit2799ad9f6c20f61947f9ab30a8a884a0d2e359a6 (patch)
treea1d594e13992b8c511f4e96743170a1ff01699b4 /generic/tclGet.c
parent622d68eaef01f805e3e214a12128488c505fd3d2 (diff)
parent12f23af5456f4a87b8bc4d58f9dcfc0edf2c9676 (diff)
downloadtcl-2799ad9f6c20f61947f9ab30a8a884a0d2e359a6.zip
tcl-2799ad9f6c20f61947f9ab30a8a884a0d2e359a6.tar.gz
tcl-2799ad9f6c20f61947f9ab30a8a884a0d2e359a6.tar.bz2
Merge 8.7
Diffstat (limited to 'generic/tclGet.c')
-rw-r--r--generic/tclGet.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/generic/tclGet.c b/generic/tclGet.c
index 905038f..bb3f8f1 100644
--- a/generic/tclGet.c
+++ b/generic/tclGet.c
@@ -110,7 +110,7 @@ Tcl_GetDouble(
* string.
*
* Results:
- * The return value is normally TCL_OK; in this case *intPtr will be set
+ * The return value is normally TCL_OK; in this case *charPtr will be set
* to the 0/1 value equivalent to src. If src is improperly formed then
* TCL_ERROR is returned and an error message will be left in the
* interp's result.
@@ -121,17 +121,23 @@ Tcl_GetDouble(
*----------------------------------------------------------------------
*/
+#undef Tcl_GetBool
+#undef Tcl_GetBoolFromObj
int
-Tcl_GetBoolean(
+Tcl_GetBool(
Tcl_Interp *interp, /* Interpreter used for error reporting. */
const char *src, /* String containing one of the boolean values
* 1, 0, true, false, yes, no, on, off. */
- int *intPtr) /* Place to store converted result, which will
+ int flags,
+ char *charPtr) /* Place to store converted result, which will
* be 0 or 1. */
{
Tcl_Obj obj;
int code;
+ if ((src == NULL) || (*src == '\0')) {
+ return Tcl_GetBoolFromObj(interp, NULL, flags, charPtr);
+ }
obj.refCount = 1;
obj.bytes = (char *) src;
obj.length = strlen(src);
@@ -142,10 +148,22 @@ Tcl_GetBoolean(
Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
}
if (code == TCL_OK) {
- TclGetBooleanFromObj(NULL, &obj, intPtr);
+ Tcl_GetBoolFromObj(NULL, &obj, flags, charPtr);
}
return code;
}
+
+#undef Tcl_GetBoolean
+int
+Tcl_GetBoolean(
+ Tcl_Interp *interp, /* Interpreter used for error reporting. */
+ const char *src, /* String containing one of the boolean values
+ * 1, 0, true, false, yes, no, on, off. */
+ int *intPtr) /* Place to store converted result, which will
+ * be 0 or 1. */
+{
+ return Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof(int), (char *)(void *)intPtr);
+}
/*
* Local Variables: