URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [IntObj.3] - Rev 1765
Compare with Previous | Blame | View Log
'\"'\" 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: IntObj.3,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $'\".so man.macros.TH Tcl_IntObj 3 8.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_NewIntObj, Tcl_NewLongObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_GetIntFromObj, Tcl_GetLongFromObj \- manipulate Tcl objects as integers.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spTcl_Obj *\fBTcl_NewIntObj\fR(\fIintValue\fR).spTcl_Obj *\fBTcl_NewLongObj\fR(\fIlongValue\fR).sp\fBTcl_SetIntObj\fR(\fIobjPtr, intValue\fR).sp\fBTcl_SetLongObj\fR(\fIobjPtr, longValue\fR).spint\fBTcl_GetIntFromObj\fR(\fIinterp, objPtr, intPtr\fR).spint\fBTcl_GetLongFromObj\fR(\fIinterp, objPtr, longPtr\fR).SH ARGUMENTS.AS Tcl_Interp *interp.AP int intValue inInteger value used to initialize or set an integer object..AP long longValue inLong integer value used to initialize or set an integer object..AP Tcl_Obj *objPtr in/outFor \fBTcl_SetIntObj\fR and \fBTcl_SetLongObj\fR,this points to the object to be converted to integer type.For \fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fR,this refers to the objectfrom which to get an integer or long integer value;if \fIobjPtr\fR does not already point to an integer object,an attempt will be made to convert it to one..AP Tcl_Interp *interp in/outIf an error occurs during conversion,an error message is left in the interpreter's result objectunless \fIinterp\fR is NULL..AP int *intPtr outPoints to place to store the integer valueobtained by \fBTcl_GetIntFromObj\fR from \fIobjPtr\fR..AP long *longPtr outPoints to place to store the long integer valueobtained by \fBTcl_GetLongFromObj\fR from \fIobjPtr\fR..BE.SH DESCRIPTION.PPThese procedures are used to create, modify, and readinteger Tcl objects from C code.\fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR,\fBTcl_SetIntObj\fR, and \fBTcl_SetLongObj\fRcreate a new object of integer typeor modify an existing object to have integer type.\fBTcl_NewIntObj\fR and \fBTcl_SetIntObj\fR set the object to have theinteger value given by \fIintValue\fR,while \fBTcl_NewLongObj\fR and \fBTcl_SetLongObj\fRset the object to have thelong integer value given by \fIlongValue\fR.\fBTcl_NewIntObj\fR and \fBTcl_NewLongObj\fRreturn a pointer to a newly created object with reference count zero.These procedures set the object's type to be integerand assign the integer value to the object's internal representation\fIlongValue\fR member.\fBTcl_SetIntObj\fR and \fBTcl_SetLongObj\fRinvalidate any old string representation and,if the object is not already an integer object,free any old internal representation..PP\fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fRattempt to return an integer value from the Tcl object \fIobjPtr\fR.If the object is not already an integer object,they will attempt to convert it to one.If an error occurs during conversion, they return \fBTCL_ERROR\fRand leave an error message in the interpreter's result objectunless \fIinterp\fR is NULL.Also, if the long integer held in the object's internal representation\fIlongValue\fR member can not be represented in a (non-long) integer,\fBTcl_GetIntFromObj\fR returns \fBTCL_ERROR\fRand leaves an error message in the interpreter's result objectunless \fIinterp\fR is NULL.Otherwise, both procedures return \fBTCL_OK\fR andstore the integer or the long integer valuein the address given by \fIintPtr\fR and \fIlongPtr\fR respectively.If the object is not already an integer object,the conversion will free any old internal representation..SH "SEE ALSO"Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult.SH KEYWORDSinteger, integer object, integer type, internal representation, object, object type, string representation
