-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjswebkit.cpp
More file actions
4469 lines (4121 loc) · 176 KB
/
jswebkit.cpp
File metadata and controls
4469 lines (4121 loc) · 176 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by Cython 0.10.3 on Sun Jul 12 22:31:08 2009 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
#define PyNumber_Index(o) PyNumber_Int(o)
#define PyIndex_Check(o) PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_LOCK 0x0002
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyString_Type PyBytes_Type
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define PyBytes_Type PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#else
#define _USE_MATH_DEFINES
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__jswebkit
#include "stdlib.h"
#include "JavaScriptCore/JSBase.h"
#include "JavaScriptCore/JSStringRef.h"
#include "JavaScriptCore/JSValueRef.h"
#include "JavaScriptCore/JSObjectRef.h"
#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
static int __pyx_skip_dispatch = 0;
/* Type Conversion Predeclarations */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_AsString PyString_AsString
#else
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_AsString PyBytes_AsString
#endif
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
static INLINE char __pyx_PyInt_char(PyObject* x);
static INLINE short __pyx_PyInt_short(PyObject* x);
static INLINE int __pyx_PyInt_int(PyObject* x);
static INLINE long __pyx_PyInt_long(PyObject* x);
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
static INLINE long double __pyx_PyInt_long_double(PyObject* x);
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;
static char __pyx_mdoc[] = "\nversion 0.0003\nApplied the patches supplied by MonkeeSage Thanx :)\nThis fixes the ucs2/ucs4 bug which I had earlier\nAlso MonkeeSage fixed other things, he make call function nicer and fixed lists so the work properly\nAlso fixed his patch so it works with both ucs2/ucs4 python\nFixed the setup.py so that it can use pkg-config instead\n\nversion 0.0002\nI need a versioning system lol\ncython wrapper for JSContextRef in pywebkitgtk\nyou need cython to make it\nSo you can call Javascript functions etc from python\nMade by john paul janecek\nFree Beer copyright, do what the heck you want with it, just give me credit\nAlso do not blame me if your things blow up\nif you need to contact me, i might answer back :) I am lazy when it comes to making fixes\nunless I actually am using library myself :)\n\nmy email\nimport binascii\nbinascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n')\n";
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name); /*proto*/
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
const char* function_name, int kw_allowed); /*proto*/
static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) {
PyObject *r;
if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) {
r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
}
else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) {
r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
}
else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned))
r = PySequence_GetItem(o, i);
else {
PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i);
if (!j)
return 0;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
}
return r;
}
static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (PyList_Append(L, x) < 0) return NULL;
Py_INCREF(Py_None);
return Py_None; // this is just to have an accurate signature
}
else {
return PyObject_CallMethod(L, "append", "(O)", x);
}
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Type declarations */
typedef unsigned short __pyx_t_8jswebkit_bool;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":226
*
*
* cdef class JSContext: # <<<<<<<<<<<<<<
* cdef JSContextRef jsCtx
* cdef object ctx
*/
struct __pyx_obj_8jswebkit_JSContext {
PyObject_HEAD
JSContextRef jsCtx;
PyObject *ctx;
};
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":116
* raise ValueError
*
* cdef class JSObject: # <<<<<<<<<<<<<<
* cdef JSContextRef ctx
* cdef JSObjectRef jsObject
*/
struct __pyx_obj_8jswebkit_JSObject {
PyObject_HEAD
struct __pyx_vtabstruct_8jswebkit_JSObject *__pyx_vtab;
JSContextRef ctx;
JSObjectRef jsObject;
PyObject *propertyNames;
int index;
};
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":200
*
*
* cdef class JSFunction(JSObject): # <<<<<<<<<<<<<<
* def __init__(self) :
* JSObject.__init__(self)
*/
struct __pyx_obj_8jswebkit_JSFunction {
struct __pyx_obj_8jswebkit_JSObject __pyx_base;
};
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":116
* raise ValueError
*
* cdef class JSObject: # <<<<<<<<<<<<<<
* cdef JSContextRef ctx
* cdef JSObjectRef jsObject
*/
struct __pyx_vtabstruct_8jswebkit_JSObject {
PyObject *(*setup)(struct __pyx_obj_8jswebkit_JSObject *, JSContextRef, JSObjectRef);
};
static struct __pyx_vtabstruct_8jswebkit_JSObject *__pyx_vtabptr_8jswebkit_JSObject;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":200
*
*
* cdef class JSFunction(JSObject): # <<<<<<<<<<<<<<
* def __init__(self) :
* JSObject.__init__(self)
*/
struct __pyx_vtabstruct_8jswebkit_JSFunction {
struct __pyx_vtabstruct_8jswebkit_JSObject __pyx_base;
};
static struct __pyx_vtabstruct_8jswebkit_JSFunction *__pyx_vtabptr_8jswebkit_JSFunction;
/* Module declarations from jswebkit */
static PyTypeObject *__pyx_ptype_8jswebkit_JSObject = 0;
static PyTypeObject *__pyx_ptype_8jswebkit_JSFunction = 0;
static PyTypeObject *__pyx_ptype_8jswebkit_JSContext = 0;
static PyObject *__pyx_f_8jswebkit_jsValueToPython(JSContextRef, JSValueRef); /*proto*/
static PyObject *__pyx_f_8jswebkit_makeException(JSContextRef, JSValueRef); /*proto*/
static PyObject *__pyx_f_8jswebkit_JSStringRefToPython(JSStringRef); /*proto*/
static JSStringRef __pyx_f_8jswebkit_PythonToJSString(PyObject *); /*proto*/
static JSValueRef __pyx_f_8jswebkit_PythonTojsValue(JSContextRef, PyObject *); /*proto*/
/* Implementation of jswebkit */
static PyObject *__pyx_int_1;
static char __pyx_k___init__[] = "__init__";
static PyObject *__pyx_kp___init__;
static char __pyx_k_getPropertyNames[] = "getPropertyNames";
static PyObject *__pyx_kp_getPropertyNames;
static char __pyx_k___getattr__[] = "__getattr__";
static PyObject *__pyx_kp___getattr__;
static char __pyx_k___setattr__[] = "__setattr__";
static PyObject *__pyx_kp___setattr__;
static char __pyx_k___getitem__[] = "__getitem__";
static PyObject *__pyx_kp___getitem__;
static char __pyx_k___setitem__[] = "__setitem__";
static PyObject *__pyx_kp___setitem__;
static char __pyx_k___del__[] = "__del__";
static PyObject *__pyx_kp___del__;
static char __pyx_k___iter__[] = "__iter__";
static PyObject *__pyx_kp___iter__;
static char __pyx_k___next__[] = "__next__";
static PyObject *__pyx_kp___next__;
static char __pyx_k_next[] = "next";
static PyObject *__pyx_kp_next;
static char __pyx_k___len__[] = "__len__";
static PyObject *__pyx_kp___len__;
static char __pyx_k___call__[] = "__call__";
static PyObject *__pyx_kp___call__;
static char __pyx_k_EvaluateScript[] = "EvaluateScript";
static PyObject *__pyx_kp_EvaluateScript;
static char __pyx_k_getCtx[] = "getCtx";
static PyObject *__pyx_kp_getCtx;
static char __pyx_k_self[] = "self";
static PyObject *__pyx_kp_self;
static char __pyx_k_name[] = "name";
static PyObject *__pyx_kp_name;
static char __pyx_k_message[] = "message";
static PyObject *__pyx_kp_message;
static char __pyx_k_value[] = "value";
static PyObject *__pyx_kp_value;
static char __pyx_k_key[] = "key";
static PyObject *__pyx_kp_key;
static char __pyx_k_thisObj[] = "thisObj";
static PyObject *__pyx_kp_thisObj;
static char __pyx_k_ctx[] = "ctx";
static PyObject *__pyx_kp_ctx;
static char __pyx_k_script[] = "script";
static PyObject *__pyx_kp_script;
static char __pyx_k_thisObject[] = "thisObject";
static PyObject *__pyx_kp_thisObject;
static char __pyx_k_sourceURL[] = "sourceURL";
static PyObject *__pyx_kp_sourceURL;
static char __pyx_k_startingLineNumber[] = "startingLineNumber";
static PyObject *__pyx_kp_startingLineNumber;
static char __pyx_k_sys[] = "sys";
static PyObject *__pyx_kp_sys;
static char __pyx_k_types[] = "types";
static PyObject *__pyx_kp_types;
static char __pyx_k_JSException[] = "JSException";
static PyObject *__pyx_kp_JSException;
static char __pyx_k_Exception[] = "Exception";
static PyObject *__pyx_kp_Exception;
static char __pyx_k___str__[] = "__str__";
static PyObject *__pyx_kp___str__;
static char __pyx_k_mess[] = "mess";
static PyObject *__pyx_kp_mess;
static char __pyx_k_encode[] = "encode";
static PyObject *__pyx_kp_encode;
static char __pyx_k_NoneType[] = "NoneType";
static PyObject *__pyx_kp_NoneType;
static char __pyx_k_BooleanType[] = "BooleanType";
static PyObject *__pyx_kp_BooleanType;
static char __pyx_k_IntType[] = "IntType";
static PyObject *__pyx_kp_IntType;
static char __pyx_k_FloatType[] = "FloatType";
static PyObject *__pyx_kp_FloatType;
static char __pyx_k_StringTypes[] = "StringTypes";
static PyObject *__pyx_kp_StringTypes;
static char __pyx_k_ValueError[] = "ValueError";
static PyObject *__pyx_kp_ValueError;
static char __pyx_k_fromkeys[] = "fromkeys";
static PyObject *__pyx_kp_fromkeys;
static char __pyx_k_range[] = "range";
static PyObject *__pyx_kp_range;
static char __pyx_k_append[] = "append";
static PyObject *__pyx_kp_append;
static char __pyx_k_KeyError[] = "KeyError";
static PyObject *__pyx_kp_KeyError;
static char __pyx_k_AttributeError[] = "AttributeError";
static PyObject *__pyx_kp_AttributeError;
static char __pyx_k_length[] = "length";
static PyObject *__pyx_kp_length;
static char __pyx_k_StopIteration[] = "StopIteration";
static PyObject *__pyx_kp_StopIteration;
static char __pyx_k_3[] = "length";
static PyObject *__pyx_kp_3;
static char __pyx_k_enumerate[] = "enumerate";
static PyObject *__pyx_kp_enumerate;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_kp_1;
static char __pyx_k_1[] = "JSException name : %s message : %s";
static PyObject *__pyx_kp_2;
static char __pyx_k_2[] = "utf-8";
static PyObject *__pyx_kp_4;
static char __pyx_k_4[] = "utf-8";
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":36
* include "jsobjectref.pyi"
*
* cdef object jsValueToPython(JSContextRef ctx,JSValueRef jsValue): # <<<<<<<<<<<<<<
* cdef JSStringRef jsStr
* cdef int jsType = JSValueGetType(ctx,jsValue)
*/
static PyObject *__pyx_f_8jswebkit_jsValueToPython(JSContextRef __pyx_v_ctx, JSValueRef __pyx_v_jsValue) {
JSStringRef __pyx_v_jsStr;
int __pyx_v_jsType;
struct __pyx_obj_8jswebkit_JSObject *__pyx_v_jsObject;
struct __pyx_obj_8jswebkit_JSFunction *__pyx_v_jsFunction;
PyObject *__pyx_v_result;
__pyx_t_8jswebkit_bool __pyx_v_bResult;
size_t __pyx_v_strlen;
PyObject *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
__pyx_v_jsObject = ((struct __pyx_obj_8jswebkit_JSObject *)Py_None); Py_INCREF(Py_None);
__pyx_v_jsFunction = ((struct __pyx_obj_8jswebkit_JSFunction *)Py_None); Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":38
* cdef object jsValueToPython(JSContextRef ctx,JSValueRef jsValue):
* cdef JSStringRef jsStr
* cdef int jsType = JSValueGetType(ctx,jsValue) # <<<<<<<<<<<<<<
* cdef JSObject jsObject
* cdef JSFunction jsFunction
*/
__pyx_v_jsType = JSValueGetType(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":45
* cdef bool bResult
* cdef size_t strlen
* if jsType == kJSTypeUndefined or jsType == kJSTypeNull : # <<<<<<<<<<<<<<
* JSValueUnprotect(ctx,jsValue)
* return None
*/
__pyx_1 = (__pyx_v_jsType == kJSTypeUndefined);
if (!__pyx_1) {
__pyx_1 = (__pyx_v_jsType == kJSTypeNull);
}
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":46
* cdef size_t strlen
* if jsType == kJSTypeUndefined or jsType == kJSTypeNull :
* JSValueUnprotect(ctx,jsValue) # <<<<<<<<<<<<<<
* return None
* elif jsType == kJSTypeBoolean :
*/
JSValueUnprotect(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":47
* if jsType == kJSTypeUndefined or jsType == kJSTypeNull :
* JSValueUnprotect(ctx,jsValue)
* return None # <<<<<<<<<<<<<<
* elif jsType == kJSTypeBoolean :
* bResult = JSValueToBoolean(ctx,jsValue)
*/
Py_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
goto __pyx_L3;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":48
* JSValueUnprotect(ctx,jsValue)
* return None
* elif jsType == kJSTypeBoolean : # <<<<<<<<<<<<<<
* bResult = JSValueToBoolean(ctx,jsValue)
* JSValueUnprotect(ctx,jsValue)
*/
__pyx_1 = (__pyx_v_jsType == kJSTypeBoolean);
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":49
* return None
* elif jsType == kJSTypeBoolean :
* bResult = JSValueToBoolean(ctx,jsValue) # <<<<<<<<<<<<<<
* JSValueUnprotect(ctx,jsValue)
* if bResult > 0 :
*/
__pyx_v_bResult = JSValueToBoolean(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":50
* elif jsType == kJSTypeBoolean :
* bResult = JSValueToBoolean(ctx,jsValue)
* JSValueUnprotect(ctx,jsValue) # <<<<<<<<<<<<<<
* if bResult > 0 :
* return True
*/
JSValueUnprotect(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":51
* bResult = JSValueToBoolean(ctx,jsValue)
* JSValueUnprotect(ctx,jsValue)
* if bResult > 0 : # <<<<<<<<<<<<<<
* return True
* else :
*/
__pyx_1 = (__pyx_v_bResult > 0);
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":52
* JSValueUnprotect(ctx,jsValue)
* if bResult > 0 :
* return True # <<<<<<<<<<<<<<
* else :
* return False
*/
__pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":54
* return True
* else :
* return False # <<<<<<<<<<<<<<
* elif jsType == kJSTypeNumber:
* result = JSValueToNumber(ctx,jsValue,NULL)
*/
__pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
}
__pyx_L4:;
goto __pyx_L3;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":55
* else :
* return False
* elif jsType == kJSTypeNumber: # <<<<<<<<<<<<<<
* result = JSValueToNumber(ctx,jsValue,NULL)
* JSValueUnprotect(ctx,jsValue)
*/
__pyx_1 = (__pyx_v_jsType == kJSTypeNumber);
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":56
* return False
* elif jsType == kJSTypeNumber:
* result = JSValueToNumber(ctx,jsValue,NULL) # <<<<<<<<<<<<<<
* JSValueUnprotect(ctx,jsValue)
* return result
*/
__pyx_2 = PyFloat_FromDouble(JSValueToNumber(__pyx_v_ctx, __pyx_v_jsValue, NULL)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_2;
__pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":57
* elif jsType == kJSTypeNumber:
* result = JSValueToNumber(ctx,jsValue,NULL)
* JSValueUnprotect(ctx,jsValue) # <<<<<<<<<<<<<<
* return result
* elif jsType == kJSTypeString :
*/
JSValueUnprotect(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":58
* result = JSValueToNumber(ctx,jsValue,NULL)
* JSValueUnprotect(ctx,jsValue)
* return result # <<<<<<<<<<<<<<
* elif jsType == kJSTypeString :
* jsStr = JSValueToStringCopy(ctx,jsValue,NULL)
*/
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
goto __pyx_L3;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":59
* JSValueUnprotect(ctx,jsValue)
* return result
* elif jsType == kJSTypeString : # <<<<<<<<<<<<<<
* jsStr = JSValueToStringCopy(ctx,jsValue,NULL)
* strlen = JSStringGetLength(jsStr)
*/
__pyx_1 = (__pyx_v_jsType == kJSTypeString);
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":60
* return result
* elif jsType == kJSTypeString :
* jsStr = JSValueToStringCopy(ctx,jsValue,NULL) # <<<<<<<<<<<<<<
* strlen = JSStringGetLength(jsStr)
* strlen *= 2
*/
__pyx_v_jsStr = JSValueToStringCopy(__pyx_v_ctx, __pyx_v_jsValue, NULL);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":61
* elif jsType == kJSTypeString :
* jsStr = JSValueToStringCopy(ctx,jsValue,NULL)
* strlen = JSStringGetLength(jsStr) # <<<<<<<<<<<<<<
* strlen *= 2
* result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0)
*/
__pyx_v_strlen = JSStringGetLength(__pyx_v_jsStr);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":62
* jsStr = JSValueToStringCopy(ctx,jsValue,NULL)
* strlen = JSStringGetLength(jsStr)
* strlen *= 2 # <<<<<<<<<<<<<<
* result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0)
* JSStringRelease(jsStr)
*/
__pyx_v_strlen *= 2;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":63
* strlen = JSStringGetLength(jsStr)
* strlen *= 2
* result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0) # <<<<<<<<<<<<<<
* JSStringRelease(jsStr)
* JSValueUnprotect(ctx,jsValue)
*/
__pyx_2 = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(__pyx_v_jsStr), __pyx_v_strlen, NULL, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_2;
__pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":64
* strlen *= 2
* result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0)
* JSStringRelease(jsStr) # <<<<<<<<<<<<<<
* JSValueUnprotect(ctx,jsValue)
* return result
*/
JSStringRelease(__pyx_v_jsStr);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":65
* result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0)
* JSStringRelease(jsStr)
* JSValueUnprotect(ctx,jsValue) # <<<<<<<<<<<<<<
* return result
* else :
*/
JSValueUnprotect(__pyx_v_ctx, __pyx_v_jsValue);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":66
* JSStringRelease(jsStr)
* JSValueUnprotect(ctx,jsValue)
* return result # <<<<<<<<<<<<<<
* else :
* if JSObjectIsFunction(ctx,jsValue) > 0 :
*/
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":68
* return result
* else :
* if JSObjectIsFunction(ctx,jsValue) > 0 : # <<<<<<<<<<<<<<
* jsFunction = JSFunction()
* jsFunction.setup(ctx,jsValue)
*/
__pyx_1 = (JSObjectIsFunction(__pyx_v_ctx, __pyx_v_jsValue) > 0);
if (__pyx_1) {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":69
* else :
* if JSObjectIsFunction(ctx,jsValue) > 0 :
* jsFunction = JSFunction() # <<<<<<<<<<<<<<
* jsFunction.setup(ctx,jsValue)
* return jsFunction
*/
__pyx_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8jswebkit_JSFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_8jswebkit_JSFunction))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_v_jsFunction));
__pyx_v_jsFunction = ((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_2);
__pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":70
* if JSObjectIsFunction(ctx,jsValue) > 0 :
* jsFunction = JSFunction()
* jsFunction.setup(ctx,jsValue) # <<<<<<<<<<<<<<
* return jsFunction
* else :
*/
__pyx_2 = ((struct __pyx_vtabstruct_8jswebkit_JSFunction *)__pyx_v_jsFunction->__pyx_base.__pyx_vtab)->__pyx_base.setup(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_jsFunction), __pyx_v_ctx, __pyx_v_jsValue); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":71
* jsFunction = JSFunction()
* jsFunction.setup(ctx,jsValue)
* return jsFunction # <<<<<<<<<<<<<<
* else :
* jsObject = JSObject()
*/
Py_INCREF(((PyObject *)__pyx_v_jsFunction));
__pyx_r = ((PyObject *)__pyx_v_jsFunction);
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":73
* return jsFunction
* else :
* jsObject = JSObject() # <<<<<<<<<<<<<<
* jsObject.setup(ctx,jsValue)
* return jsObject
*/
__pyx_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8jswebkit_JSObject)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_8jswebkit_JSObject))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_v_jsObject));
__pyx_v_jsObject = ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_2);
__pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":74
* else :
* jsObject = JSObject()
* jsObject.setup(ctx,jsValue) # <<<<<<<<<<<<<<
* return jsObject
* return None
*/
__pyx_2 = ((struct __pyx_vtabstruct_8jswebkit_JSObject *)__pyx_v_jsObject->__pyx_vtab)->setup(__pyx_v_jsObject, __pyx_v_ctx, __pyx_v_jsValue); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":75
* jsObject = JSObject()
* jsObject.setup(ctx,jsValue)
* return jsObject # <<<<<<<<<<<<<<
* return None
*
*/
Py_INCREF(((PyObject *)__pyx_v_jsObject));
__pyx_r = ((PyObject *)__pyx_v_jsObject);
goto __pyx_L0;
}
__pyx_L5:;
}
__pyx_L3:;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":76
* jsObject.setup(ctx,jsValue)
* return jsObject
* return None # <<<<<<<<<<<<<<
*
* class JSException(Exception):
*/
Py_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("jswebkit.jsValueToPython");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_jsObject);
Py_DECREF((PyObject *)__pyx_v_jsFunction);
Py_DECREF(__pyx_v_result);
return __pyx_r;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":79
*
* class JSException(Exception):
* def __init__(self,name,message): # <<<<<<<<<<<<<<
* self.name = name
* self.mess = message
*/
static PyObject *__pyx_pf_8jswebkit_11JSException___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8jswebkit_11JSException___init__ = {"__init__", (PyCFunction)__pyx_pf_8jswebkit_11JSException___init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pf_8jswebkit_11JSException___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_name = 0;
PyObject *__pyx_v_message = 0;
PyObject *__pyx_r;
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_self,&__pyx_kp_name,&__pyx_kp_message,0};
__pyx_self = __pyx_self;
if (unlikely(__pyx_kwds)) {
PyObject* values[3] = {0,0,0};
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_self);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_name);
if (likely(values[1])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_message);
if (likely(values[2])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_self = values[0];
__pyx_v_name = values[1];
__pyx_v_message = values[2];
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
} else {
__pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
__pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 1);
__pyx_v_message = PyTuple_GET_ITEM(__pyx_args, 2);
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("jswebkit.JSException.__init__");
return NULL;
__pyx_L4_argument_unpacking_done:;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":80
* class JSException(Exception):
* def __init__(self,name,message):
* self.name = name # <<<<<<<<<<<<<<
* self.mess = message
*
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_name, __pyx_v_name) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":81
* def __init__(self,name,message):
* self.name = name
* self.mess = message # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_mess, __pyx_v_message) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("jswebkit.JSException.__init__");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":83
* self.mess = message
*
* def __str__(self): # <<<<<<<<<<<<<<
* return "JSException name : %s message : %s" % (self.name,self.mess)
*
*/
static PyObject *__pyx_pf_8jswebkit_11JSException___str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_8jswebkit_11JSException___str__ = {"__str__", (PyCFunction)__pyx_pf_8jswebkit_11JSException___str__, METH_O, 0};
static PyObject *__pyx_pf_8jswebkit_11JSException___str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_t_1 = NULL;
__pyx_self = __pyx_self;
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":84
*
* def __str__(self):
* return "JSException name : %s message : %s" % (self.name,self.mess) # <<<<<<<<<<<<<<
*
* cdef object makeException(JSContextRef ctx,JSValueRef jsException) :
*/
__pyx_1 = __pyx_kp_1;
Py_INCREF(__pyx_1);
__pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_name); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_mess); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
__pyx_t_1 = PyNumber_Remainder(__pyx_1, ((PyObject *)__pyx_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("jswebkit.JSException.__str__");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":86
* return "JSException name : %s message : %s" % (self.name,self.mess)
*
* cdef object makeException(JSContextRef ctx,JSValueRef jsException) : # <<<<<<<<<<<<<<
* e = jsValueToPython(ctx,jsException)
* return JSException(e.name,e.message)
*/
static PyObject *__pyx_f_8jswebkit_makeException(JSContextRef __pyx_v_ctx, JSValueRef __pyx_v_jsException) {
PyObject *__pyx_v_e;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
__pyx_v_e = Py_None; Py_INCREF(Py_None);
/* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":87
*
* cdef object makeException(JSContextRef ctx,JSValueRef jsException) :
* e = jsValueToPython(ctx,jsException) # <<<<<<<<<<<<<<
* return JSException(e.name,e.message)
*
*/
__pyx_1 = __pyx_f_8jswebkit_jsValueToPython(__pyx_v_ctx, __pyx_v_jsException); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_e);