1Tcl_BooleanObj(3)           Tcl Library Procedures           Tcl_BooleanObj(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_NewBooleanObj,  Tcl_SetBooleanObj,  Tcl_GetBooleanFromObj - manipu‐
9       late Tcl objects as boolean values
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_Obj *
15       Tcl_NewBooleanObj(boolValue)
16
17       Tcl_SetBooleanObj(objPtr, boolValue)
18
19       int
20       Tcl_GetBooleanFromObj(interp, objPtr, boolPtr)
21

ARGUMENTS

23       int          boolValue (in)      Integer value used  to  initialize  or
24                                        set  a boolean object.  If the integer
25                                        is nonzero, the boolean object is  set
26                                        to  1; otherwise the boolean object is
27                                        set to 0.
28
29       Tcl_Obj      *objPtr   (in/out)  For Tcl_SetBooleanObj, this points  to
30                                        the  object to be converted to boolean
31                                        type.  For Tcl_GetBooleanFromObj, this
32                                        refers to the object from which to get
33                                        a boolean value; if  objPtr  does  not
34                                        already  point to a boolean object, an
35                                        attempt will be made to convert it  to
36                                        one.
37
38       Tcl_Interp   *interp   (in/out)  If  an error occurs during conversion,
39                                        an error message is left in the inter‐
40                                        preter's  result  object unless interp
41                                        is NULL.
42
43       int          *boolPtr  (out)     Points to place where  Tcl_GetBoolean‐
44                                        FromObj stores the boolean value (0 or
45                                        1) obtained from objPtr.
46_________________________________________________________________
47
48

DESCRIPTION

50       These procedures are used to  create,  modify,  and  read  boolean  Tcl
51       objects from C code.  Tcl_NewBooleanObj and Tcl_SetBooleanObj will cre‐
52       ate a new object of boolean type or modify an existing object  to  have
53       boolean  type.   Both  of  these  procedures set the object to have the
54       boolean value (0 or 1) specified by boolValue; if boolValue is nonzero,
55       the  object  is  set to 1, otherwise to 0.  Tcl_NewBooleanObj returns a
56       pointer to a newly created object with reference count zero.  Both pro‐
57       cedures  set  the  object's  type  to be boolean and assign the boolean
58       value  to  the  object's  internal  representation  longValue   member.
59       Tcl_SetBooleanObj invalidates any old string representation and, if the
60       object is not already a boolean object, frees any old  internal  repre‐
61       sentation.
62
63       Tcl_GetBooleanFromObj  attempts  to return a boolean value from the Tcl
64       object objPtr.  If the object is not already a boolean object, it  will
65       attempt to convert it to one.  If an error occurs during conversion, it
66       returns TCL_ERROR and leaves an  error  message  in  the  interpreter's
67       result  object unless interp is NULL.  Otherwise, Tcl_GetBooleanFromObj
68       returns TCL_OK and stores the boolean value in  the  address  given  by
69       boolPtr.  If the object is not already a boolean object, the conversion
70       will free any old internal representation.   Objects  having  a  string
71       representation  equal  to  any  of  0, false, no, or off have a boolean
72       value 0; if the string representation is any of 1, true, yes, or on the
73       boolean value is 1.  Any of these string values may be abbreviated, and
74       upper-case spellings are also acceptable.
75
76

SEE ALSO

78       Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
79
80

KEYWORDS

82       boolean, boolean object, boolean type, internal representation, object,
83       object type, string representation
84
85
86
87Tcl                                   8.0                    Tcl_BooleanObj(3)
Impressum