Seth Woolley's Man Viewer

Tcl_GetIntFromObj(3) - Tcl_GetIntFromObj, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj - manipulate Tcl objects as integers and wide integers - man 3 Tcl_GetIntFromObj

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

Tcl_IntObj(3)               Tcl Library Procedures               Tcl_IntObj(3)



______________________________________________________________________________

NAME
       Tcl_NewIntObj,    Tcl_NewLongObj,   Tcl_NewWideIntObj,   Tcl_SetIntObj,
       Tcl_SetLongObj, Tcl_SetWideIntObj,  Tcl_GetIntFromObj,  Tcl_GetLongFro-
       mObj,  Tcl_GetWideIntFromObj  -  manipulate Tcl objects as integers and
       wide integers

SYNOPSIS
       #include <tcl.h>

       Tcl_Obj *
       Tcl_NewIntObj(intValue)

       Tcl_Obj *
       Tcl_NewLongObj(longValue)

       Tcl_Obj *                                                               |
       Tcl_NewWideIntObj(wideValue)                                            |

       Tcl_SetIntObj(objPtr, intValue)

       Tcl_SetLongObj(objPtr, longValue)

       Tcl_SetWideIntObj(objPtr, wideValue)                                    |

       int
       Tcl_GetIntFromObj(interp, objPtr, intPtr)

       int
       Tcl_GetLongFromObj(interp, objPtr, longPtr)

       int                                                                     |
       Tcl_GetWideIntFromObj(interp, objPtr, widePtr)                          |

ARGUMENTS
       int           intValue  (in(1,8))      Integer value used to  initialize  or
                                         set(7,n,1 builtins) an integer object.

       long          longValue (in(1,8))      Long integer value used to initialize
                                         or set(7,n,1 builtins) an integer object.

       Tcl_WideInt   wideValue (in(1,8))      Wide integer value  (minimum  64-bits |
                                         wide where supported by the compiler) |
                                         used to  initialize  or  set(7,n,1 builtins)  a  wide |
                                         integer object.

       Tcl_Obj       *objPtr   (in(1,8)/out)  For   Tcl_SetIntObj,  Tcl_SetLongObj,
                                         and Tcl_SetWideIntObj, this points to |
                                         the object to be converted to integer |
                                         type.      For     Tcl_GetIntFromObj, |
                                         Tcl_GetLongFromObj,               and |
                                         Tcl_GetWideIntFromObj, this refers to |
                                         the object from which to get an inte- |
                                         ger or long integer value; if(3,n)  objPtr |
                                         does  not already point to an integer |
                                         object (or a wide integer  object  in(1,8) |
                                         the  case  of  Tcl_SetWideIntObj  and |
                                         Tcl_GetWideIntFromObj,)  an   attempt
                                         will be made to convert it to one.

       Tcl_Interp    *interp   (in(1,8)/out)  If an error(8,n) occurs during conversion,
                                         an  error(8,n)  message  is  left  in(1,8)  the
                                         interpreter's  result  object  unless
                                         interp is NULL.

       int           *intPtr   (out)     Points to place to store the  integer
                                         value  obtained  by Tcl_GetIntFromObj
                                         from objPtr.

       long          *longPtr  (out)     Points to place  to  store  the  long
                                         integer  value  obtained  by Tcl_Get-
                                         LongFromObj from objPtr.

       Tcl_WideInt   *widePtr  (out)     Points to place  to  store  the  wide |
                                         integer     value     obtained     by |
                                         Tcl_GetWideIntFromObj from objPtr.
_________________________________________________________________


DESCRIPTION
       These procedures are used to create, modify, and read(2,n,1 builtins) integer and  wide
       integer  Tcl  objects  from  C  code.   Tcl_NewIntObj,  Tcl_NewLongObj,
       Tcl_SetIntObj, and Tcl_SetLongObj create a new object of  integer  type
       or  modify  an existing object to have integer type, and Tcl_NewWideIn- |
       tObj and Tcl_SetWideIntObj create a new object of wide integer type  or |
       modify an existing object to have wide integer type.  Tcl_NewIntObj and
       Tcl_SetIntObj set(7,n,1 builtins) the object to have the integer value  given  by  int-
       Value,  Tcl_NewLongObj  and  Tcl_SetLongObj  set(7,n,1 builtins) the object to have the
       long integer  value  given  by  longValue,  and  Tcl_NewWideIntObj  and |
       Tcl_SetWideIntObj  set(7,n,1 builtins)  the object to have the wide integer value given |
       by  wideValue.   Tcl_NewIntObj,  Tcl_NewLongObj  and  Tcl_NewWideIntObj |
       return  a  pointer to a newly created object with reference count zero. |
       These procedures set(7,n,1 builtins) the object's type to be  integer  and  assign  the |
       integer  value  to  the  object's  internal representation longValue or |
       wideValue member (as appropriate).  Tcl_SetIntObj,  Tcl_SetLongObj  and |
       Tcl_SetWideIntObj  invalidate any old string(3,n) representation and, if(3,n) the
       object is not already an integer object, free any old  internal  repre-
       sentation.

       Tcl_GetIntFromObj  and  Tcl_GetLongFromObj attempt to return an integer
       value from the Tcl object objPtr, and Tcl_GetWideIntFromObj attempts to |
       return  a wide integer value from the Tcl object objPtr.  If the object |
       is not already an integer object, or a wide integer object in(1,8) the  case |
       of Tcl_GetWideIntFromObj they will attempt to convert it to one.  If an
       error(8,n) occurs during conversion, they  return  TCL_ERROR  and  leave  an
       error(8,n) message in(1,8) the interpreter's result object unless interp is NULL.
       Also, if(3,n) the long integer held in(1,8) the object's internal  representation
       longValue  member  can  not  be  represented  in(1,8)  a (non-long) integer,
       Tcl_GetIntFromObj returns TCL_ERROR and leaves an error(8,n) message in(1,8)  the
       interpreter's  result  object  unless  interp  is NULL.  Otherwise, all
       three procedures return TCL_OK and  store  the  integer,  long  integer
       value  or  wide  integer  in(1,8)  the  address given by intPtr, longPtr and |
       widePtr respectively.  If the object is not already an integer or  wide
       integer  object,  the conversion will free any old internal representa-
       tion.


SEE ALSO
       Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult


KEYWORDS
       integer, integer object, integer type, internal representation, object,
       object type, string(3,n) representation



Tcl                                   8.0                        Tcl_IntObj(3)

References for this manual (incoming links)