~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_PythonSeq.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * along with this program; if not, write to the Free Software Foundation,
16
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
 *
18
 
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19
 
 * All rights reserved.
20
 
 *
21
 
 * The Original Code is: none of this file.
22
 
 *
23
18
 * Contributor(s): Campbell Barton
24
19
 *
25
20
 * ***** END GPL LICENSE BLOCK *****
63
58
        return 0;
64
59
}
65
60
 
66
 
static void KX_PythonSeq_dealloc(KX_PythonSeq * self)
 
61
static void KX_PythonSeq_dealloc(KX_PythonSeq *self)
67
62
{
68
63
        KX_PythonSeq_clear(self);
69
64
        PyObject_GC_Del(self);
74
69
        PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
75
70
 
76
71
        if (self_plus==NULL) {
77
 
                PyErr_SetString(PyExc_SystemError, "len(seq): "BGE_PROXY_ERROR_MSG);
 
72
                PyErr_SetString(PyExc_SystemError, "len(seq): " BGE_PROXY_ERROR_MSG);
78
73
                return -1;
79
74
        }
80
75
        
105
100
        PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
106
101
         
107
102
        if (self_plus==NULL) {
108
 
                PyErr_SetString(PyExc_SystemError, "val = seq[i]: "BGE_PROXY_ERROR_MSG);
 
103
                PyErr_SetString(PyExc_SystemError, "val = seq[i]: " BGE_PROXY_ERROR_MSG);
109
104
                return NULL;
110
105
        }
111
106
        
189
184
        return NULL;
190
185
}
191
186
 
192
 
static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, const char *key)
 
187
static PyObjectPlus *KX_PythonSeq_subscript__internal(PyObject *self, const char *key)
193
188
{
194
189
        PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
195
190
        
264
259
}
265
260
 
266
261
 
267
 
static PyObject * KX_PythonSeq_subscript(PyObject *self, PyObject *key)
 
262
static PyObject *KX_PythonSeq_subscript(PyObject *self, PyObject *key)
268
263
{
269
264
        PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
270
265
        
271
266
        if (self_plus==NULL) {
272
 
                PyErr_SetString(PyExc_SystemError, "val = seq[key], KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
 
267
                PyErr_SetString(PyExc_SystemError, "val = seq[key], KX_PythonSeq: " BGE_PROXY_ERROR_MSG);
273
268
                return NULL;
274
269
        }
275
270
        
299
294
        PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
300
295
        
301
296
        if (self_plus==NULL) {
302
 
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
 
297
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: " BGE_PROXY_ERROR_MSG);
303
298
                return -1;
304
299
        }
305
300
        if (!PyUnicode_Check(key)) {
330
325
        return def;
331
326
}
332
327
 
333
 
PySequenceMethods KX_PythonSeq_as_sequence = {
 
328
static PySequenceMethods KX_PythonSeq_as_sequence = {
334
329
        NULL,           /* Cant set the len otherwise it can evaluate as false */
335
330
        NULL,           /* sq_concat */
336
331
        NULL,           /* sq_repeat */
349
344
        0,      /* mp_ass_subscript */
350
345
};
351
346
 
352
 
PyMethodDef KX_PythonSeq_methods[] = {
 
347
static PyMethodDef KX_PythonSeq_methods[] = {
353
348
        // dict style access for props
354
349
        {"get",(PyCFunction) KX_PythonSeq_get, METH_VARARGS},
355
350
        {NULL,NULL} //Sentinel
362
357
static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self)
363
358
{
364
359
        if (BGE_PROXY_REF(self->base)==NULL) {
365
 
                PyErr_SetString(PyExc_SystemError, "for i in seq: "BGE_PROXY_ERROR_MSG);
 
360
                PyErr_SetString(PyExc_SystemError, "for i in seq: " BGE_PROXY_ERROR_MSG);
366
361
                return NULL;
367
362
        }
368
363
        
394
389
}
395
390
 
396
391
 
397
 
static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b )
 
392
static int KX_PythonSeq_compare(KX_PythonSeq *a, KX_PythonSeq *b)
398
393
{
399
 
        return ( a->type == b->type && a->base == b->base) ? 0 : -1;
 
394
        return (a->type == b->type && a->base == b->base) ? 0 : -1;
400
395
}
401
396
 
402
397
static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op)
434
429
 * repr function
435
430
 * convert to a list and get its string value
436
431
 */
437
 
static PyObject *KX_PythonSeq_repr( KX_PythonSeq * self )
 
432
static PyObject *KX_PythonSeq_repr(KX_PythonSeq *self)
438
433
{
439
434
        PyObject *list = PySequence_List((PyObject *)self);
440
435
        PyObject *repr = PyObject_Repr(list);