Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tcl_newbooleanobj(3tcl) [opensolaris man page]

Tcl_BooleanObj(3TCL)					      Tcl Library Procedures					      Tcl_BooleanObj(3TCL)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj - manipulate Tcl objects as boolean values SYNOPSIS
#include <tcl.h> Tcl_Obj * Tcl_NewBooleanObj(boolValue) Tcl_SetBooleanObj(objPtr, boolValue) int Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) ARGUMENTS
int boolValue (in) Integer value used to initialize or set a boolean object. If the integer is nonzero, the boolean object is set to 1; otherwise the boolean object is set to 0. Tcl_Obj *objPtr (in/out) For Tcl_SetBooleanObj, this points to the object to be converted to boolean type. For Tcl_GetBooleanFro- mObj, this refers to the object from which to get a boolean value; if objPtr does not already point to a boolean object, an attempt will be made to convert it to one. Tcl_Interp *interp (in/out) If an error occurs during conversion, 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. _________________________________________________________________ DESCRIPTION
These procedures are used to create, modify, and read boolean Tcl objects from C code. Tcl_NewBooleanObj and Tcl_SetBooleanObj will create a new object of boolean type or modify an existing object to have boolean type. Both of these procedures set the object to have the bool- ean value (0 or 1) specified by boolValue; if boolValue is nonzero, the object is set to 1, otherwise to 0. Tcl_NewBooleanObj returns a pointer to a newly created object with reference count zero. Both procedures set the object's type to be boolean and assign the boolean value to the object's internal representation longValue member. Tcl_SetBooleanObj invalidates any old string representation and, if the object is not already a boolean object, frees any old internal representation. Tcl_GetBooleanFromObj attempts to return a boolean value from the Tcl object objPtr. If the object is not already a boolean object, it will attempt to convert it to one. If an error occurs during conversion, it returns TCL_ERROR and leaves an error message in the inter- preter's result object unless interp is NULL. Otherwise, Tcl_GetBooleanFromObj returns TCL_OK and stores the boolean value in the address given by boolPtr. If the object is not already a boolean object, the conversion will free any old internal representation. Objects having a string representation equal to any of 0, false, no, or off have a boolean value 0; if the string representation is any of 1, true, yes, or on the boolean value is 1. Any of these string values may be abbreviated, and upper-case spellings are also acceptable. SEE ALSO
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult KEYWORDS
boolean, boolean object, boolean type, internal representation, object, object type, string representation ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl 8.0 Tcl_BooleanObj(3TCL)

Check Out this Related Man Page

Tcl_BooleanObj(3)					      Tcl Library Procedures						 Tcl_BooleanObj(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj - store/retrieve boolean value in a Tcl_Obj SYNOPSIS
#include <tcl.h> Tcl_Obj * Tcl_NewBooleanObj(boolValue) Tcl_SetBooleanObj(objPtr, boolValue) int Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) ARGUMENTS
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. _________________________________________________________________ DESCRIPTION
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 retrive 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 inter- preter'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_Get- BooleanFromObj 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_Get- Boolean will lead to a TCL_ERROR return. SEE ALSO
Tcl_NewObj, Tcl_IsShared, Tcl_GetBoolean KEYWORDS
boolean, object Tcl 8.5 Tcl_BooleanObj(3)
Man Page