symbian-qemu-0.9.1-12/python-win32-2.6.1/include/intobject.h
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 
       
     2 /* Integer object interface */
       
     3 
       
     4 /*
       
     5 PyIntObject represents a (long) integer.  This is an immutable object;
       
     6 an integer cannot change its value after creation.
       
     7 
       
     8 There are functions to create new integer objects, to test an object
       
     9 for integer-ness, and to get the integer value.  The latter functions
       
    10 returns -1 and sets errno to EBADF if the object is not an PyIntObject.
       
    11 None of the functions should be applied to nil objects.
       
    12 
       
    13 The type PyIntObject is (unfortunately) exposed here so we can declare
       
    14 _Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this.
       
    15 */
       
    16 
       
    17 #ifndef Py_INTOBJECT_H
       
    18 #define Py_INTOBJECT_H
       
    19 #ifdef __cplusplus
       
    20 extern "C" {
       
    21 #endif
       
    22 
       
    23 typedef struct {
       
    24     PyObject_HEAD
       
    25     long ob_ival;
       
    26 } PyIntObject;
       
    27 
       
    28 PyAPI_DATA(PyTypeObject) PyInt_Type;
       
    29 
       
    30 #define PyInt_Check(op) \
       
    31 		 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS)
       
    32 #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
       
    33 
       
    34 PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
       
    35 #ifdef Py_USING_UNICODE
       
    36 PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
       
    37 #endif
       
    38 PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
       
    39 PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
       
    40 PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
       
    41 PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
       
    42 PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
       
    43 PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
       
    44 #ifdef HAVE_LONG_LONG
       
    45 PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
       
    46 #endif
       
    47 
       
    48 PyAPI_FUNC(long) PyInt_GetMax(void);
       
    49 
       
    50 /* Macro, trading safety for speed */
       
    51 #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
       
    52 
       
    53 /* These aren't really part of the Int object, but they're handy; the protos
       
    54  * are necessary for systems that need the magic of PyAPI_FUNC and that want
       
    55  * to have stropmodule as a dynamically loaded module instead of building it
       
    56  * into the main Python shared library/DLL.  Guido thinks I'm weird for
       
    57  * building it this way.  :-)  [cjh]
       
    58  */
       
    59 PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
       
    60 PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
       
    61 
       
    62 /* free list api */
       
    63 PyAPI_FUNC(int) PyInt_ClearFreeList(void);
       
    64 
       
    65 /* Convert an integer to the given base.  Returns a string.
       
    66    If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'.
       
    67    If newstyle is zero, then use the pre-2.6 behavior of octal having
       
    68    a leading "0" */
       
    69 PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle);
       
    70 
       
    71 /* Format the object based on the format_spec, as defined in PEP 3101
       
    72    (Advanced String Formatting). */
       
    73 PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj,
       
    74 					     char *format_spec,
       
    75 					     Py_ssize_t format_spec_len);
       
    76 
       
    77 #ifdef __cplusplus
       
    78 }
       
    79 #endif
       
    80 #endif /* !Py_INTOBJECT_H */