summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-05-18 15:43:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-05-18 15:43:21 (GMT)
commitf063018fe11304895ff9ac81830ac933c831ca5f (patch)
tree678c51cb9c004400d22c5f60e2a86515ab70ec8a /generic/tclInt.h
parent51a0c200366a96df5068e05042f8a70c7243423f (diff)
downloadtcl-f063018fe11304895ff9ac81830ac933c831ca5f.zip
tcl-f063018fe11304895ff9ac81830ac933c831ca5f.tar.gz
tcl-f063018fe11304895ff9ac81830ac933c831ca5f.tar.bz2
* generic/tclInt.h: Revision to the "boolean" Tcl_ObjType, so
* generic/tclObj.c: that only string values like "yes" and "false" * tests/obj.test: are kept as the "boolean" Tcl_ObjType. The string values "0" and "1" are kept as "int" Tcl_ObjType, which also produce quick calls to Tcl_GetBooleanFromObj(). Since this internal change means a Tcl_ConvertToType to a "boolean" Tcl_ObjType might not produce a Tcl_Obj of type "boolean", the registration of the "boolean" type is also removed. ***POTENTIAL INCOMPATIBILITY*** For callers of Tcl_GetObjType on the type name "boolean".
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 0a05edb..0aa7f5a 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.229 2005/05/10 18:34:42 kennykb Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.230 2005/05/18 15:43:36 dgp Exp $
*/
#ifndef _TCLINT
@@ -2782,9 +2782,15 @@ MODULE_SCOPE void TclBNInitBignumFromLong( mp_int* bignum, long initVal );
#define TclSetLongObj(objPtr, l) \
TclSetIntObj((objPtr), (l))
+/*
+ * NOTE: There is to be no such thing as a "pure" boolean.
+ * Boolean values set programmatically go straight to being
+ * "int" Tcl_Obj's, with value 0 or 1. The only "boolean"
+ * Tcl_Obj's shall be those holding the cached boolean value
+ * of strings like: "yes", "no", "true", "false", "on", "off".
+ */
#define TclSetBooleanObj(objPtr, b) \
- TclSetIntObj((objPtr), ((b)? 1 : 0));\
- (objPtr)->typePtr = &tclBooleanType
+ TclSetIntObj((objPtr), ((b)? 1 : 0));
#define TclSetWideIntObj(objPtr, w) \
TclInvalidateStringRep(objPtr);\
@@ -2832,9 +2838,12 @@ MODULE_SCOPE void TclBNInitBignumFromLong( mp_int* bignum, long initVal );
#define TclNewLongObj(objPtr, l) \
TclNewIntObj((objPtr), (l))
+/*
+ * NOTE: There is to be no such thing as a "pure" boolean.
+ * See comment above TclSetBooleanObj macro above.
+ */
#define TclNewBooleanObj(objPtr, b) \
- TclNewIntObj((objPtr), ((b)? 1 : 0));\
- (objPtr)->typePtr = &tclBooleanType
+ TclNewIntObj((objPtr), ((b)? 1 : 0))
#define TclNewWideIntObj(objPtr, w) \
TclIncrObjsAllocated(); \