1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
|
3 |
|
|
'\"
|
4 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
5 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
6 |
|
|
'\"
|
7 |
|
|
'\" RCS: @(#) $Id: BoolObj.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
|
8 |
|
|
'\"
|
9 |
|
|
.so man.macros
|
10 |
|
|
.TH Tcl_BooleanObj 3 8.0 Tcl "Tcl Library Procedures"
|
11 |
|
|
.BS
|
12 |
|
|
.SH NAME
|
13 |
|
|
Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj \- manipulate Tcl objects as boolean values
|
14 |
|
|
.SH SYNOPSIS
|
15 |
|
|
.nf
|
16 |
|
|
\fB#include \fR
|
17 |
|
|
.sp
|
18 |
|
|
Tcl_Obj *
|
19 |
|
|
\fBTcl_NewBooleanObj\fR(\fIboolValue\fR)
|
20 |
|
|
.sp
|
21 |
|
|
\fBTcl_SetBooleanObj\fR(\fIobjPtr, boolValue\fR)
|
22 |
|
|
.sp
|
23 |
|
|
int
|
24 |
|
|
\fBTcl_GetBooleanFromObj\fR(\fIinterp, objPtr, boolPtr\fR)
|
25 |
|
|
.SH ARGUMENTS
|
26 |
|
|
.AS Tcl_Interp *interp
|
27 |
|
|
.AP int boolValue in
|
28 |
|
|
Integer value used to initialize or set a boolean object.
|
29 |
|
|
If the integer is nonzero, the boolean object is set to 1;
|
30 |
|
|
otherwise the boolean object is set to 0.
|
31 |
|
|
.AP Tcl_Obj *objPtr in/out
|
32 |
|
|
For \fBTcl_SetBooleanObj\fR, this points to the object to be converted
|
33 |
|
|
to boolean type.
|
34 |
|
|
For \fBTcl_GetBooleanFromObj\fR, this refers to the object
|
35 |
|
|
from which to get a boolean value;
|
36 |
|
|
if \fIobjPtr\fR does not already point to a boolean object,
|
37 |
|
|
an attempt will be made to convert it to one.
|
38 |
|
|
.AP Tcl_Interp *interp in/out
|
39 |
|
|
If an error occurs during conversion,
|
40 |
|
|
an error message is left in the interpreter's result object
|
41 |
|
|
unless \fIinterp\fR is NULL.
|
42 |
|
|
.AP int *boolPtr out
|
43 |
|
|
Points to place where \fBTcl_GetBooleanFromObj\fR
|
44 |
|
|
stores the boolean value (0 or 1) obtained from \fIobjPtr\fR.
|
45 |
|
|
.BE
|
46 |
|
|
|
47 |
|
|
.SH DESCRIPTION
|
48 |
|
|
.PP
|
49 |
|
|
These procedures are used to create, modify, and read
|
50 |
|
|
boolean Tcl objects from C code.
|
51 |
|
|
\fBTcl_NewBooleanObj\fR and \fBTcl_SetBooleanObj\fR
|
52 |
|
|
will create a new object of boolean type
|
53 |
|
|
or modify an existing object to have boolean type.
|
54 |
|
|
Both of these procedures set the object to have the
|
55 |
|
|
boolean value (0 or 1) specified by \fIboolValue\fR;
|
56 |
|
|
if \fIboolValue\fR is nonzero, the object is set to 1,
|
57 |
|
|
otherwise to 0.
|
58 |
|
|
\fBTcl_NewBooleanObj\fR returns a pointer to a newly created object
|
59 |
|
|
with reference count zero.
|
60 |
|
|
Both procedures set the object's type to be boolean
|
61 |
|
|
and assign the boolean value to the object's internal representation
|
62 |
|
|
\fIlongValue\fR member.
|
63 |
|
|
\fBTcl_SetBooleanObj\fR invalidates any old string representation
|
64 |
|
|
and, if the object is not already a boolean object,
|
65 |
|
|
frees any old internal representation.
|
66 |
|
|
.PP
|
67 |
|
|
\fBTcl_GetBooleanFromObj\fR attempts to return a boolean value
|
68 |
|
|
from the Tcl object \fIobjPtr\fR.
|
69 |
|
|
If the object is not already a boolean object,
|
70 |
|
|
it will attempt to convert it to one.
|
71 |
|
|
If an error occurs during conversion, it returns \fBTCL_ERROR\fR
|
72 |
|
|
and leaves an error message in the interpreter's result object
|
73 |
|
|
unless \fIinterp\fR is NULL.
|
74 |
|
|
Otherwise, \fBTcl_GetBooleanFromObj\fR returns \fBTCL_OK\fR
|
75 |
|
|
and stores the boolean value in the address given by \fIboolPtr\fR.
|
76 |
|
|
If the object is not already a boolean object,
|
77 |
|
|
the conversion will free any old internal representation.
|
78 |
|
|
|
79 |
|
|
.SH "SEE ALSO"
|
80 |
|
|
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
|
81 |
|
|
|
82 |
|
|
.SH KEYWORDS
|
83 |
|
|
boolean, boolean object, boolean type, internal representation, object, object type, string representation
|