BoolObj.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1996-1997 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: BoolObj.3,v 1.3 2002/08/07 17:13:56 msofer Exp $
- '"
- .so man.macros
- .TH Tcl_BooleanObj 3 8.0 Tcl "Tcl Library Procedures"
- .BS
- .SH NAME
- Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj - manipulate Tcl objects as boolean values
- .SH SYNOPSIS
- .nf
- fB#include <tcl.h>fR
- .sp
- Tcl_Obj *
- fBTcl_NewBooleanObjfR(fIboolValuefR)
- .sp
- fBTcl_SetBooleanObjfR(fIobjPtr, boolValuefR)
- .sp
- int
- fBTcl_GetBooleanFromObjfR(fIinterp, objPtr, boolPtrfR)
- .SH ARGUMENTS
- .AS Tcl_Interp *interp
- .AP 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.
- .AP Tcl_Obj *objPtr in/out
- For fBTcl_SetBooleanObjfR, this points to the object to be converted
- to boolean type.
- For fBTcl_GetBooleanFromObjfR, this refers to the object
- from which to get a boolean value;
- if fIobjPtrfR does not already point to a boolean object,
- an attempt will be made to convert it to one.
- .AP Tcl_Interp *interp in/out
- If an error occurs during conversion,
- an error message is left in the interpreter's result object
- unless fIinterpfR is NULL.
- .AP int *boolPtr out
- Points to place where fBTcl_GetBooleanFromObjfR
- stores the boolean value (0 or 1) obtained from fIobjPtrfR.
- .BE
- .SH DESCRIPTION
- .PP
- These procedures are used to create, modify, and read
- boolean Tcl objects from C code.
- fBTcl_NewBooleanObjfR and fBTcl_SetBooleanObjfR
- 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
- boolean value (0 or 1) specified by fIboolValuefR;
- if fIboolValuefR is nonzero, the object is set to 1,
- otherwise to 0.
- fBTcl_NewBooleanObjfR 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
- fIlongValuefR member.
- fBTcl_SetBooleanObjfR invalidates any old string representation
- and, if the object is not already a boolean object,
- frees any old internal representation.
- .PP
- fBTcl_GetBooleanFromObjfR attempts to return a boolean value
- from the Tcl object fIobjPtrfR.
- 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 fBTCL_ERRORfR
- and leaves an error message in the interpreter's result object
- unless fIinterpfR is NULL.
- Otherwise, fBTcl_GetBooleanFromObjfR returns fBTCL_OKfR
- and stores the boolean value in the address given by fIboolPtrfR.
- 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 fB0fR,
- fBfalsefR, fBnofR, or fBofffR have a boolean value 0; if the
- string representation is any of fB1fR, fBtruefR, fByesfR, or
- fBonfR the boolean value is 1.
- Any of these string values may be abbreviated, and upper-case spellings
- are also acceptable.
- .SH "SEE ALSO"
- Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
- .SH KEYWORDS
- boolean, boolean object, boolean type, internal representation, object, object type, string representation