Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj − store/retrieve boolean value in a Tcl_Obj


#include <tcl.h>

Tcl_Obj *

Tcl_SetBooleanObj(objPtr, boolValue)

(interp, objPtr, boolPtr)


int boolValue (in)

Integer value to be stored as a boolean value in a Tcl_Obj.

Tcl_Obj *objPtr (in/out)

Points to the Tcl_Obj in which to store, or from which to retrieve a boolean value.

Tcl_Interp *interp (in/out)

If a boolean value cannot be retrieved, an error message is left in the interpreter’s result object unless interp is NULL.

int *boolPtr (out)

Points to place where Tcl_GetBooleanFromObj stores the boolean value (0 or 1) obtained from objPtr.



These procedures are used to pass boolean values to and from Tcl as Tcl_Obj’s. When storing a boolean value into a Tcl_Obj, any non-zero integer value in boolValue is taken to be the boolean value 1, and the integer value 0 is taken to be the boolean value 0.

Tcl_NewBooleanObj creates a new Tcl_Obj, stores the boolean value boolValue in it, and returns a pointer to the new Tcl_Obj. The new Tcl_Obj has reference count of zero.

Tcl_SetBooleanObj accepts objPtr, a pointer to an existing Tcl_Obj, and stores in the Tcl_Obj *objPtr the boolean value boolValue. This is a write operation on *objPtr, so objPtr must be unshared. Attempts to write to a shared Tcl_Obj will panic. A successful write of boolValue into *objPtr implies the freeing of any former value stored in *objPtr.

Tcl_GetBooleanFromObj attempts to retrieve a boolean value from the value stored in *objPtr. If objPtr holds a string value recognized by Tcl_GetBoolean, then the recognized boolean value is written at the address given by boolPtr. If objPtr holds any value recognized as a number by Tcl, then if that value is zero a 0 is written at the address given by boolPtr and if that value is non-zero a 1 is written at the address given by boolPtr. In all cases where a value is written at the address given by boolPtr, Tcl_GetBooleanFromObj returns TCL_OK. If the value of objPtr does not meet any of the conditions above, then TCL_ERROR is returned and an error message is left in the interpreter’s result unless interp is NULL. Tcl_GetBooleanFromObj may also make changes to the internal fields of *objPtr so that future calls to Tcl_GetBooleanFromObj on the same objPtr can be performed more efficiently.

Note that the routines Tcl_GetBooleanFromObj and Tcl_GetBoolean are not functional equivalents. The set of values for which Tcl_GetBooleanFromObj will return TCL_OK is strictly larger than the set of values for which Tcl_GetBoolean will do the same. For example, the value “5” passed to Tcl_GetBooleanFromObj will lead to a TCL_OK return (and the boolean value 1), while the same value passed to Tcl_GetBoolean will lead to a TCL_ERROR return.


Tcl_NewObj, Tcl_IsShared, Tcl_GetBoolean


boolean, object

More Linux Commands

ExtUtils::Install(3pm) - install files from here to there...
Handles the installing and uninstalling of perl modules, scripts, man pages, etc... Both install() and uninstall() are specific to the way ExtUtils::MakeMaker h

multipath.conf(5) - multipath daemon configuration file.....
multipath.conf is the configuration file for the multipath daemon. It is used to overwrite the built-in configuration table of multipathd. Any line whose first

cvsps(1) create patchset information from CVS (Man Page)....
CVSps is a program for generating patchset information from a CVS repository. A patchset in this case is defined as a set of changes made to a collection of fil

key_decryptsession(3) - interfaces to rpc keyserver daemon
The functions here are used within the RPCs secure authentication mechanism (AUTH_DES). There should be no need for user programs to use this functions. The fun

systemd-machined(8) Virtual machine and container registrati
systemd-machined is a system service that keeps track of virtual machines and containers, and processes belonging to them. See systemd-nspawn(1) for some exampl

aa_find_mountpoint(2) - find where the apparmor interface fi
The aa_is_enabled function returns true (1) if apparmor is enabled. If it isnt it sets the errno to reflect the reason it is not enabled and returns 0. The aa_f

glutDisplayFunc(3) - sets the display callback for the curre
glutDisplayFunc sets the display callback for the current window. When GLUT determines that the normal plane for the window needs to be redisplayed, the display

glPolygonStipple(3gl) - set the polygon stippling pattern...
Polygon stippling, like line stippling (see glLineStipple), masks out certain fragments produced by rasterization, creating a pattern. Stippling is independent

XInstallColormap(3) - control colormaps - Linux manual page
The XInstallColormap function installs the specified colormap for its associated screen. All windows associated with this colormap immediately display with true

SQL::Dialects::CSV(3pm) - (unknown subject) - Linux man page
This package provides the necessary configuration for CSV SQL . FUNCTIONS get_config Returns the configuration for CSV SQL . The configuration is delivered in i

clock_nanosleep(2) - high-resolution sleep with specifiable
Like nanosleep(2), clock_nanosleep() allows the calling thread to sleep for an interval specified with nanosecond precision. It differs in allowing the caller t

smiquery(1) - query single information from SMI MIB modules
The smiquery program is used to query information on a single item from an MIB module, e.g. module meta information or a single type definition. OPTIONS -V, --v

We can't live, work or learn in freedom unless the software we use is free.