diff options
Diffstat (limited to 'meta-oe/recipes-devtools/python/python-pyqt-4.9.6/qreal_float_support.diff')
-rw-r--r-- | meta-oe/recipes-devtools/python/python-pyqt-4.9.6/qreal_float_support.diff | 248 |
1 files changed, 0 insertions, 248 deletions
diff --git a/meta-oe/recipes-devtools/python/python-pyqt-4.9.6/qreal_float_support.diff b/meta-oe/recipes-devtools/python/python-pyqt-4.9.6/qreal_float_support.diff deleted file mode 100644 index abdf70fab..000000000 --- a/meta-oe/recipes-devtools/python/python-pyqt-4.9.6/qreal_float_support.diff +++ /dev/null | |||
@@ -1,248 +0,0 @@ | |||
1 | ## 03_qreal_float_support.dpatch by Michael Casadevall <sonicmctails@gmail.com> | ||
2 | Index: python-qt4-4.8.3/configure.py | ||
3 | =================================================================== | ||
4 | --- python-qt4-4.8.3.orig/configure.py 2011-02-24 10:33:30.000000000 +0200 | ||
5 | +++ python-qt4-4.8.3/configure.py 2011-02-24 10:33:18.000000000 +0200 | ||
6 | @@ -2004,8 +2004,9 @@ | ||
7 | out << "PyQt_NoOpenGLES\\n"; | ||
8 | #endif | ||
9 | |||
10 | - if (sizeof (qreal) != sizeof (double)) | ||
11 | +#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) | ||
12 | out << "PyQt_qreal_double\\n"; | ||
13 | +#endif | ||
14 | |||
15 | return 0; | ||
16 | } | ||
17 | Index: python-qt4-4.8.3/sip/QtCore/qlist.sip | ||
18 | =================================================================== | ||
19 | --- python-qt4-4.8.3.orig/sip/QtCore/qlist.sip 2011-02-24 10:33:27.000000000 +0200 | ||
20 | +++ python-qt4-4.8.3/sip/QtCore/qlist.sip 2011-02-24 10:33:18.000000000 +0200 | ||
21 | @@ -811,3 +811,227 @@ | ||
22 | return sipGetState(sipTransferObj); | ||
23 | %End | ||
24 | }; | ||
25 | + | ||
26 | +// If we're on an architecture where qreal != double, then we need to also | ||
27 | +// explicately handle doubles. On architectures where qreal == double, they | ||
28 | +// will automaticially be cast upwards | ||
29 | + | ||
30 | +%If (!PyQt_qreal_double) | ||
31 | + | ||
32 | +%If (Qt_4_3_0 -) | ||
33 | +// QList<QPair<double, double> > is implemented as a Python list of 2-element tuples. | ||
34 | +%MappedType QList<QPair<double, double> > | ||
35 | +{ | ||
36 | +%TypeHeaderCode | ||
37 | +#include <qlist.h> | ||
38 | +#include <qpair.h> | ||
39 | +%End | ||
40 | + | ||
41 | +%ConvertFromTypeCode | ||
42 | + // Create the list. | ||
43 | + PyObject *l; | ||
44 | + | ||
45 | + if ((l = PyList_New(sipCpp->size())) == NULL) | ||
46 | + return NULL; | ||
47 | + | ||
48 | + // Set the list elements. | ||
49 | + for (int i = 0; i < sipCpp->size(); ++i) | ||
50 | + { | ||
51 | + const QPair<double, double> &p = sipCpp->at(i); | ||
52 | + PyObject *pobj; | ||
53 | + | ||
54 | + if ((pobj = Py_BuildValue((char *)"dd", p.first, p.second)) == NULL) | ||
55 | + { | ||
56 | + Py_DECREF(l); | ||
57 | + | ||
58 | + return NULL; | ||
59 | + } | ||
60 | + | ||
61 | + PyList_SET_ITEM(l, i, pobj); | ||
62 | + } | ||
63 | + | ||
64 | + return l; | ||
65 | +%End | ||
66 | + | ||
67 | +%ConvertToTypeCode | ||
68 | + SIP_SSIZE_T len; | ||
69 | + | ||
70 | + // Check the type if that is all that is required. | ||
71 | + if (sipIsErr == NULL) | ||
72 | + { | ||
73 | + if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) | ||
74 | + return 0; | ||
75 | + | ||
76 | + for (SIP_SSIZE_T i = 0; i < len; ++i) | ||
77 | + { | ||
78 | + PyObject *tup = PySequence_ITEM(sipPy, i); | ||
79 | + | ||
80 | + if (!PySequence_Check(tup) || PySequence_Size(tup) != 2) | ||
81 | + return 0; | ||
82 | + } | ||
83 | + | ||
84 | + return 1; | ||
85 | + } | ||
86 | + | ||
87 | + QList<QPair<double, double> > *ql = new QList<QPair<double, double> >; | ||
88 | + len = PySequence_Size(sipPy); | ||
89 | + | ||
90 | + for (SIP_SSIZE_T i = 0; i < len; ++i) | ||
91 | + { | ||
92 | + PyObject *tup = PySequence_ITEM(sipPy, i); | ||
93 | + | ||
94 | + double first = PyFloat_AsDouble(PySequence_ITEM(tup, 0)); | ||
95 | + double second = PyFloat_AsDouble(PySequence_ITEM(tup, 1)); | ||
96 | + | ||
97 | + ql->append(QPair<double, double>(first, second)); | ||
98 | + } | ||
99 | + | ||
100 | + *sipCppPtr = ql; | ||
101 | + | ||
102 | + return sipGetState(sipTransferObj); | ||
103 | +%End | ||
104 | +}; | ||
105 | +%End | ||
106 | +%If (Qt_4_3_0 -) | ||
107 | +// QList<QPair<double, TYPE> > is implemented as a Python list of 2-element tuples. | ||
108 | +template<double, TYPE> | ||
109 | +%MappedType QList<QPair<double, TYPE> > | ||
110 | +{ | ||
111 | +%TypeHeaderCode | ||
112 | +#include <qlist.h> | ||
113 | +#include <qpair.h> | ||
114 | +%End | ||
115 | + | ||
116 | +%ConvertFromTypeCode | ||
117 | + // Create the list. | ||
118 | + PyObject *l; | ||
119 | + | ||
120 | + if ((l = PyList_New(sipCpp->size())) == NULL) | ||
121 | + return NULL; | ||
122 | + | ||
123 | + // Set the list elements. | ||
124 | + for (int i = 0; i < sipCpp->size(); ++i) | ||
125 | + { | ||
126 | + const QPair<double, TYPE> &p = sipCpp->at(i); | ||
127 | + TYPE *t = new TYPE(p.second); | ||
128 | + PyObject *pobj; | ||
129 | + | ||
130 | + if ((pobj = sipBuildResult(NULL, "(dB)", p.first, t, sipClass_TYPE, sipTransferObj)) == NULL) | ||
131 | + { | ||
132 | + Py_DECREF(l); | ||
133 | + delete t; | ||
134 | + | ||
135 | + return NULL; | ||
136 | + } | ||
137 | + | ||
138 | + PyList_SET_ITEM(l, i, pobj); | ||
139 | + } | ||
140 | + | ||
141 | + return l; | ||
142 | +%End | ||
143 | + | ||
144 | +%ConvertToTypeCode | ||
145 | + SIP_SSIZE_T len; | ||
146 | + | ||
147 | + // Check the type if that is all that is required. | ||
148 | + if (sipIsErr == NULL) | ||
149 | + { | ||
150 | + if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) | ||
151 | + return 0; | ||
152 | + | ||
153 | + for (SIP_SSIZE_T i = 0; i < len; ++i) | ||
154 | + { | ||
155 | + PyObject *tup = PySequence_ITEM(sipPy, i); | ||
156 | + | ||
157 | + if (!PySequence_Check(tup) || PySequence_Size(tup) != 2) | ||
158 | + return 0; | ||
159 | + | ||
160 | + if (!sipCanConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, SIP_NOT_NONE)) | ||
161 | + return 0; | ||
162 | + } | ||
163 | + | ||
164 | + return 1; | ||
165 | + } | ||
166 | + | ||
167 | + QList<QPair<double, TYPE> > *ql = new QList<QPair<double, TYPE> >; | ||
168 | + len = PySequence_Size(sipPy); | ||
169 | + | ||
170 | + for (SIP_SSIZE_T i = 0; i < len; ++i) | ||
171 | + { | ||
172 | + PyObject *tup = PySequence_ITEM(sipPy, i); | ||
173 | + double d; | ||
174 | + int state; | ||
175 | + | ||
176 | + d = PyFloat_AsDouble(PySequence_ITEM(tup, 0)); | ||
177 | + TYPE *t = reinterpret_cast<TYPE *>(sipConvertToInstance(PySequence_ITEM(tup, 1), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); | ||
178 | + | ||
179 | + if (*sipIsErr) | ||
180 | + { | ||
181 | + sipReleaseInstance(t, sipClass_TYPE, state); | ||
182 | + | ||
183 | + delete ql; | ||
184 | + return 0; | ||
185 | + } | ||
186 | + | ||
187 | + ql->append(QPair<double, TYPE>(d, *t)); | ||
188 | + | ||
189 | + sipReleaseInstance(t, sipClass_TYPE, state); | ||
190 | + } | ||
191 | + | ||
192 | + *sipCppPtr = ql; | ||
193 | + | ||
194 | + return sipGetState(sipTransferObj); | ||
195 | +%End | ||
196 | +}; | ||
197 | +%End | ||
198 | + | ||
199 | +// QList<double> is implemented as a Python list of doubles. | ||
200 | +%MappedType QList<double> | ||
201 | +{ | ||
202 | +%TypeHeaderCode | ||
203 | +#include <qlist.h> | ||
204 | +%End | ||
205 | + | ||
206 | +%ConvertFromTypeCode | ||
207 | + // Create the list. | ||
208 | + PyObject *l; | ||
209 | + | ||
210 | + if ((l = PyList_New(sipCpp->size())) == NULL) | ||
211 | + return NULL; | ||
212 | + | ||
213 | + // Set the list elements. | ||
214 | + for (int i = 0; i < sipCpp->size(); ++i) | ||
215 | + { | ||
216 | + PyObject *pobj; | ||
217 | + | ||
218 | + if ((pobj = PyFloat_FromDouble(sipCpp->value(i))) == NULL) | ||
219 | + { | ||
220 | + Py_DECREF(l); | ||
221 | + | ||
222 | + return NULL; | ||
223 | + } | ||
224 | + | ||
225 | + PyList_SET_ITEM(l, i, pobj); | ||
226 | + } | ||
227 | + | ||
228 | + return l; | ||
229 | +%End | ||
230 | + | ||
231 | +%ConvertToTypeCode | ||
232 | + // Check the type if that is all that is required. | ||
233 | + if (sipIsErr == NULL) | ||
234 | + return (PySequence_Check(sipPy) && PySequence_Size(sipPy) >= 0); | ||
235 | + | ||
236 | + QList<double> *ql = new QList<double>; | ||
237 | + SIP_SSIZE_T len = PySequence_Size(sipPy); | ||
238 | + | ||
239 | + for (SIP_SSIZE_T i = 0; i < len; ++i) | ||
240 | + ql->append(PyFloat_AsDouble(PySequence_ITEM(sipPy, i))); | ||
241 | + | ||
242 | + *sipCppPtr = ql; | ||
243 | + | ||
244 | + return sipGetState(sipTransferObj); | ||
245 | +%End | ||
246 | +}; | ||
247 | + | ||
248 | +%End | ||