~ubuntu-branches/ubuntu/feisty/python-numpy/feisty

« back to all changes in this revision

Viewing changes to numpy/core/include/numpy/arrayscalars.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-07-12 10:00:24 UTC
  • Revision ID: james.westby@ubuntu.com-20060712100024-5lw9q2yczlisqcrt
Tags: upstream-0.9.8
ImportĀ upstreamĀ versionĀ 0.9.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _MULTIARRAYMODULE
 
2
typedef struct {
 
3
        PyObject_HEAD
 
4
        Bool obval;
 
5
} PyBoolScalarObject;
 
6
#endif
 
7
 
 
8
 
 
9
typedef struct {
 
10
        PyObject_HEAD
 
11
        signed char obval;
 
12
} PyByteScalarObject;
 
13
 
 
14
 
 
15
typedef struct {
 
16
        PyObject_HEAD
 
17
        short obval;
 
18
} PyShortScalarObject;
 
19
 
 
20
 
 
21
typedef struct {
 
22
        PyObject_HEAD
 
23
        int obval;
 
24
} PyIntScalarObject;
 
25
 
 
26
 
 
27
typedef struct {
 
28
        PyObject_HEAD
 
29
        long obval;
 
30
} PyLongScalarObject;
 
31
 
 
32
 
 
33
typedef struct {
 
34
        PyObject_HEAD
 
35
        longlong obval;
 
36
} PyLongLongScalarObject;
 
37
 
 
38
 
 
39
typedef struct {
 
40
        PyObject_HEAD
 
41
        unsigned char obval;
 
42
} PyUByteScalarObject;
 
43
 
 
44
 
 
45
typedef struct {
 
46
        PyObject_HEAD
 
47
        unsigned short obval;
 
48
} PyUShortScalarObject;
 
49
 
 
50
 
 
51
typedef struct {
 
52
        PyObject_HEAD
 
53
        unsigned int obval;
 
54
} PyUIntScalarObject;
 
55
 
 
56
 
 
57
typedef struct {
 
58
        PyObject_HEAD
 
59
        unsigned long obval;
 
60
} PyULongScalarObject;
 
61
 
 
62
 
 
63
typedef struct {
 
64
        PyObject_HEAD
 
65
        ulonglong obval;
 
66
} PyULongLongScalarObject;
 
67
 
 
68
 
 
69
typedef struct {
 
70
        PyObject_HEAD
 
71
        float obval;
 
72
} PyFloatScalarObject;
 
73
 
 
74
 
 
75
typedef struct {
 
76
        PyObject_HEAD
 
77
        double obval;
 
78
} PyDoubleScalarObject;
 
79
 
 
80
 
 
81
typedef struct {
 
82
        PyObject_HEAD
 
83
        longdouble obval;
 
84
} PyLongDoubleScalarObject;
 
85
 
 
86
 
 
87
typedef struct {
 
88
        PyObject_HEAD
 
89
        cfloat obval;
 
90
} PyCFloatScalarObject;
 
91
 
 
92
 
 
93
typedef struct {
 
94
        PyObject_HEAD
 
95
        cdouble obval;
 
96
} PyCDoubleScalarObject;
 
97
 
 
98
 
 
99
typedef struct {
 
100
        PyObject_HEAD
 
101
        clongdouble obval;
 
102
} PyCLongDoubleScalarObject;
 
103
 
 
104
 
 
105
typedef struct {
 
106
        PyObject_HEAD
 
107
        PyObject * obval;
 
108
} PyObjectScalarObject;
 
109
 
 
110
 
 
111
typedef struct {
 
112
        PyObject_HEAD
 
113
        char obval;
 
114
} PyScalarObject;
 
115
 
 
116
#define PyStringScalarObject PyStringObject
 
117
#define PyUnicodeScalarObject PyUnicodeObject
 
118
 
 
119
typedef struct {
 
120
        PyObject_VAR_HEAD
 
121
        char *obval;
 
122
        PyArray_Descr *descr;
 
123
        int flags;
 
124
        PyObject *base;
 
125
} PyVoidScalarObject;
 
126
 
 
127
 
 
128
#define PyArrayScalar_False ((PyObject *)(&(_PyArrayScalar_BoolValues[0])))
 
129
#define PyArrayScalar_True ((PyObject *)(&(_PyArrayScalar_BoolValues[1])))
 
130
#define PyArrayScalar_FromLong(i) \
 
131
        ((PyObject *)(&(_PyArrayScalar_BoolValues[((i)!=0)])))
 
132
#define PyArrayScalar_RETURN_BOOL_FROM_LONG(i)                  \
 
133
        return Py_INCREF(PyArrayScalar_FromLong(i)), \
 
134
                PyArrayScalar_FromLong(i)
 
135
#define PyArrayScalar_RETURN_FALSE              \
 
136
        return Py_INCREF(PyArrayScalar_False),  \
 
137
                PyArrayScalar_False
 
138
#define PyArrayScalar_RETURN_TRUE               \
 
139
        return Py_INCREF(PyArrayScalar_True),   \
 
140
                PyArrayScalar_True
 
141
 
 
142
#define PyArrayScalar_New(cls) \
 
143
        Py##cls##ArrType_Type.tp_alloc(&Py##cls##ArrType_Type, 0)
 
144
#define PyArrayScalar_VAL(obj, cls)             \
 
145
        ((Py##cls##ScalarObject *)obj)->obval
 
146
#define PyArrayScalar_ASSIGN(obj, cls, val) \
 
147
        PyArrayScalar_VAL(obj, cls) = val