annotate DEPENDENCIES/mingw32/Python27/include/intobject.h @ 133:4acb5d8d80b6 tip

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