python-jswebkit-0.0.3/0000755000175000017500000000000011454037431013335 5ustar aronaronpython-jswebkit-0.0.3/jsvalueref.pyi0000644000175000017500000000174211452073143016230 0ustar aronaroncdef extern from "JavaScriptCore/JSValueRef.h": cdef enum JSType : kJSTypeUndefined,kJSTypeNull,kJSTypeBoolean,kJSTypeNumber,kJSTypeString,kJSTypeObject JSType JSValueGetType(JSContextRef ctx, JSValueRef value) bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception) JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception) JSValueRef JSValueMakeUndefined(JSContextRef ctx) JSValueRef JSValueMakeNull(JSContextRef ctx) JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean) JSValueRef JSValueMakeNumber(JSContextRef ctx, double number) JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) void JSValueProtect(JSContextRef ctx, JSValueRef value) void JSValueUnprotect(JSContextRef ctx, JSValueRef value)python-jswebkit-0.0.3/testjswebkit.py0000644000175000017500000000465711452073143016443 0ustar aronaron""" Copyright (C) 2009 john paul janecek, Free Beer (MIT) Licensing Copyright (C) 2010 Jiahua Huang , MIT Licensing for this file Comment by john paul janecek: ------------------ test file for cython wrapper for JSContextRef in pywebkitgtk This is the documentation :) you need cython to make it So you can call Javascript functions etc from python Made by john paul janecek Free Beer copyright, do what the heck you want with it, just give me credit Also do not blame me if your things blow up if you need to contact me, i might answer back :) I am lazy when it comes to making fixes unless I actually am using library myself :) my email import binascii binascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n') ------------------ """ import gobject import gtk import pango import webkit import jswebkit import signal gobject.threads_init() class WebView(webkit.WebView): def __init__(self): webkit.WebView.__init__(self) self.mainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) self.mainWindow.connect("delete_event", lambda *x: gtk.main_quit ()) self.mainWindow.set_size_request(800, 600) self.scrolledWindow = gtk.ScrolledWindow() self.mainWindow.add(self.scrolledWindow) self.scrolledWindow.add(self) settings = self.get_settings() settings.set_property("auto-load-images",False) settings.set_property("enable-plugins",False) self.connect("load-finished",self.load_finished_cb) def show_all(self): self.mainWindow.show_all() def load_finished_cb(self,view,frame): print "load_finished" ctx = jswebkit.JSContext(self.get_main_frame().get_global_context()) window = ctx.EvaluateScript("window") #window.alert(None, "window") #window.foo = "bar" #print ctx.EvaluateScript("window.foo") document = ctx.EvaluateScript("document") #print "Title : ",document.title #form = document.forms[0] #print form.action #form.elements[1].value = "this is me" #form.elements[2].click(form.elements[2]) atags = document.getElementsByTagName(document, "a") print atags.getPropertyNames() for a in atags : print a.href def start(self): self.open("http://www.google.com") try: view = WebView() view.show_all() view.start() gtk.main() except KeyboardInterrupt: gtk.main_quit() python-jswebkit-0.0.3/stdlib.pyi0000644000175000017500000000034311452073143015337 0ustar aronaroncdef extern from "stdlib.h": ctypedef unsigned long size_t void free(void *ptr) void *malloc(size_t size) void *realloc(void *ptr, size_t size) size_t strlen(char *s) char *strcpy(char *dest, char *src) python-jswebkit-0.0.3/jsstringref.pyi0000644000175000017500000000111511452073230016411 0ustar aronaroncdef extern from "Python.h": ctypedef unsigned short Py_UNICODE cdef extern from "JavaScriptCore/JSStringRef.h": ctypedef Py_UNICODE JSChar void JSStringRelease(JSStringRef string) JSStringRef JSStringCreateWithUTF8CString(char* string) JSStringRef JSStringCreateWithCharacters(JSChar* chars, size_t numChars) size_t JSStringGetLength(JSStringRef string) JSChar* JSStringGetCharactersPtr(JSStringRef string) size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string) size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize) python-jswebkit-0.0.3/License.MIT0000644000175000017500000000201711452073143015270 0ustar aronaron MIT LICENSE Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. python-jswebkit-0.0.3/python.pyi0000644000175000017500000000043311452073143015377 0ustar aronaroncdef extern from "Python.h": ctypedef unsigned short Py_UNICODE char* PyCObject_GetDesc(object self) void* PyCObject_AsVoidPtr(object self) char* PyString_AsString(object o) object PyUnicode_DecodeUTF16(Py_UNICODE *u, Py_ssize_t size, char *errors, int byteorder)python-jswebkit-0.0.3/License0000644000175000017500000001674411452073143014654 0ustar aronaron GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. python-jswebkit-0.0.3/AUTHORS0000644000175000017500000000015111452073143014400 0ustar aronaronMain Developer: Jiahua Huang Other Developer: Aron Xu python-jswebkit-0.0.3/jsbase.pyi0000644000175000017500000000222611452073143015327 0ustar aronaroncdef extern from "JavaScriptCore/JSBase.h": struct OpaqueJSContextGroup: pass ctypedef OpaqueJSContextGroup* JSContextGroupRef struct OpaqueJSContext: pass ctypedef OpaqueJSContext* JSContextRef ctypedef OpaqueJSContext* JSGlobalContextRef struct OpaqueJSString: pass ctypedef OpaqueJSString* JSStringRef struct OpaqueJSClass: pass ctypedef OpaqueJSClass* JSClassRef struct OpaqueJSPropertyNameArray: pass ctypedef OpaqueJSPropertyNameArray* JSPropertyNameArrayRef struct OpaqueJSPropertyNameAccumulator: pass ctypedef OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef struct OpaqueJSValue: pass ctypedef OpaqueJSValue* JSValueRef ctypedef OpaqueJSValue* JSObjectRef JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) void JSGarbageCollect(JSContextRef ctx)python-jswebkit-0.0.3/jswebkit.c0000644000175000017500000054026411452073143015334 0ustar aronaron/* Generated by Cython 0.10.3 on Sun Jul 12 16:38:10 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 #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_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 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_name); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_mess); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); __pyx_1 = 0; __pyx_2 = 0; __pyx_t_1 = PyNumber_Remainder(__pyx_kp_1, ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 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); __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); __pyx_v_e = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":88 * cdef object makeException(JSContextRef ctx,JSValueRef jsException) : * e = jsValueToPython(ctx,jsException) * return JSException(e.name,e.message) # <<<<<<<<<<<<<< * * cdef object JSStringRefToPython(JSStringRef jsString) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_JSException); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_v_e, __pyx_kp_name); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_GetAttr(__pyx_v_e, __pyx_kp_message); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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_2; __pyx_2 = 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.makeException"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_e); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":90 * return JSException(e.name,e.message) * * cdef object JSStringRefToPython(JSStringRef jsString) : # <<<<<<<<<<<<<< * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 */ static PyObject *__pyx_f_8jswebkit_JSStringRefToPython(JSStringRef __pyx_v_jsString) { size_t __pyx_v_strlen; PyObject *__pyx_v_result; PyObject *__pyx_r; PyObject *__pyx_1 = 0; __pyx_v_result = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":91 * * cdef object JSStringRefToPython(JSStringRef jsString) : * cdef size_t strlen = JSStringGetLength(jsString) # <<<<<<<<<<<<<< * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) */ __pyx_v_strlen = JSStringGetLength(__pyx_v_jsString); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":92 * cdef object JSStringRefToPython(JSStringRef jsString) : * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 # <<<<<<<<<<<<<< * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) * return result */ __pyx_v_strlen *= 2; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":93 * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) # <<<<<<<<<<<<<< * return result * */ __pyx_1 = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(__pyx_v_jsString), __pyx_v_strlen, NULL, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":94 * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) * return result # <<<<<<<<<<<<<< * * cdef JSStringRef PythonToJSString(object pyStr) : */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("jswebkit.JSStringRefToPython"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_result); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":96 * return result * * cdef JSStringRef PythonToJSString(object pyStr) : # <<<<<<<<<<<<<< * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") */ static JSStringRef __pyx_f_8jswebkit_PythonToJSString(PyObject *__pyx_v_pyStr) { JSStringRef __pyx_v_jsStr; JSStringRef __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; Py_INCREF(__pyx_v_pyStr); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":98 * cdef JSStringRef PythonToJSString(object pyStr) : * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") # <<<<<<<<<<<<<< * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) * return jsStr */ __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_pyStr); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_pyStr); __pyx_2 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_encode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_2); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_v_pyStr); __pyx_v_pyStr = __pyx_3; __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":99 * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) # <<<<<<<<<<<<<< * return jsStr * */ __pyx_v_jsStr = JSStringCreateWithUTF8CString(PyString_AsString(__pyx_v_pyStr)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":100 * pyStr = unicode(pyStr).encode("utf-8") * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) * return jsStr # <<<<<<<<<<<<<< * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): */ __pyx_r = __pyx_v_jsStr; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_WriteUnraisable("jswebkit.PythonToJSString"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_pyStr); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":102 * return jsStr * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): # <<<<<<<<<<<<<< * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) */ static JSValueRef __pyx_f_8jswebkit_PythonTojsValue(JSContextRef __pyx_v_ctx, PyObject *__pyx_v_pyValue) { JSValueRef __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; int __pyx_3; __pyx_t_8jswebkit_bool __pyx_4; PyObject *__pyx_5 = 0; double __pyx_6; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":103 * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): * if isinstance(pyValue,types.NoneType): # <<<<<<<<<<<<<< * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_NoneType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":104 * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) # <<<<<<<<<<<<<< * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) */ __pyx_r = JSValueMakeNull(__pyx_v_ctx); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":105 * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): # <<<<<<<<<<<<<< * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_BooleanType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":106 * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) # <<<<<<<<<<<<<< * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) */ __pyx_4 = __pyx_PyInt_unsigned_short(__pyx_v_pyValue); if (unlikely((__pyx_4 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = JSValueMakeBoolean(__pyx_v_ctx, __pyx_4); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":107 * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : # <<<<<<<<<<<<<< * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_IntType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_FloatType); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2); PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5); __pyx_2 = 0; __pyx_5 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, ((PyObject *)__pyx_1)); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":108 * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) # <<<<<<<<<<<<<< * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) */ __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_v_pyValue); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = JSValueMakeNumber(__pyx_v_ctx, __pyx_6); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":109 * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : # <<<<<<<<<<<<<< * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): */ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_StringTypes); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_5); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":110 * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) # <<<<<<<<<<<<<< * elif isinstance(pyValue,JSObject): * return (pyValue).jsObject */ __pyx_r = JSValueMakeString(__pyx_v_ctx, __pyx_f_8jswebkit_PythonToJSString(__pyx_v_pyValue)); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":111 * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): # <<<<<<<<<<<<<< * return (pyValue).jsObject * else : */ __pyx_3 = PyObject_TypeCheck(__pyx_v_pyValue, ((PyTypeObject *)((PyObject*)__pyx_ptype_8jswebkit_JSObject))); if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":112 * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): * return (pyValue).jsObject # <<<<<<<<<<<<<< * else : * raise ValueError */ __pyx_r = ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_pyValue)->jsObject; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":114 * return (pyValue).jsObject * else : * raise ValueError # <<<<<<<<<<<<<< * * cdef class JSObject: */ __Pyx_Raise(__pyx_builtin_ValueError, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_5); __Pyx_WriteUnraisable("jswebkit.PythonTojsValue"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":122 * cdef int index * * def __init__(self) : # <<<<<<<<<<<<<< * self.ctx = NULL * self.jsObject = NULL */ static int __pyx_pf_8jswebkit_8JSObject___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":123 * * def __init__(self) : * self.ctx = NULL # <<<<<<<<<<<<<< * self.jsObject = NULL * self.index = 0 */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":124 * def __init__(self) : * self.ctx = NULL * self.jsObject = NULL # <<<<<<<<<<<<<< * self.index = 0 * */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":125 * self.ctx = NULL * self.jsObject = NULL * self.index = 0 # <<<<<<<<<<<<<< * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index = 0; __pyx_r = 0; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":127 * self.index = 0 * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): # <<<<<<<<<<<<<< * self.ctx = ctx * self.jsObject = jsObject */ static PyObject *__pyx_f_8jswebkit_8JSObject_setup(struct __pyx_obj_8jswebkit_JSObject *__pyx_v_self, JSContextRef __pyx_v_ctx, JSObjectRef __pyx_v_jsObject) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":128 * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): * self.ctx = ctx # <<<<<<<<<<<<<< * self.jsObject = jsObject * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) */ __pyx_v_self->ctx = __pyx_v_ctx; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":129 * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): * self.ctx = ctx * self.jsObject = jsObject # <<<<<<<<<<<<<< * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) * */ __pyx_v_self->jsObject = __pyx_v_jsObject; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":130 * self.ctx = ctx * self.jsObject = jsObject * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) # <<<<<<<<<<<<<< * * def getPropertyNames(self): */ __pyx_1 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_kp_fromkeys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_getPropertyNames); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); __pyx_3 = 0; __pyx_2 = 0; __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; Py_DECREF(__pyx_v_self->propertyNames); __pyx_v_self->propertyNames = __pyx_3; __pyx_3 = 0; __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.JSObject.setup"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":132 * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) * * def getPropertyNames(self): # <<<<<<<<<<<<<< * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] */ static PyObject *__pyx_pf_8jswebkit_8JSObject_getPropertyNames(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject_getPropertyNames(PyObject *__pyx_v_self, PyObject *unused) { JSPropertyNameArrayRef __pyx_v_nameArray; PyObject *__pyx_v_names; PyObject *__pyx_v_i; PyObject *__pyx_r; PyObject *__pyx_1 = 0; Py_ssize_t __pyx_2 = 0; PyObject *__pyx_3 = 0; size_t __pyx_4; PyObject *__pyx_5 = 0; __pyx_v_names = Py_None; Py_INCREF(Py_None); __pyx_v_i = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":133 * * def getPropertyNames(self): * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) # <<<<<<<<<<<<<< * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): */ __pyx_v_nameArray = JSObjectCopyPropertyNames(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":134 * def getPropertyNames(self): * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] # <<<<<<<<<<<<<< * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) */ __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_names); __pyx_v_names = ((PyObject *)__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":135 * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): # <<<<<<<<<<<<<< * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) */ __pyx_1 = PyLong_FromUnsignedLong(JSPropertyNameArrayGetCount(__pyx_v_nameArray)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; if (PyList_CheckExact(__pyx_1) || PyTuple_CheckExact(__pyx_1)) { __pyx_2 = 0; __pyx_3 = __pyx_1; Py_INCREF(__pyx_3); } else { __pyx_2 = -1; __pyx_3 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } Py_DECREF(__pyx_1); __pyx_1 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_3))) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_3)) break; __pyx_1 = PyList_GET_ITEM(__pyx_3, __pyx_2); Py_INCREF(__pyx_1); __pyx_2++; } else if (likely(PyTuple_CheckExact(__pyx_3))) { if (__pyx_2 >= PyTuple_GET_SIZE(__pyx_3)) break; __pyx_1 = PyTuple_GET_ITEM(__pyx_3, __pyx_2); Py_INCREF(__pyx_1); __pyx_2++; } else { __pyx_1 = PyIter_Next(__pyx_3); if (!__pyx_1) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":136 * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) # <<<<<<<<<<<<<< * JSPropertyNameArrayRelease(nameArray) * return names */ __pyx_4 = PyInt_AsUnsignedLongMask(__pyx_v_i); if (unlikely((__pyx_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_1 = __pyx_f_8jswebkit_JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(__pyx_v_nameArray, __pyx_4)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = __Pyx_PyObject_Append(__pyx_v_names, __pyx_1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; } Py_DECREF(__pyx_3); __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":137 * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) # <<<<<<<<<<<<<< * return names * */ JSPropertyNameArrayRelease(__pyx_v_nameArray); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":138 * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) * return names # <<<<<<<<<<<<<< * * def __getattr__(self,name): */ Py_INCREF(__pyx_v_names); __pyx_r = __pyx_v_names; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.getPropertyNames"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_names); Py_DECREF(__pyx_v_i); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":140 * return names * * def __getattr__(self,name): # <<<<<<<<<<<<<< * cdef JSStringRef jsStr * cdef JSValueRef jsException */ static PyObject *__pyx_pf_8jswebkit_8JSObject___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { JSStringRef __pyx_v_jsStr; PyObject *__pyx_v_result; PyObject *__pyx_r; PyObject *__pyx_1 = 0; char *__pyx_2; int __pyx_3; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; __pyx_v_result = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":143 * cdef JSStringRef jsStr * cdef JSValueRef jsException * try : # <<<<<<<<<<<<<< * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string */ { PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); /*try:*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":144 * cdef JSValueRef jsException * try : * self.propertyNames[name] # <<<<<<<<<<<<<< * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) */ __pyx_1 = PyObject_GetItem(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->propertyNames, __pyx_v_name); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L5_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":145 * try : * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string # <<<<<<<<<<<<<< * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) */ __pyx_2 = __Pyx_PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __pyx_v_jsStr = JSStringCreateWithUTF8CString(__pyx_2); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":146 * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) # <<<<<<<<<<<<<< * JSStringRelease(jsStr) * return result */ __pyx_1 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, JSObjectGetProperty(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_v_jsStr, NULL)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L5_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":147 * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) # <<<<<<<<<<<<<< * return result * except KeyError : */ JSStringRelease(__pyx_v_jsStr); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":148 * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) * return result # <<<<<<<<<<<<<< * except KeyError : * raise AttributeError,name */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L9_try_return; } Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; goto __pyx_L10_try; __pyx_L9_try_return:; Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; goto __pyx_L0; __pyx_L5_error:; Py_XDECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":149 * JSStringRelease(jsStr) * return result * except KeyError : # <<<<<<<<<<<<<< * raise AttributeError,name * */ __pyx_3 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_3) { __Pyx_AddTraceback("jswebkit.__getattr__"); if (__Pyx_GetException(&__pyx_1, &__pyx_4, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":150 * return result * except KeyError : * raise AttributeError,name # <<<<<<<<<<<<<< * * def __setattr__(self,name,value): */ __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_v_name, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; goto __pyx_L6_exception_handled; } __pyx_L7_except_error:; Py_XDECREF(__pyx_save_exc_type); Py_XDECREF(__pyx_save_exc_value); Py_XDECREF(__pyx_save_exc_tb); goto __pyx_L1_error; __pyx_L6_exception_handled:; __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); __pyx_L10_try:; } __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.__getattr__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_result); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":152 * raise AttributeError,name * * def __setattr__(self,name,value): # <<<<<<<<<<<<<< * cdef JSStringRef jsStr * self.propertyNames[name] = True */ static int __pyx_pf_8jswebkit_8JSObject___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { JSStringRef __pyx_v_jsStr; int __pyx_r; PyObject *__pyx_1 = 0; char *__pyx_2; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":154 * def __setattr__(self,name,value): * cdef JSStringRef jsStr * self.propertyNames[name] = True # <<<<<<<<<<<<<< * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) */ __pyx_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetItem(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->propertyNames, __pyx_v_name, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":155 * cdef JSStringRef jsStr * self.propertyNames[name] = True * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string # <<<<<<<<<<<<<< * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) * JSStringRelease(jsStr) */ __pyx_2 = __Pyx_PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsStr = JSStringCreateWithUTF8CString(__pyx_2); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":156 * self.propertyNames[name] = True * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) # <<<<<<<<<<<<<< * JSStringRelease(jsStr) * */ JSObjectSetProperty(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_v_jsStr, __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_value), kJSPropertyAttributeNone, NULL); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":157 * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) * JSStringRelease(jsStr) # <<<<<<<<<<<<<< * * def __getitem__(self,key) : */ JSStringRelease(__pyx_v_jsStr); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("jswebkit.JSObject.__setattr__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":159 * JSStringRelease(jsStr) * * def __getitem__(self,key) : # <<<<<<<<<<<<<< * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL */ static PyObject *__pyx_pf_8jswebkit_8JSObject___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { JSValueRef __pyx_v_jsValueRef; JSValueRef __pyx_v_jsException; PyObject *__pyx_r; unsigned int __pyx_1; int __pyx_2; PyObject *__pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":161 * def __getitem__(self,key) : * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":162 * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) # <<<<<<<<<<<<<< * if jsException != NULL : * raise makeException(self.ctx,jsException) */ __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_key); if (unlikely((__pyx_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsValueRef = JSObjectGetPropertyAtIndex(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_1, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":163 * cdef JSValueRef jsException = NULL * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsException) * return jsValueToPython(self.ctx,jsValueRef) */ __pyx_2 = (__pyx_v_jsException != NULL); if (__pyx_2) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":164 * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : * raise makeException(self.ctx,jsException) # <<<<<<<<<<<<<< * return jsValueToPython(self.ctx,jsValueRef) * */ __pyx_3 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsException); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":165 * if jsException != NULL : * raise makeException(self.ctx,jsException) * return jsValueToPython(self.ctx,jsValueRef) # <<<<<<<<<<<<<< * * def __setitem__(self,key,value): */ __pyx_3 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsValueRef); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; __pyx_3 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSObject.__getitem__"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":167 * return jsValueToPython(self.ctx,jsValueRef) * * def __setitem__(self,key,value): # <<<<<<<<<<<<<< * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL */ static int __pyx_pf_8jswebkit_8JSObject___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { JSValueRef __pyx_v_jsValue; JSValueRef __pyx_v_jsException; int __pyx_r; unsigned int __pyx_1; int __pyx_2; PyObject *__pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":168 * * def __setitem__(self,key,value): * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) # <<<<<<<<<<<<<< * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) */ __pyx_v_jsValue = __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_value); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":169 * def __setitem__(self,key,value): * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":170 * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) # <<<<<<<<<<<<<< * if jsException != NULL : * raise makeException(self.ctx,jsException) */ __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_key); if (unlikely((__pyx_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} JSObjectSetPropertyAtIndex(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_1, __pyx_v_jsValue, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":171 * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsException) * */ __pyx_2 = (__pyx_v_jsException != NULL); if (__pyx_2) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":172 * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : * raise makeException(self.ctx,jsException) # <<<<<<<<<<<<<< * * def __del__(self): */ __pyx_3 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsException); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSObject.__setitem__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":174 * raise makeException(self.ctx,jsException) * * def __del__(self): # <<<<<<<<<<<<<< * JSValueUnprotect(self.ctx,self.jsObject) * */ static PyObject *__pyx_pf_8jswebkit_8JSObject___del__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___del__(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":175 * * def __del__(self): * JSValueUnprotect(self.ctx,self.jsObject) # <<<<<<<<<<<<<< * * # these are container methods, so that lists behave correctly */ JSValueUnprotect(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject); __pyx_r = Py_None; Py_INCREF(Py_None); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":178 * * # these are container methods, so that lists behave correctly * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_8jswebkit_8JSObject___iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":179 * # these are container methods, so that lists behave correctly * def __iter__(self): * return self # <<<<<<<<<<<<<< * * def __next__(self): # 2.6 and 3.0 now use __next__ */ Py_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":181 * return self * * def __next__(self): # 2.6 and 3.0 now use __next__ # <<<<<<<<<<<<<< * if self.index < self.length: * value = self[self.index] */ static PyObject *__pyx_pf_8jswebkit_8JSObject___next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___next__(PyObject *__pyx_v_self) { PyObject *__pyx_v_value; PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; int __pyx_4; __pyx_v_value = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":182 * * def __next__(self): # 2.6 and 3.0 now use __next__ * if self.index < self.length: # <<<<<<<<<<<<<< * value = self[self.index] * self.index += 1 */ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_length); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_RichCompare(__pyx_1, __pyx_2, Py_LT); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; if (__pyx_4) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":183 * def __next__(self): # 2.6 and 3.0 now use __next__ * if self.index < self.length: * value = self[self.index] # <<<<<<<<<<<<<< * self.index += 1 * return value */ __pyx_1 = __Pyx_GetItemInt(__pyx_v_self, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_value); __pyx_v_value = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":184 * if self.index < self.length: * value = self[self.index] * self.index += 1 # <<<<<<<<<<<<<< * return value * else: */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index += 1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":185 * value = self[self.index] * self.index += 1 * return value # <<<<<<<<<<<<<< * else: * self.index = 0 */ Py_INCREF(__pyx_v_value); __pyx_r = __pyx_v_value; goto __pyx_L0; goto __pyx_L5; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":187 * return value * else: * self.index = 0 # <<<<<<<<<<<<<< * raise StopIteration * */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":188 * else: * self.index = 0 * raise StopIteration # <<<<<<<<<<<<<< * * def next(self): # wrapper for backwards compatibility */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L5:; __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); __Pyx_AddTraceback("jswebkit.JSObject.__next__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_value); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":190 * raise StopIteration * * def next(self): # wrapper for backwards compatibility # <<<<<<<<<<<<<< * return self.__next__() * */ static PyObject *__pyx_pf_8jswebkit_8JSObject_next(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject_next(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":191 * * def next(self): # wrapper for backwards compatibility * return self.__next__() # <<<<<<<<<<<<<< * * def __len__(self): */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___next__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_r = __pyx_2; __pyx_2 = 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); __Pyx_AddTraceback("jswebkit.JSObject.next"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":193 * return self.__next__() * * def __len__(self): # <<<<<<<<<<<<<< * length = len(self.getPropertyNames()) * if hasattr(self, "length"): */ static Py_ssize_t __pyx_pf_8jswebkit_8JSObject___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pf_8jswebkit_8JSObject___len__(PyObject *__pyx_v_self) { PyObject *__pyx_v_length; Py_ssize_t __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; Py_ssize_t __pyx_3 = 0; int __pyx_4; PyObject *__pyx_5 = 0; __pyx_v_length = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":194 * * def __len__(self): * length = len(self.getPropertyNames()) # <<<<<<<<<<<<<< * if hasattr(self, "length"): * length += int(self.length) */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getPropertyNames); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_Length(__pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_1 = PyInt_FromSsize_t(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":195 * def __len__(self): * length = len(self.getPropertyNames()) * if hasattr(self, "length"): # <<<<<<<<<<<<<< * length += int(self.length) * return length */ __pyx_4 = PyObject_HasAttr(__pyx_v_self, __pyx_kp_3); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_4) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":196 * length = len(self.getPropertyNames()) * if hasattr(self, "length"): * length += int(self.length) # <<<<<<<<<<<<<< * return length * */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_length); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; __pyx_2 = PyNumber_InPlaceAdd(__pyx_v_length, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_2; __pyx_2 = 0; goto __pyx_L5; } __pyx_L5:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":197 * if hasattr(self, "length"): * length += int(self.length) * return length # <<<<<<<<<<<<<< * * */ __pyx_3 = __pyx_PyIndex_AsSsize_t(__pyx_v_length); if (unlikely((__pyx_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.__len__"); __pyx_r = -1; __pyx_L0:; Py_DECREF(__pyx_v_length); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":201 * * cdef class JSFunction(JSObject): * def __init__(self) : # <<<<<<<<<<<<<< * JSObject.__init__(self) * */ static int __pyx_pf_8jswebkit_10JSFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_10JSFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":202 * cdef class JSFunction(JSObject): * def __init__(self) : * JSObject.__init__(self) # <<<<<<<<<<<<<< * * def __call__(self,thisObj,*args): */ __pyx_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8jswebkit_JSObject)), __pyx_kp___init__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSFunction.__init__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":204 * JSObject.__init__(self) * * def __call__(self,thisObj,*args): # <<<<<<<<<<<<<< * cdef JSValueRef *jsArgs * cdef JSValueRef result */ static PyObject *__pyx_pf_8jswebkit_10JSFunction___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_8jswebkit_10JSFunction___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_thisObj = 0; PyObject *__pyx_v_args = 0; JSValueRef *__pyx_v_jsArgs; JSValueRef __pyx_v_result; JSObjectRef __pyx_v_jsThisObject; JSValueRef __pyx_v_jsError; PyObject *__pyx_v_i; PyObject *__pyx_v_arg; PyObject *__pyx_r; Py_ssize_t __pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; Py_ssize_t __pyx_6 = 0; int __pyx_7; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_thisObj,0}; if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); if (unlikely(!__pyx_v_args)) return NULL; } else { __pyx_v_args = __pyx_empty_tuple; Py_INCREF(__pyx_empty_tuple); } if (unlikely(__pyx_kwds)) { PyObject* values[1] = {0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_thisObj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_thisObj = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_thisObj = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; Py_DECREF(__pyx_v_args); __Pyx_AddTraceback("jswebkit.JSFunction.__call__"); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_i = Py_None; Py_INCREF(Py_None); __pyx_v_arg = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":208 * cdef JSValueRef result * cdef JSObjectRef jsThisObject * cdef JSValueRef jsError = NULL # <<<<<<<<<<<<<< * if len(args) : * jsArgs = malloc(len(args) * sizeof(JSValueRef)) */ __pyx_v_jsError = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":209 * cdef JSObjectRef jsThisObject * cdef JSValueRef jsError = NULL * if len(args) : # <<<<<<<<<<<<<< * jsArgs = malloc(len(args) * sizeof(JSValueRef)) * else : */ __pyx_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_1) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":210 * cdef JSValueRef jsError = NULL * if len(args) : * jsArgs = malloc(len(args) * sizeof(JSValueRef)) # <<<<<<<<<<<<<< * else : * jsArgs = NULL */ __pyx_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsArgs = ((JSValueRef *)malloc((__pyx_1 * (sizeof(JSValueRef))))); goto __pyx_L6; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":212 * jsArgs = malloc(len(args) * sizeof(JSValueRef)) * else : * jsArgs = NULL # <<<<<<<<<<<<<< * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) */ __pyx_v_jsArgs = NULL; } __pyx_L6:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":213 * else : * jsArgs = NULL * for i,arg in enumerate(args) : # <<<<<<<<<<<<<< * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : */ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args); __pyx_3 = PyObject_Call(__pyx_builtin_enumerate, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; if (PyList_CheckExact(__pyx_3) || PyTuple_CheckExact(__pyx_3)) { __pyx_1 = 0; __pyx_2 = __pyx_3; Py_INCREF(__pyx_2); } else { __pyx_1 = -1; __pyx_2 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } Py_DECREF(__pyx_3); __pyx_3 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_2))) { if (__pyx_1 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_1); Py_INCREF(__pyx_3); __pyx_1++; } else if (likely(PyTuple_CheckExact(__pyx_2))) { if (__pyx_1 >= PyTuple_GET_SIZE(__pyx_2)) break; __pyx_3 = PyTuple_GET_ITEM(__pyx_2, __pyx_1); Py_INCREF(__pyx_3); __pyx_1++; } else { __pyx_3 = PyIter_Next(__pyx_2); if (!__pyx_3) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { PyObject* tuple = __pyx_3; __pyx_5 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(__pyx_5); Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_5; __pyx_5 = 0; __pyx_5 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(__pyx_5); Py_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_5; __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; } else { __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_5; __pyx_5 = 0; __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_5; __pyx_5 = 0; if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":214 * jsArgs = NULL * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) # <<<<<<<<<<<<<< * if thisObj : * jsThisObject = (thisObj).jsObject */ __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} (__pyx_v_jsArgs[__pyx_6]) = __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_arg); } Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":215 * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : # <<<<<<<<<<<<<< * jsThisObject = (thisObj).jsObject * else : */ __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_v_thisObj); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_7) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":216 * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : * jsThisObject = (thisObj).jsObject # <<<<<<<<<<<<<< * else : * jsThisObject = NULL */ __pyx_v_jsThisObject = ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_thisObj)->jsObject; goto __pyx_L9; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":218 * jsThisObject = (thisObj).jsObject * else : * jsThisObject = NULL # <<<<<<<<<<<<<< * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) */ __pyx_v_jsThisObject = NULL; } __pyx_L9:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":219 * else : * jsThisObject = NULL * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) # <<<<<<<<<<<<<< * free(jsArgs) * if jsError!=NULL : */ __pyx_6 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = JSObjectCallAsFunction(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, ((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.jsObject, __pyx_v_jsThisObject, __pyx_6, __pyx_v_jsArgs, (&__pyx_v_jsError)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":220 * jsThisObject = NULL * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) # <<<<<<<<<<<<<< * if jsError!=NULL : * raise makeException(self.ctx,jsError) */ free(__pyx_v_jsArgs); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":221 * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) * if jsError!=NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsError) * return jsValueToPython(self.ctx,result) */ __pyx_7 = (__pyx_v_jsError != NULL); if (__pyx_7) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":222 * free(jsArgs) * if jsError!=NULL : * raise makeException(self.ctx,jsError) # <<<<<<<<<<<<<< * return jsValueToPython(self.ctx,result) * */ __pyx_5 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_jsError); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_5, 0, 0); Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":223 * if jsError!=NULL : * raise makeException(self.ctx,jsError) * return jsValueToPython(self.ctx,result) # <<<<<<<<<<<<<< * * */ __pyx_3 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_result); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; __pyx_3 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSFunction.__call__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_args); Py_DECREF(__pyx_v_i); Py_DECREF(__pyx_v_arg); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":229 * cdef JSContextRef jsCtx * cdef object ctx * def __init__(self,ctx): # <<<<<<<<<<<<<< * self.ctx = ctx * self.jsCtx = PyCObject_AsVoidPtr(ctx) */ static int __pyx_pf_8jswebkit_9JSContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_9JSContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_ctx = 0; int __pyx_r; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_ctx,0}; if (unlikely(__pyx_kwds)) { PyObject* values[1] = {0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { 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_ctx); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_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 = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_ctx = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_ctx = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("jswebkit.JSContext.__init__"); return -1; __pyx_L4_argument_unpacking_done:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":230 * cdef object ctx * def __init__(self,ctx): * self.ctx = ctx # <<<<<<<<<<<<<< * self.jsCtx = PyCObject_AsVoidPtr(ctx) * */ Py_INCREF(__pyx_v_ctx); Py_DECREF(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx); ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx = __pyx_v_ctx; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":231 * def __init__(self,ctx): * self.ctx = ctx * self.jsCtx = PyCObject_AsVoidPtr(ctx) # <<<<<<<<<<<<<< * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): */ ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx = ((struct OpaqueJSContext *)PyCObject_AsVoidPtr(__pyx_v_ctx)); __pyx_r = 0; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":233 * self.jsCtx = PyCObject_AsVoidPtr(ctx) * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): # <<<<<<<<<<<<<< * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) */ static PyObject *__pyx_pf_8jswebkit_9JSContext_EvaluateScript(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_8jswebkit_9JSContext_EvaluateScript(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_script = 0; PyObject *__pyx_v_thisObject = 0; PyObject *__pyx_v_sourceURL = 0; PyObject *__pyx_v_startingLineNumber = 0; JSStringRef __pyx_v_jsScript; JSValueRef __pyx_v_jsException; JSValueRef __pyx_v_jsValue; PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; int __pyx_4; int __pyx_5; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_script,&__pyx_kp_thisObject,&__pyx_kp_sourceURL,&__pyx_kp_startingLineNumber,0}; __pyx_v_thisObject = Py_None; __pyx_v_sourceURL = Py_None; __pyx_v_startingLineNumber = __pyx_int_1; if (unlikely(__pyx_kwds)) { PyObject* values[4] = {0,0,0,0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); 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_script); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "EvaluateScript") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_script = values[0]; if (values[1]) { __pyx_v_thisObject = values[1]; } if (values[2]) { __pyx_v_sourceURL = values[2]; } if (values[3]) { __pyx_v_startingLineNumber = values[3]; } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __pyx_v_startingLineNumber = PyTuple_GET_ITEM(__pyx_args, 3); case 3: __pyx_v_sourceURL = PyTuple_GET_ITEM(__pyx_args, 2); case 2: __pyx_v_thisObject = PyTuple_GET_ITEM(__pyx_args, 1); case 1: __pyx_v_script = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("EvaluateScript", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("jswebkit.JSContext.EvaluateScript"); return NULL; __pyx_L4_argument_unpacking_done:; Py_INCREF(__pyx_v_script); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":234 * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): * script = unicode(script).encode("utf-8") # <<<<<<<<<<<<<< * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL */ __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_script); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_script); __pyx_2 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_encode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_4); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_4); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_v_script); __pyx_v_script = __pyx_3; __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":235 * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) # <<<<<<<<<<<<<< * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) */ __pyx_v_jsScript = JSStringCreateWithUTF8CString(PyString_AsString(__pyx_v_script)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":236 * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":237 * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) # <<<<<<<<<<<<<< * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) */ __pyx_4 = __pyx_PyInt_int(__pyx_v_startingLineNumber); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsValue = JSEvaluateScript(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsScript, ((struct OpaqueJSValue *)NULL), ((struct OpaqueJSString *)NULL), __pyx_4, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":238 * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) # <<<<<<<<<<<<<< * JSStringRelease(jsScript) * if jsException!=NULL : */ JSValueProtect(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsValue); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":239 * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) # <<<<<<<<<<<<<< * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) */ JSStringRelease(__pyx_v_jsScript); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":240 * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) * if jsException!=NULL : # <<<<<<<<<<<<<< * raise makeException(self.jsCtx,jsException) * return jsValueToPython(self.jsCtx,jsValue) */ __pyx_5 = (__pyx_v_jsException != NULL); if (__pyx_5) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":241 * JSStringRelease(jsScript) * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) # <<<<<<<<<<<<<< * return jsValueToPython(self.jsCtx,jsValue) * */ __pyx_1 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsException); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_1, 0, 0); Py_DECREF(__pyx_1); __pyx_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":242 * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) * return jsValueToPython(self.jsCtx,jsValue) # <<<<<<<<<<<<<< * * def getCtx(self): */ __pyx_2 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsValue); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_2; __pyx_2 = 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); __Pyx_AddTraceback("jswebkit.JSContext.EvaluateScript"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_script); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":244 * return jsValueToPython(self.jsCtx,jsValue) * * def getCtx(self): # <<<<<<<<<<<<<< * return self.ctx * */ static PyObject *__pyx_pf_8jswebkit_9JSContext_getCtx(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_9JSContext_getCtx(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":245 * * def getCtx(self): * return self.ctx # <<<<<<<<<<<<<< * * */ Py_INCREF(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx); __pyx_r = ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); __pyx_L0:; return __pyx_r; } static struct __pyx_vtabstruct_8jswebkit_JSObject __pyx_vtable_8jswebkit_JSObject; static PyObject *__pyx_tp_new_8jswebkit_JSObject(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSObject *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSObject *)o); p->__pyx_vtab = __pyx_vtabptr_8jswebkit_JSObject; p->propertyNames = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_8jswebkit_JSObject(PyObject *o) { struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; Py_XDECREF(p->propertyNames); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8jswebkit_JSObject(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; if (p->propertyNames) { e = (*v)(p->propertyNames, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8jswebkit_JSObject(PyObject *o) { struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; PyObject* tmp; tmp = ((PyObject*)p->propertyNames); p->propertyNames = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_sq_item_8jswebkit_JSObject(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static int __pyx_mp_ass_subscript_8jswebkit_JSObject(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_pf_8jswebkit_8JSObject___setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); return -1; } } static PyObject *__pyx_tp_getattro_8jswebkit_JSObject(PyObject *o, PyObject *n) { PyObject *v = PyObject_GenericGetAttr(o, n); if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); v = __pyx_pf_8jswebkit_8JSObject___getattr__(o, n); } return v; } static int __pyx_tp_setattro_8jswebkit_JSObject(PyObject *o, PyObject *n, PyObject *v) { if (v) { return __pyx_pf_8jswebkit_8JSObject___setattr__(o, n, v); } else { return PyObject_GenericSetAttr(o, n, 0); } } static struct PyMethodDef __pyx_methods_8jswebkit_JSObject[] = { {"getPropertyNames", (PyCFunction)__pyx_pf_8jswebkit_8JSObject_getPropertyNames, METH_NOARGS, 0}, {"__getattr__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___getattr__, METH_O|METH_COEXIST, 0}, {"__getitem__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___getitem__, METH_O|METH_COEXIST, 0}, {"__del__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___del__, METH_NOARGS, 0}, {"__iter__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___iter__, METH_NOARGS|METH_COEXIST, 0}, {"__next__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___next__, METH_NOARGS|METH_COEXIST, 0}, {"next", (PyCFunction)__pyx_pf_8jswebkit_8JSObject_next, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSObject = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSObject = { __pyx_pf_8jswebkit_8JSObject___len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_8jswebkit_JSObject, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSObject = { __pyx_pf_8jswebkit_8JSObject___len__, /*mp_length*/ __pyx_pf_8jswebkit_8JSObject___getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_8jswebkit_JSObject, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSObject = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSObject = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSObject", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSObject, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSObject, /*tp_as_number*/ &__pyx_tp_as_sequence_JSObject, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSObject, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ __pyx_tp_getattro_8jswebkit_JSObject, /*tp_getattro*/ __pyx_tp_setattro_8jswebkit_JSObject, /*tp_setattro*/ &__pyx_tp_as_buffer_JSObject, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSObject, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSObject, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_8jswebkit_8JSObject___iter__, /*tp_iter*/ __pyx_pf_8jswebkit_8JSObject___next__, /*tp_iternext*/ __pyx_methods_8jswebkit_JSObject, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_8JSObject___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSObject, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct __pyx_vtabstruct_8jswebkit_JSFunction __pyx_vtable_8jswebkit_JSFunction; static PyObject *__pyx_tp_new_8jswebkit_JSFunction(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSFunction *p; PyObject *o = __pyx_tp_new_8jswebkit_JSObject(t, a, k); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSFunction *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8jswebkit_JSObject*)__pyx_vtabptr_8jswebkit_JSFunction; return o; } static struct PyMethodDef __pyx_methods_8jswebkit_JSFunction[] = { {"__call__", (PyCFunction)__pyx_pf_8jswebkit_10JSFunction___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSFunction = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSFunction = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSFunction = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSFunction = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSFunction = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSFunction", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSObject, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSFunction, /*tp_as_number*/ &__pyx_tp_as_sequence_JSFunction, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSFunction, /*tp_as_mapping*/ 0, /*tp_hash*/ __pyx_pf_8jswebkit_10JSFunction___call__, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_JSFunction, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSObject, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSObject, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8jswebkit_JSFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_10JSFunction___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_8jswebkit_JSContext(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSContext *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSContext *)o); p->ctx = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_8jswebkit_JSContext(PyObject *o) { struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; Py_XDECREF(p->ctx); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8jswebkit_JSContext(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; if (p->ctx) { e = (*v)(p->ctx, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8jswebkit_JSContext(PyObject *o) { struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; PyObject* tmp; tmp = ((PyObject*)p->ctx); p->ctx = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static struct PyMethodDef __pyx_methods_8jswebkit_JSContext[] = { {"EvaluateScript", (PyCFunction)__pyx_pf_8jswebkit_9JSContext_EvaluateScript, METH_VARARGS|METH_KEYWORDS, 0}, {"getCtx", (PyCFunction)__pyx_pf_8jswebkit_9JSContext_getCtx, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSContext = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSContext = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSContext = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSContext = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSContext = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSContext", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSContext), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSContext, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSContext, /*tp_as_number*/ &__pyx_tp_as_sequence_JSContext, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSContext, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_JSContext, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSContext, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSContext, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8jswebkit_JSContext, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_9JSContext___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSContext, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; static void __pyx_init_filenames(void); /*proto*/ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "jswebkit", __pyx_mdoc, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, {&__pyx_kp_getPropertyNames, __pyx_k_getPropertyNames, sizeof(__pyx_k_getPropertyNames), 1, 1, 1}, {&__pyx_kp___getattr__, __pyx_k___getattr__, sizeof(__pyx_k___getattr__), 1, 1, 1}, {&__pyx_kp___setattr__, __pyx_k___setattr__, sizeof(__pyx_k___setattr__), 1, 1, 1}, {&__pyx_kp___getitem__, __pyx_k___getitem__, sizeof(__pyx_k___getitem__), 1, 1, 1}, {&__pyx_kp___setitem__, __pyx_k___setitem__, sizeof(__pyx_k___setitem__), 1, 1, 1}, {&__pyx_kp___del__, __pyx_k___del__, sizeof(__pyx_k___del__), 1, 1, 1}, {&__pyx_kp___iter__, __pyx_k___iter__, sizeof(__pyx_k___iter__), 1, 1, 1}, {&__pyx_kp___next__, __pyx_k___next__, sizeof(__pyx_k___next__), 1, 1, 1}, {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, {&__pyx_kp___len__, __pyx_k___len__, sizeof(__pyx_k___len__), 1, 1, 1}, {&__pyx_kp___call__, __pyx_k___call__, sizeof(__pyx_k___call__), 1, 1, 1}, {&__pyx_kp_EvaluateScript, __pyx_k_EvaluateScript, sizeof(__pyx_k_EvaluateScript), 1, 1, 1}, {&__pyx_kp_getCtx, __pyx_k_getCtx, sizeof(__pyx_k_getCtx), 1, 1, 1}, {&__pyx_kp_self, __pyx_k_self, sizeof(__pyx_k_self), 1, 1, 1}, {&__pyx_kp_name, __pyx_k_name, sizeof(__pyx_k_name), 1, 1, 1}, {&__pyx_kp_message, __pyx_k_message, sizeof(__pyx_k_message), 1, 1, 1}, {&__pyx_kp_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 1}, {&__pyx_kp_key, __pyx_k_key, sizeof(__pyx_k_key), 1, 1, 1}, {&__pyx_kp_thisObj, __pyx_k_thisObj, sizeof(__pyx_k_thisObj), 1, 1, 1}, {&__pyx_kp_ctx, __pyx_k_ctx, sizeof(__pyx_k_ctx), 1, 1, 1}, {&__pyx_kp_script, __pyx_k_script, sizeof(__pyx_k_script), 1, 1, 1}, {&__pyx_kp_thisObject, __pyx_k_thisObject, sizeof(__pyx_k_thisObject), 1, 1, 1}, {&__pyx_kp_sourceURL, __pyx_k_sourceURL, sizeof(__pyx_k_sourceURL), 1, 1, 1}, {&__pyx_kp_startingLineNumber, __pyx_k_startingLineNumber, sizeof(__pyx_k_startingLineNumber), 1, 1, 1}, {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1}, {&__pyx_kp_types, __pyx_k_types, sizeof(__pyx_k_types), 1, 1, 1}, {&__pyx_kp_JSException, __pyx_k_JSException, sizeof(__pyx_k_JSException), 0, 1, 1}, {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1}, {&__pyx_kp___str__, __pyx_k___str__, sizeof(__pyx_k___str__), 1, 1, 1}, {&__pyx_kp_mess, __pyx_k_mess, sizeof(__pyx_k_mess), 1, 1, 1}, {&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1}, {&__pyx_kp_NoneType, __pyx_k_NoneType, sizeof(__pyx_k_NoneType), 1, 1, 1}, {&__pyx_kp_BooleanType, __pyx_k_BooleanType, sizeof(__pyx_k_BooleanType), 1, 1, 1}, {&__pyx_kp_IntType, __pyx_k_IntType, sizeof(__pyx_k_IntType), 1, 1, 1}, {&__pyx_kp_FloatType, __pyx_k_FloatType, sizeof(__pyx_k_FloatType), 1, 1, 1}, {&__pyx_kp_StringTypes, __pyx_k_StringTypes, sizeof(__pyx_k_StringTypes), 1, 1, 1}, {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, {&__pyx_kp_fromkeys, __pyx_k_fromkeys, sizeof(__pyx_k_fromkeys), 1, 1, 1}, {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, {&__pyx_kp_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 1, 1, 1}, {&__pyx_kp_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 1, 1, 1}, {&__pyx_kp_length, __pyx_k_length, sizeof(__pyx_k_length), 1, 1, 1}, {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0}, {&__pyx_kp_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 1, 1, 1}, {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_kp_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_kp_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_kp_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initjswebkit(void); /*proto*/ PyMODINIT_FUNC initjswebkit(void) #else PyMODINIT_FUNC PyInit_jswebkit(void); /*proto*/ PyMODINIT_FUNC PyInit_jswebkit(void) #endif { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Library function declarations ---*/ __pyx_init_filenames(); /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("jswebkit", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_8jswebkit_JSObject = &__pyx_vtable_8jswebkit_JSObject; *(void(**)(void))&__pyx_vtable_8jswebkit_JSObject.setup = (void(*)(void))__pyx_f_8jswebkit_8JSObject_setup; if (PyType_Ready(&__pyx_type_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_8jswebkit_JSObject.tp_dict, __pyx_vtabptr_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSObject", (PyObject *)&__pyx_type_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSObject = &__pyx_type_8jswebkit_JSObject; __pyx_vtabptr_8jswebkit_JSFunction = &__pyx_vtable_8jswebkit_JSFunction; __pyx_vtable_8jswebkit_JSFunction.__pyx_base = *__pyx_vtabptr_8jswebkit_JSObject; __pyx_type_8jswebkit_JSFunction.tp_base = __pyx_ptype_8jswebkit_JSObject; if (PyType_Ready(&__pyx_type_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_8jswebkit_JSFunction.tp_dict, __pyx_vtabptr_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSFunction", (PyObject *)&__pyx_type_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSFunction = &__pyx_type_8jswebkit_JSFunction; if (PyType_Ready(&__pyx_type_8jswebkit_JSContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSContext", (PyObject *)&__pyx_type_8jswebkit_JSContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSContext = &__pyx_type_8jswebkit_JSContext; /*--- Type import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":24 * binascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n') * """ * import sys # <<<<<<<<<<<<<< * import types * cdef : */ __pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":25 * """ * import sys * import types # <<<<<<<<<<<<<< * cdef : * ctypedef unsigned short bool */ __pyx_1 = __Pyx_Import(__pyx_kp_types, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_kp_types, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":78 * return None * * class JSException(Exception): # <<<<<<<<<<<<<< * def __init__(self,name,message): * self.name = name */ __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_builtin_Exception); __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_2), ((PyObject *)__pyx_1), __pyx_kp_JSException, "jswebkit"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; /* "/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 */ __pyx_2 = PyCFunction_New(&__pyx_mdef_8jswebkit_11JSException___init__, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (PyObject_SetAttr(__pyx_3, __pyx_kp___init__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/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) * */ __pyx_2 = PyCFunction_New(&__pyx_mdef_8jswebkit_11JSException___str__, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (PyObject_SetAttr(__pyx_3, __pyx_kp___str__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_kp_JSException, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; /* "/var/lib/python-support/python2.6/Cython/Includes/python_object.pxd":1 * cdef extern from "Python.h": # <<<<<<<<<<<<<< * ctypedef void PyObject * ctypedef void PyTypeObject */ #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("jswebkit"); #if PY_MAJOR_VERSION >= 3 return NULL; #endif } static const char *__pyx_filenames[] = { "jswebkit.pyx", }; /* Runtime support code */ static void __pyx_init_filenames(void) { __pyx_f = __pyx_filenames; } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } 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) { Py_ssize_t num_expected; const char *number, *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, #if PY_VERSION_HEX < 0x02050000 "%s() takes %s %d positional argument%s (%d given)", #else "%s() takes %s %zd positional argument%s (%zd given)", #endif func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { name = argnames; while (*name && (**name != key)) name++; if (*name) { if (name < first_kw_arg) goto arg_passed_twice; values[name-argnames] = value; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && strcmp(PyString_AS_STRING(**name), PyString_AS_STRING(key)) == 0) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && strcmp(PyString_AS_STRING(**name), PyString_AS_STRING(key)) == 0) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *__import__ = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; module = PyObject_CallFunction(__import__, "OOOO", name, global_dict, empty_dict, list); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); Py_XDECREF(empty_dict); return module; } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static PyObject *__Pyx_CreateClass( PyObject *bases, PyObject *dict, PyObject *name, char *modname) { PyObject *py_modname; PyObject *result = 0; #if PY_MAJOR_VERSION < 3 py_modname = PyString_FromString(modname); #else py_modname = PyUnicode_FromString(modname); #endif if (!py_modname) goto bad; if (PyDict_SetItemString(dict, "__module__", py_modname) < 0) goto bad; #if PY_MAJOR_VERSION < 3 result = PyClass_New(bases, dict, name); #else result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL); #endif bad: Py_XDECREF(py_modname); return result; } static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (obj == Py_None || PyObject_TypeCheck(obj, type)) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); __Pyx_ErrFetch(type, value, tb); PyErr_NormalizeException(type, value, tb); if (PyErr_Occurred()) goto bad; Py_INCREF(*type); Py_INCREF(*value); Py_INCREF(*tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: Py_XDECREF(*type); Py_XDECREF(*value); Py_XDECREF(*tb); return -1; } static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { PyObject *item; if (!(item = PyIter_Next(iter))) { if (!PyErr_Occurred()) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d values to unpack", (int)index); #else "need more than %zd values to unpack", index); #endif } } return item; } static int __Pyx_EndUnpack(PyObject *iter) { PyObject *item; if ((item = PyIter_Next(iter))) { Py_DECREF(item); PyErr_SetString(PyExc_ValueError, "too many values to unpack"); return -1; } else if (!PyErr_Occurred()) return 0; else return -1; } static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { PyObject *pycobj = 0; int result; pycobj = PyCObject_FromVoidPtr(vtable, 0); if (!pycobj) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) goto bad; result = 0; goto done; bad: result = -1; done: Py_XDECREF(pycobj); return result; } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; #if PY_MAJOR_VERSION < 3 empty_string = PyString_FromStringAndSize("", 0); #else empty_string = PyBytes_FromStringAndSize("", 0); #endif if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ empty_string, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ empty_string /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode && (!t->is_identifier)) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_identifier || (t->is_unicode && t->intern)) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->is_unicode) { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if (x == Py_False) return 0; else return PyObject_IsTrue(x); } static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { return PyInt_AS_LONG(x); } else if (PyLong_CheckExact(x)) { return PyLong_AsLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { long val = PyInt_AS_LONG(x); if (unlikely(val < 0)) { PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); return (unsigned PY_LONG_LONG)-1; } return val; } else if (PyLong_CheckExact(x)) { return PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { if (sizeof(unsigned char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned char val = (unsigned char)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); return (unsigned char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { if (sizeof(unsigned short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned short val = (unsigned short)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); return (unsigned short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE char __pyx_PyInt_char(PyObject* x) { if (sizeof(char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); char val = (char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); return (char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE short __pyx_PyInt_short(PyObject* x) { if (sizeof(short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); short val = (short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); return (short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE int __pyx_PyInt_int(PyObject* x) { if (sizeof(int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); int val = (int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long __pyx_PyInt_long(PyObject* x) { if (sizeof(long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long val = (long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { if (sizeof(signed char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed char val = (signed char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); return (signed char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { if (sizeof(signed short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed short val = (signed short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); return (signed short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { if (sizeof(signed int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed int val = (signed int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); return (signed int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { if (sizeof(signed long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed long val = (signed long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); return (signed long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long double __pyx_PyInt_long_double(PyObject* x) { if (sizeof(long double) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long double val = (long double)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); return (long double)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } python-jswebkit-0.0.3/ChangeLog0000644000175000017500000000042711452073601015107 0ustar aronaron2010-10-03 Jiahug Huang * Fix build error with cython 0.13 * Release python-jswebkit-0.0.3 2010-04-15 Aron Xu * Release python-jswebkit-0.0.2 2009-01-02 Aron Xu * Release python-jswebkit-0.0.1 python-jswebkit-0.0.3/jswebkit.cpp0000644000175000017500000054060611452073143015674 0ustar aronaron/* 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 #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); __pyx_v_e = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":88 * cdef object makeException(JSContextRef ctx,JSValueRef jsException) : * e = jsValueToPython(ctx,jsException) * return JSException(e.name,e.message) # <<<<<<<<<<<<<< * * cdef object JSStringRefToPython(JSStringRef jsString) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_JSException); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_v_e, __pyx_kp_name); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_GetAttr(__pyx_v_e, __pyx_kp_message); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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_2; __pyx_2 = 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.makeException"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_e); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":90 * return JSException(e.name,e.message) * * cdef object JSStringRefToPython(JSStringRef jsString) : # <<<<<<<<<<<<<< * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 */ static PyObject *__pyx_f_8jswebkit_JSStringRefToPython(JSStringRef __pyx_v_jsString) { size_t __pyx_v_strlen; PyObject *__pyx_v_result; PyObject *__pyx_r; PyObject *__pyx_1 = 0; __pyx_v_result = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":91 * * cdef object JSStringRefToPython(JSStringRef jsString) : * cdef size_t strlen = JSStringGetLength(jsString) # <<<<<<<<<<<<<< * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) */ __pyx_v_strlen = JSStringGetLength(__pyx_v_jsString); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":92 * cdef object JSStringRefToPython(JSStringRef jsString) : * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 # <<<<<<<<<<<<<< * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) * return result */ __pyx_v_strlen *= 2; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":93 * cdef size_t strlen = JSStringGetLength(jsString) * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) # <<<<<<<<<<<<<< * return result * */ __pyx_1 = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(__pyx_v_jsString), __pyx_v_strlen, NULL, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":94 * strlen *= 2 * result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) * return result # <<<<<<<<<<<<<< * * cdef JSStringRef PythonToJSString(object pyStr) : */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("jswebkit.JSStringRefToPython"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_result); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":96 * return result * * cdef JSStringRef PythonToJSString(object pyStr) : # <<<<<<<<<<<<<< * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") */ static JSStringRef __pyx_f_8jswebkit_PythonToJSString(PyObject *__pyx_v_pyStr) { JSStringRef __pyx_v_jsStr; JSStringRef __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; Py_INCREF(__pyx_v_pyStr); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":98 * cdef JSStringRef PythonToJSString(object pyStr) : * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") # <<<<<<<<<<<<<< * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) * return jsStr */ __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_pyStr); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_pyStr); __pyx_2 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_encode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_2); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_v_pyStr); __pyx_v_pyStr = __pyx_3; __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":99 * """result has to be released""" * pyStr = unicode(pyStr).encode("utf-8") * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) # <<<<<<<<<<<<<< * return jsStr * */ __pyx_v_jsStr = JSStringCreateWithUTF8CString(PyString_AsString(__pyx_v_pyStr)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":100 * pyStr = unicode(pyStr).encode("utf-8") * cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) * return jsStr # <<<<<<<<<<<<<< * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): */ __pyx_r = __pyx_v_jsStr; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_WriteUnraisable("jswebkit.PythonToJSString"); __pyx_r = 0; __pyx_L0:; Py_DECREF(__pyx_v_pyStr); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":102 * return jsStr * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): # <<<<<<<<<<<<<< * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) */ static JSValueRef __pyx_f_8jswebkit_PythonTojsValue(JSContextRef __pyx_v_ctx, PyObject *__pyx_v_pyValue) { JSValueRef __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; int __pyx_3; __pyx_t_8jswebkit_bool __pyx_4; PyObject *__pyx_5 = 0; double __pyx_6; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":103 * * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): * if isinstance(pyValue,types.NoneType): # <<<<<<<<<<<<<< * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_NoneType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":104 * cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) # <<<<<<<<<<<<<< * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) */ __pyx_r = JSValueMakeNull(__pyx_v_ctx); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":105 * if isinstance(pyValue,types.NoneType): * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): # <<<<<<<<<<<<<< * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_BooleanType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":106 * return JSValueMakeNull(ctx) * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) # <<<<<<<<<<<<<< * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) */ __pyx_4 = __pyx_PyInt_unsigned_short(__pyx_v_pyValue); if (unlikely((__pyx_4 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = JSValueMakeBoolean(__pyx_v_ctx, __pyx_4); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":107 * elif isinstance(pyValue,types.BooleanType): * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : # <<<<<<<<<<<<<< * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : */ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_IntType); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_FloatType); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2); PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5); __pyx_2 = 0; __pyx_5 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, ((PyObject *)__pyx_1)); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":108 * return JSValueMakeBoolean(ctx,pyValue) * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) # <<<<<<<<<<<<<< * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) */ __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_v_pyValue); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = JSValueMakeNumber(__pyx_v_ctx, __pyx_6); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":109 * elif isinstance(pyValue,(types.IntType,types.FloatType)) : * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : # <<<<<<<<<<<<<< * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): */ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_types); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_StringTypes); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_3 = PyObject_IsInstance(__pyx_v_pyValue, __pyx_5); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_5); __pyx_5 = 0; if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":110 * return JSValueMakeNumber(ctx,pyValue) * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) # <<<<<<<<<<<<<< * elif isinstance(pyValue,JSObject): * return (pyValue).jsObject */ __pyx_r = JSValueMakeString(__pyx_v_ctx, __pyx_f_8jswebkit_PythonToJSString(__pyx_v_pyValue)); goto __pyx_L0; goto __pyx_L3; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":111 * elif isinstance(pyValue,types.StringTypes) : * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): # <<<<<<<<<<<<<< * return (pyValue).jsObject * else : */ __pyx_3 = PyObject_TypeCheck(__pyx_v_pyValue, ((PyTypeObject *)((PyObject*)__pyx_ptype_8jswebkit_JSObject))); if (__pyx_3) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":112 * return JSValueMakeString(ctx,PythonToJSString(pyValue)) * elif isinstance(pyValue,JSObject): * return (pyValue).jsObject # <<<<<<<<<<<<<< * else : * raise ValueError */ __pyx_r = ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_pyValue)->jsObject; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":114 * return (pyValue).jsObject * else : * raise ValueError # <<<<<<<<<<<<<< * * cdef class JSObject: */ __Pyx_Raise(__pyx_builtin_ValueError, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_5); __Pyx_WriteUnraisable("jswebkit.PythonTojsValue"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":122 * cdef int index * * def __init__(self) : # <<<<<<<<<<<<<< * self.ctx = NULL * self.jsObject = NULL */ static int __pyx_pf_8jswebkit_8JSObject___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":123 * * def __init__(self) : * self.ctx = NULL # <<<<<<<<<<<<<< * self.jsObject = NULL * self.index = 0 */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":124 * def __init__(self) : * self.ctx = NULL * self.jsObject = NULL # <<<<<<<<<<<<<< * self.index = 0 * */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":125 * self.ctx = NULL * self.jsObject = NULL * self.index = 0 # <<<<<<<<<<<<<< * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index = 0; __pyx_r = 0; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":127 * self.index = 0 * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): # <<<<<<<<<<<<<< * self.ctx = ctx * self.jsObject = jsObject */ static PyObject *__pyx_f_8jswebkit_8JSObject_setup(struct __pyx_obj_8jswebkit_JSObject *__pyx_v_self, JSContextRef __pyx_v_ctx, JSObjectRef __pyx_v_jsObject) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":128 * * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): * self.ctx = ctx # <<<<<<<<<<<<<< * self.jsObject = jsObject * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) */ __pyx_v_self->ctx = __pyx_v_ctx; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":129 * cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): * self.ctx = ctx * self.jsObject = jsObject # <<<<<<<<<<<<<< * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) * */ __pyx_v_self->jsObject = __pyx_v_jsObject; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":130 * self.ctx = ctx * self.jsObject = jsObject * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) # <<<<<<<<<<<<<< * * def getPropertyNames(self): */ __pyx_1 = PyObject_GetAttr(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_kp_fromkeys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_getPropertyNames); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2); __pyx_3 = 0; __pyx_2 = 0; __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; Py_DECREF(__pyx_v_self->propertyNames); __pyx_v_self->propertyNames = __pyx_3; __pyx_3 = 0; __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.JSObject.setup"); __pyx_r = 0; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":132 * self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) * * def getPropertyNames(self): # <<<<<<<<<<<<<< * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] */ static PyObject *__pyx_pf_8jswebkit_8JSObject_getPropertyNames(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject_getPropertyNames(PyObject *__pyx_v_self, PyObject *unused) { JSPropertyNameArrayRef __pyx_v_nameArray; PyObject *__pyx_v_names; PyObject *__pyx_v_i; PyObject *__pyx_r; PyObject *__pyx_1 = 0; Py_ssize_t __pyx_2 = 0; PyObject *__pyx_3 = 0; size_t __pyx_4; PyObject *__pyx_5 = 0; __pyx_v_names = Py_None; Py_INCREF(Py_None); __pyx_v_i = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":133 * * def getPropertyNames(self): * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) # <<<<<<<<<<<<<< * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): */ __pyx_v_nameArray = JSObjectCopyPropertyNames(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":134 * def getPropertyNames(self): * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] # <<<<<<<<<<<<<< * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) */ __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_names); __pyx_v_names = ((PyObject *)__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":135 * cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): # <<<<<<<<<<<<<< * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) */ __pyx_1 = PyLong_FromUnsignedLong(JSPropertyNameArrayGetCount(__pyx_v_nameArray)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; if (PyList_CheckExact(__pyx_1) || PyTuple_CheckExact(__pyx_1)) { __pyx_2 = 0; __pyx_3 = __pyx_1; Py_INCREF(__pyx_3); } else { __pyx_2 = -1; __pyx_3 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } Py_DECREF(__pyx_1); __pyx_1 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_3))) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_3)) break; __pyx_1 = PyList_GET_ITEM(__pyx_3, __pyx_2); Py_INCREF(__pyx_1); __pyx_2++; } else if (likely(PyTuple_CheckExact(__pyx_3))) { if (__pyx_2 >= PyTuple_GET_SIZE(__pyx_3)) break; __pyx_1 = PyTuple_GET_ITEM(__pyx_3, __pyx_2); Py_INCREF(__pyx_1); __pyx_2++; } else { __pyx_1 = PyIter_Next(__pyx_3); if (!__pyx_1) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":136 * names = [] * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) # <<<<<<<<<<<<<< * JSPropertyNameArrayRelease(nameArray) * return names */ __pyx_4 = PyInt_AsUnsignedLongMask(__pyx_v_i); if (unlikely((__pyx_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_1 = __pyx_f_8jswebkit_JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(__pyx_v_nameArray, __pyx_4)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = __Pyx_PyObject_Append(__pyx_v_names, __pyx_1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; } Py_DECREF(__pyx_3); __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":137 * for i in range(JSPropertyNameArrayGetCount(nameArray)): * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) # <<<<<<<<<<<<<< * return names * */ JSPropertyNameArrayRelease(__pyx_v_nameArray); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":138 * names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) * JSPropertyNameArrayRelease(nameArray) * return names # <<<<<<<<<<<<<< * * def __getattr__(self,name): */ Py_INCREF(__pyx_v_names); __pyx_r = __pyx_v_names; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.getPropertyNames"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_names); Py_DECREF(__pyx_v_i); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":140 * return names * * def __getattr__(self,name): # <<<<<<<<<<<<<< * cdef JSStringRef jsStr * cdef JSValueRef jsException */ static PyObject *__pyx_pf_8jswebkit_8JSObject___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { JSStringRef __pyx_v_jsStr; PyObject *__pyx_v_result; PyObject *__pyx_r; PyObject *__pyx_1 = 0; char *__pyx_2; int __pyx_3; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; __pyx_v_result = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":143 * cdef JSStringRef jsStr * cdef JSValueRef jsException * try : # <<<<<<<<<<<<<< * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string */ { PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); /*try:*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":144 * cdef JSValueRef jsException * try : * self.propertyNames[name] # <<<<<<<<<<<<<< * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) */ __pyx_1 = PyObject_GetItem(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->propertyNames, __pyx_v_name); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L5_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":145 * try : * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string # <<<<<<<<<<<<<< * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) */ __pyx_2 = __Pyx_PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L5_error;} __pyx_v_jsStr = JSStringCreateWithUTF8CString(__pyx_2); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":146 * self.propertyNames[name] * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) # <<<<<<<<<<<<<< * JSStringRelease(jsStr) * return result */ __pyx_1 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, JSObjectGetProperty(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_v_jsStr, NULL)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L5_error;} Py_DECREF(__pyx_v_result); __pyx_v_result = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":147 * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) # <<<<<<<<<<<<<< * return result * except KeyError : */ JSStringRelease(__pyx_v_jsStr); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":148 * result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) * JSStringRelease(jsStr) * return result # <<<<<<<<<<<<<< * except KeyError : * raise AttributeError,name */ Py_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L9_try_return; } Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; goto __pyx_L10_try; __pyx_L9_try_return:; Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; goto __pyx_L0; __pyx_L5_error:; Py_XDECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":149 * JSStringRelease(jsStr) * return result * except KeyError : # <<<<<<<<<<<<<< * raise AttributeError,name * */ __pyx_3 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_3) { __Pyx_AddTraceback("jswebkit.__getattr__"); if (__Pyx_GetException(&__pyx_1, &__pyx_4, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":150 * return result * except KeyError : * raise AttributeError,name # <<<<<<<<<<<<<< * * def __setattr__(self,name,value): */ __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_v_name, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; goto __pyx_L6_exception_handled; } __pyx_L7_except_error:; Py_XDECREF(__pyx_save_exc_type); Py_XDECREF(__pyx_save_exc_value); Py_XDECREF(__pyx_save_exc_tb); goto __pyx_L1_error; __pyx_L6_exception_handled:; __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); __pyx_L10_try:; } __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.__getattr__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_result); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":152 * raise AttributeError,name * * def __setattr__(self,name,value): # <<<<<<<<<<<<<< * cdef JSStringRef jsStr * self.propertyNames[name] = True */ static int __pyx_pf_8jswebkit_8JSObject___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { JSStringRef __pyx_v_jsStr; int __pyx_r; PyObject *__pyx_1 = 0; char *__pyx_2; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":154 * def __setattr__(self,name,value): * cdef JSStringRef jsStr * self.propertyNames[name] = True # <<<<<<<<<<<<<< * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) */ __pyx_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetItem(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->propertyNames, __pyx_v_name, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":155 * cdef JSStringRef jsStr * self.propertyNames[name] = True * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string # <<<<<<<<<<<<<< * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) * JSStringRelease(jsStr) */ __pyx_2 = __Pyx_PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsStr = JSStringCreateWithUTF8CString(__pyx_2); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":156 * self.propertyNames[name] = True * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) # <<<<<<<<<<<<<< * JSStringRelease(jsStr) * */ JSObjectSetProperty(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_v_jsStr, __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_value), kJSPropertyAttributeNone, NULL); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":157 * jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string * JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) * JSStringRelease(jsStr) # <<<<<<<<<<<<<< * * def __getitem__(self,key) : */ JSStringRelease(__pyx_v_jsStr); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); __Pyx_AddTraceback("jswebkit.JSObject.__setattr__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":159 * JSStringRelease(jsStr) * * def __getitem__(self,key) : # <<<<<<<<<<<<<< * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL */ static PyObject *__pyx_pf_8jswebkit_8JSObject___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { JSValueRef __pyx_v_jsValueRef; JSValueRef __pyx_v_jsException; PyObject *__pyx_r; unsigned int __pyx_1; int __pyx_2; PyObject *__pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":161 * def __getitem__(self,key) : * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":162 * cdef JSValueRef jsValueRef * cdef JSValueRef jsException = NULL * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) # <<<<<<<<<<<<<< * if jsException != NULL : * raise makeException(self.ctx,jsException) */ __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_key); if (unlikely((__pyx_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsValueRef = JSObjectGetPropertyAtIndex(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_1, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":163 * cdef JSValueRef jsException = NULL * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsException) * return jsValueToPython(self.ctx,jsValueRef) */ __pyx_2 = (__pyx_v_jsException != NULL); if (__pyx_2) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":164 * jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) * if jsException != NULL : * raise makeException(self.ctx,jsException) # <<<<<<<<<<<<<< * return jsValueToPython(self.ctx,jsValueRef) * */ __pyx_3 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsException); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":165 * if jsException != NULL : * raise makeException(self.ctx,jsException) * return jsValueToPython(self.ctx,jsValueRef) # <<<<<<<<<<<<<< * * def __setitem__(self,key,value): */ __pyx_3 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsValueRef); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; __pyx_3 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSObject.__getitem__"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":167 * return jsValueToPython(self.ctx,jsValueRef) * * def __setitem__(self,key,value): # <<<<<<<<<<<<<< * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL */ static int __pyx_pf_8jswebkit_8JSObject___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_8jswebkit_8JSObject___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { JSValueRef __pyx_v_jsValue; JSValueRef __pyx_v_jsException; int __pyx_r; unsigned int __pyx_1; int __pyx_2; PyObject *__pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":168 * * def __setitem__(self,key,value): * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) # <<<<<<<<<<<<<< * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) */ __pyx_v_jsValue = __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_value); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":169 * def __setitem__(self,key,value): * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":170 * cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) # <<<<<<<<<<<<<< * if jsException != NULL : * raise makeException(self.ctx,jsException) */ __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_key); if (unlikely((__pyx_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} JSObjectSetPropertyAtIndex(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject, __pyx_1, __pyx_v_jsValue, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":171 * cdef JSValueRef jsException = NULL * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsException) * */ __pyx_2 = (__pyx_v_jsException != NULL); if (__pyx_2) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":172 * JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) * if jsException != NULL : * raise makeException(self.ctx,jsException) # <<<<<<<<<<<<<< * * def __del__(self): */ __pyx_3 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, __pyx_v_jsException); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSObject.__setitem__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":174 * raise makeException(self.ctx,jsException) * * def __del__(self): # <<<<<<<<<<<<<< * JSValueUnprotect(self.ctx,self.jsObject) * */ static PyObject *__pyx_pf_8jswebkit_8JSObject___del__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___del__(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":175 * * def __del__(self): * JSValueUnprotect(self.ctx,self.jsObject) # <<<<<<<<<<<<<< * * # these are container methods, so that lists behave correctly */ JSValueUnprotect(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->ctx, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->jsObject); __pyx_r = Py_None; Py_INCREF(Py_None); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":178 * * # these are container methods, so that lists behave correctly * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_8jswebkit_8JSObject___iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":179 * # these are container methods, so that lists behave correctly * def __iter__(self): * return self # <<<<<<<<<<<<<< * * def __next__(self): # 2.6 and 3.0 now use __next__ */ Py_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":181 * return self * * def __next__(self): # 2.6 and 3.0 now use __next__ # <<<<<<<<<<<<<< * if self.index < self.length: * value = self[self.index] */ static PyObject *__pyx_pf_8jswebkit_8JSObject___next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject___next__(PyObject *__pyx_v_self) { PyObject *__pyx_v_value; PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; int __pyx_4; __pyx_v_value = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":182 * * def __next__(self): # 2.6 and 3.0 now use __next__ * if self.index < self.length: # <<<<<<<<<<<<<< * value = self[self.index] * self.index += 1 */ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_length); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_3 = PyObject_RichCompare(__pyx_1, __pyx_2, Py_LT); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; if (__pyx_4) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":183 * def __next__(self): # 2.6 and 3.0 now use __next__ * if self.index < self.length: * value = self[self.index] # <<<<<<<<<<<<<< * self.index += 1 * return value */ __pyx_1 = __Pyx_GetItemInt(__pyx_v_self, ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_value); __pyx_v_value = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":184 * if self.index < self.length: * value = self[self.index] * self.index += 1 # <<<<<<<<<<<<<< * return value * else: */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index += 1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":185 * value = self[self.index] * self.index += 1 * return value # <<<<<<<<<<<<<< * else: * self.index = 0 */ Py_INCREF(__pyx_v_value); __pyx_r = __pyx_v_value; goto __pyx_L0; goto __pyx_L5; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":187 * return value * else: * self.index = 0 # <<<<<<<<<<<<<< * raise StopIteration * */ ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_self)->index = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":188 * else: * self.index = 0 * raise StopIteration # <<<<<<<<<<<<<< * * def next(self): # wrapper for backwards compatibility */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L5:; __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); __Pyx_AddTraceback("jswebkit.JSObject.__next__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_value); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":190 * raise StopIteration * * def next(self): # wrapper for backwards compatibility # <<<<<<<<<<<<<< * return self.__next__() * */ static PyObject *__pyx_pf_8jswebkit_8JSObject_next(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_8JSObject_next(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":191 * * def next(self): # wrapper for backwards compatibility * return self.__next__() # <<<<<<<<<<<<<< * * def __len__(self): */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___next__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_r = __pyx_2; __pyx_2 = 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); __Pyx_AddTraceback("jswebkit.JSObject.next"); __pyx_r = NULL; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":193 * return self.__next__() * * def __len__(self): # <<<<<<<<<<<<<< * length = len(self.getPropertyNames()) * if hasattr(self, "length"): */ static Py_ssize_t __pyx_pf_8jswebkit_8JSObject___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pf_8jswebkit_8JSObject___len__(PyObject *__pyx_v_self) { PyObject *__pyx_v_length; Py_ssize_t __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; Py_ssize_t __pyx_3 = 0; int __pyx_4; PyObject *__pyx_5 = 0; __pyx_v_length = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":194 * * def __len__(self): * length = len(self.getPropertyNames()) # <<<<<<<<<<<<<< * if hasattr(self, "length"): * length += int(self.length) */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_getPropertyNames); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; __pyx_3 = PyObject_Length(__pyx_2); if (unlikely(__pyx_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_1 = PyInt_FromSsize_t(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_1; __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":195 * def __len__(self): * length = len(self.getPropertyNames()) * if hasattr(self, "length"): # <<<<<<<<<<<<<< * length += int(self.length) * return length */ __pyx_4 = PyObject_HasAttr(__pyx_v_self, __pyx_kp_3); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_4) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":196 * length = len(self.getPropertyNames()) * if hasattr(self, "length"): * length += int(self.length) # <<<<<<<<<<<<<< * return length * */ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_length); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1); __pyx_1 = 0; __pyx_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; __pyx_5 = __pyx_v_length; Py_INCREF(__pyx_5); __pyx_2 = PyNumber_InPlaceAdd(__pyx_5, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_v_length); __pyx_v_length = __pyx_2; __pyx_2 = 0; goto __pyx_L5; } __pyx_L5:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":197 * if hasattr(self, "length"): * length += int(self.length) * return length # <<<<<<<<<<<<<< * * */ __pyx_3 = __pyx_PyIndex_AsSsize_t(__pyx_v_length); if (unlikely((__pyx_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSObject.__len__"); __pyx_r = -1; __pyx_L0:; Py_DECREF(__pyx_v_length); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":201 * * cdef class JSFunction(JSObject): * def __init__(self) : # <<<<<<<<<<<<<< * JSObject.__init__(self) * */ static int __pyx_pf_8jswebkit_10JSFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_10JSFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":202 * cdef class JSFunction(JSObject): * def __init__(self) : * JSObject.__init__(self) # <<<<<<<<<<<<<< * * def __call__(self,thisObj,*args): */ __pyx_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8jswebkit_JSObject)), __pyx_kp___init__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); __Pyx_AddTraceback("jswebkit.JSFunction.__init__"); __pyx_r = -1; __pyx_L0:; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":204 * JSObject.__init__(self) * * def __call__(self,thisObj,*args): # <<<<<<<<<<<<<< * cdef JSValueRef *jsArgs * cdef JSValueRef result */ static PyObject *__pyx_pf_8jswebkit_10JSFunction___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_8jswebkit_10JSFunction___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_thisObj = 0; PyObject *__pyx_v_args = 0; JSValueRef *__pyx_v_jsArgs; JSValueRef __pyx_v_result; JSObjectRef __pyx_v_jsThisObject; JSValueRef __pyx_v_jsError; PyObject *__pyx_v_i; PyObject *__pyx_v_arg; PyObject *__pyx_r; Py_ssize_t __pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; Py_ssize_t __pyx_6 = 0; int __pyx_7; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_thisObj,0}; if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); if (unlikely(!__pyx_v_args)) return NULL; } else { __pyx_v_args = __pyx_empty_tuple; Py_INCREF(__pyx_empty_tuple); } if (unlikely(__pyx_kwds)) { PyObject* values[1] = {0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_thisObj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_thisObj = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_thisObj = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; Py_DECREF(__pyx_v_args); __Pyx_AddTraceback("jswebkit.JSFunction.__call__"); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_i = Py_None; Py_INCREF(Py_None); __pyx_v_arg = Py_None; Py_INCREF(Py_None); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":208 * cdef JSValueRef result * cdef JSObjectRef jsThisObject * cdef JSValueRef jsError = NULL # <<<<<<<<<<<<<< * if len(args) : * jsArgs = malloc(len(args) * sizeof(JSValueRef)) */ __pyx_v_jsError = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":209 * cdef JSObjectRef jsThisObject * cdef JSValueRef jsError = NULL * if len(args) : # <<<<<<<<<<<<<< * jsArgs = malloc(len(args) * sizeof(JSValueRef)) * else : */ __pyx_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_1) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":210 * cdef JSValueRef jsError = NULL * if len(args) : * jsArgs = malloc(len(args) * sizeof(JSValueRef)) # <<<<<<<<<<<<<< * else : * jsArgs = NULL */ __pyx_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsArgs = ((JSValueRef *)malloc((__pyx_1 * (sizeof(JSValueRef))))); goto __pyx_L6; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":212 * jsArgs = malloc(len(args) * sizeof(JSValueRef)) * else : * jsArgs = NULL # <<<<<<<<<<<<<< * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) */ __pyx_v_jsArgs = NULL; } __pyx_L6:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":213 * else : * jsArgs = NULL * for i,arg in enumerate(args) : # <<<<<<<<<<<<<< * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : */ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_args); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args); __pyx_3 = PyObject_Call(__pyx_builtin_enumerate, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; if (PyList_CheckExact(__pyx_3) || PyTuple_CheckExact(__pyx_3)) { __pyx_1 = 0; __pyx_2 = __pyx_3; Py_INCREF(__pyx_2); } else { __pyx_1 = -1; __pyx_2 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } Py_DECREF(__pyx_3); __pyx_3 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_2))) { if (__pyx_1 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_1); Py_INCREF(__pyx_3); __pyx_1++; } else if (likely(PyTuple_CheckExact(__pyx_2))) { if (__pyx_1 >= PyTuple_GET_SIZE(__pyx_2)) break; __pyx_3 = PyTuple_GET_ITEM(__pyx_2, __pyx_1); Py_INCREF(__pyx_3); __pyx_1++; } else { __pyx_3 = PyIter_Next(__pyx_2); if (!__pyx_3) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } } if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { PyObject* tuple = __pyx_3; __pyx_5 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(__pyx_5); Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_5; __pyx_5 = 0; __pyx_5 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(__pyx_5); Py_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_5; __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; } else { __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_i); __pyx_v_i = __pyx_5; __pyx_5 = 0; __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_5; __pyx_5 = 0; if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":214 * jsArgs = NULL * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) # <<<<<<<<<<<<<< * if thisObj : * jsThisObject = (thisObj).jsObject */ __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} (__pyx_v_jsArgs[__pyx_6]) = __pyx_f_8jswebkit_PythonTojsValue(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_arg); } Py_DECREF(__pyx_2); __pyx_2 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":215 * for i,arg in enumerate(args) : * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : # <<<<<<<<<<<<<< * jsThisObject = (thisObj).jsObject * else : */ __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_v_thisObj); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_7) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":216 * jsArgs[i] = PythonTojsValue(self.ctx,arg) * if thisObj : * jsThisObject = (thisObj).jsObject # <<<<<<<<<<<<<< * else : * jsThisObject = NULL */ __pyx_v_jsThisObject = ((struct __pyx_obj_8jswebkit_JSObject *)__pyx_v_thisObj)->jsObject; goto __pyx_L9; } /*else*/ { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":218 * jsThisObject = (thisObj).jsObject * else : * jsThisObject = NULL # <<<<<<<<<<<<<< * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) */ __pyx_v_jsThisObject = NULL; } __pyx_L9:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":219 * else : * jsThisObject = NULL * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) # <<<<<<<<<<<<<< * free(jsArgs) * if jsError!=NULL : */ __pyx_6 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = JSObjectCallAsFunction(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, ((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.jsObject, __pyx_v_jsThisObject, __pyx_6, __pyx_v_jsArgs, (&__pyx_v_jsError)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":220 * jsThisObject = NULL * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) # <<<<<<<<<<<<<< * if jsError!=NULL : * raise makeException(self.ctx,jsError) */ free(__pyx_v_jsArgs); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":221 * result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) * free(jsArgs) * if jsError!=NULL : # <<<<<<<<<<<<<< * raise makeException(self.ctx,jsError) * return jsValueToPython(self.ctx,result) */ __pyx_7 = (__pyx_v_jsError != NULL); if (__pyx_7) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":222 * free(jsArgs) * if jsError!=NULL : * raise makeException(self.ctx,jsError) # <<<<<<<<<<<<<< * return jsValueToPython(self.ctx,result) * */ __pyx_5 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_jsError); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_5, 0, 0); Py_DECREF(__pyx_5); __pyx_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":223 * if jsError!=NULL : * raise makeException(self.ctx,jsError) * return jsValueToPython(self.ctx,result) # <<<<<<<<<<<<<< * * */ __pyx_3 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSFunction *)__pyx_v_self)->__pyx_base.ctx, __pyx_v_result); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_3; __pyx_3 = 0; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); __Pyx_AddTraceback("jswebkit.JSFunction.__call__"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_args); Py_DECREF(__pyx_v_i); Py_DECREF(__pyx_v_arg); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":229 * cdef JSContextRef jsCtx * cdef object ctx * def __init__(self,ctx): # <<<<<<<<<<<<<< * self.ctx = ctx * self.jsCtx = PyCObject_AsVoidPtr(ctx) */ static int __pyx_pf_8jswebkit_9JSContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_8jswebkit_9JSContext___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_ctx = 0; int __pyx_r; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_ctx,0}; if (unlikely(__pyx_kwds)) { PyObject* values[1] = {0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { 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_ctx); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_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 = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_ctx = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_ctx = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("jswebkit.JSContext.__init__"); return -1; __pyx_L4_argument_unpacking_done:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":230 * cdef object ctx * def __init__(self,ctx): * self.ctx = ctx # <<<<<<<<<<<<<< * self.jsCtx = PyCObject_AsVoidPtr(ctx) * */ Py_INCREF(__pyx_v_ctx); Py_DECREF(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx); ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx = __pyx_v_ctx; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":231 * def __init__(self,ctx): * self.ctx = ctx * self.jsCtx = PyCObject_AsVoidPtr(ctx) # <<<<<<<<<<<<<< * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): */ ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx = ((struct OpaqueJSContext *)PyCObject_AsVoidPtr(__pyx_v_ctx)); __pyx_r = 0; return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":233 * self.jsCtx = PyCObject_AsVoidPtr(ctx) * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): # <<<<<<<<<<<<<< * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) */ static PyObject *__pyx_pf_8jswebkit_9JSContext_EvaluateScript(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_8jswebkit_9JSContext_EvaluateScript(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_script = 0; PyObject *__pyx_v_thisObject = 0; PyObject *__pyx_v_sourceURL = 0; PyObject *__pyx_v_startingLineNumber = 0; JSStringRef __pyx_v_jsScript; JSValueRef __pyx_v_jsException; JSValueRef __pyx_v_jsValue; PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; int __pyx_4; int __pyx_5; static PyObject **__pyx_pyargnames[] = {&__pyx_kp_script,&__pyx_kp_thisObject,&__pyx_kp_sourceURL,&__pyx_kp_startingLineNumber,0}; __pyx_v_thisObject = Py_None; __pyx_v_sourceURL = Py_None; __pyx_v_startingLineNumber = __pyx_int_1; if (unlikely(__pyx_kwds)) { PyObject* values[4] = {0,0,0,0}; Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); 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_script); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "EvaluateScript") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_script = values[0]; if (values[1]) { __pyx_v_thisObject = values[1]; } if (values[2]) { __pyx_v_sourceURL = values[2]; } if (values[3]) { __pyx_v_startingLineNumber = values[3]; } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __pyx_v_startingLineNumber = PyTuple_GET_ITEM(__pyx_args, 3); case 3: __pyx_v_sourceURL = PyTuple_GET_ITEM(__pyx_args, 2); case 2: __pyx_v_thisObject = PyTuple_GET_ITEM(__pyx_args, 1); case 1: __pyx_v_script = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("EvaluateScript", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("jswebkit.JSContext.EvaluateScript"); return NULL; __pyx_L4_argument_unpacking_done:; Py_INCREF(__pyx_v_script); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":234 * * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): * script = unicode(script).encode("utf-8") # <<<<<<<<<<<<<< * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL */ __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_v_script); PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_script); __pyx_2 = PyObject_Call(((PyObject *)((PyObject*)&PyUnicode_Type)), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_encode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_kp_4); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_4); __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; Py_DECREF(__pyx_v_script); __pyx_v_script = __pyx_3; __pyx_3 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":235 * def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) # <<<<<<<<<<<<<< * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) */ __pyx_v_jsScript = JSStringCreateWithUTF8CString(PyString_AsString(__pyx_v_script)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":236 * script = unicode(script).encode("utf-8") * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL # <<<<<<<<<<<<<< * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) */ __pyx_v_jsException = NULL; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":237 * cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) # <<<<<<<<<<<<<< * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) */ __pyx_4 = __pyx_PyInt_int(__pyx_v_startingLineNumber); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_jsValue = JSEvaluateScript(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsScript, ((struct OpaqueJSValue *)NULL), ((struct OpaqueJSString *)NULL), __pyx_4, (&__pyx_v_jsException)); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":238 * cdef JSValueRef jsException = NULL * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) # <<<<<<<<<<<<<< * JSStringRelease(jsScript) * if jsException!=NULL : */ JSValueProtect(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsValue); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":239 * cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) # <<<<<<<<<<<<<< * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) */ JSStringRelease(__pyx_v_jsScript); /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":240 * JSValueProtect(self.jsCtx,jsValue) * JSStringRelease(jsScript) * if jsException!=NULL : # <<<<<<<<<<<<<< * raise makeException(self.jsCtx,jsException) * return jsValueToPython(self.jsCtx,jsValue) */ __pyx_5 = (__pyx_v_jsException != NULL); if (__pyx_5) { /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":241 * JSStringRelease(jsScript) * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) # <<<<<<<<<<<<<< * return jsValueToPython(self.jsCtx,jsValue) * */ __pyx_1 = __pyx_f_8jswebkit_makeException(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsException); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_Raise(__pyx_1, 0, 0); Py_DECREF(__pyx_1); __pyx_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":242 * if jsException!=NULL : * raise makeException(self.jsCtx,jsException) * return jsValueToPython(self.jsCtx,jsValue) # <<<<<<<<<<<<<< * * def getCtx(self): */ __pyx_2 = __pyx_f_8jswebkit_jsValueToPython(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->jsCtx, __pyx_v_jsValue); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_2; __pyx_2 = 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); __Pyx_AddTraceback("jswebkit.JSContext.EvaluateScript"); __pyx_r = NULL; __pyx_L0:; Py_DECREF(__pyx_v_script); return __pyx_r; } /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":244 * return jsValueToPython(self.jsCtx,jsValue) * * def getCtx(self): # <<<<<<<<<<<<<< * return self.ctx * */ static PyObject *__pyx_pf_8jswebkit_9JSContext_getCtx(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8jswebkit_9JSContext_getCtx(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":245 * * def getCtx(self): * return self.ctx # <<<<<<<<<<<<<< * * */ Py_INCREF(((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx); __pyx_r = ((struct __pyx_obj_8jswebkit_JSContext *)__pyx_v_self)->ctx; goto __pyx_L0; __pyx_r = Py_None; Py_INCREF(Py_None); __pyx_L0:; return __pyx_r; } static struct __pyx_vtabstruct_8jswebkit_JSObject __pyx_vtable_8jswebkit_JSObject; static PyObject *__pyx_tp_new_8jswebkit_JSObject(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSObject *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSObject *)o); p->__pyx_vtab = __pyx_vtabptr_8jswebkit_JSObject; p->propertyNames = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_8jswebkit_JSObject(PyObject *o) { struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; Py_XDECREF(p->propertyNames); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8jswebkit_JSObject(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; if (p->propertyNames) { e = (*v)(p->propertyNames, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8jswebkit_JSObject(PyObject *o) { struct __pyx_obj_8jswebkit_JSObject *p = (struct __pyx_obj_8jswebkit_JSObject *)o; PyObject* tmp; tmp = ((PyObject*)p->propertyNames); p->propertyNames = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_sq_item_8jswebkit_JSObject(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static int __pyx_mp_ass_subscript_8jswebkit_JSObject(PyObject *o, PyObject *i, PyObject *v) { if (v) { return __pyx_pf_8jswebkit_8JSObject___setitem__(o, i, v); } else { PyErr_Format(PyExc_NotImplementedError, "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); return -1; } } static PyObject *__pyx_tp_getattro_8jswebkit_JSObject(PyObject *o, PyObject *n) { PyObject *v = PyObject_GenericGetAttr(o, n); if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); v = __pyx_pf_8jswebkit_8JSObject___getattr__(o, n); } return v; } static int __pyx_tp_setattro_8jswebkit_JSObject(PyObject *o, PyObject *n, PyObject *v) { if (v) { return __pyx_pf_8jswebkit_8JSObject___setattr__(o, n, v); } else { return PyObject_GenericSetAttr(o, n, 0); } } static struct PyMethodDef __pyx_methods_8jswebkit_JSObject[] = { {"getPropertyNames", (PyCFunction)__pyx_pf_8jswebkit_8JSObject_getPropertyNames, METH_NOARGS, 0}, {"__getattr__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___getattr__, METH_O|METH_COEXIST, 0}, {"__getitem__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___getitem__, METH_O|METH_COEXIST, 0}, {"__del__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___del__, METH_NOARGS, 0}, {"__iter__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___iter__, METH_NOARGS|METH_COEXIST, 0}, {"__next__", (PyCFunction)__pyx_pf_8jswebkit_8JSObject___next__, METH_NOARGS|METH_COEXIST, 0}, {"next", (PyCFunction)__pyx_pf_8jswebkit_8JSObject_next, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSObject = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSObject = { __pyx_pf_8jswebkit_8JSObject___len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_8jswebkit_JSObject, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSObject = { __pyx_pf_8jswebkit_8JSObject___len__, /*mp_length*/ __pyx_pf_8jswebkit_8JSObject___getitem__, /*mp_subscript*/ __pyx_mp_ass_subscript_8jswebkit_JSObject, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSObject = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSObject = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSObject", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSObject, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSObject, /*tp_as_number*/ &__pyx_tp_as_sequence_JSObject, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSObject, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ __pyx_tp_getattro_8jswebkit_JSObject, /*tp_getattro*/ __pyx_tp_setattro_8jswebkit_JSObject, /*tp_setattro*/ &__pyx_tp_as_buffer_JSObject, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSObject, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSObject, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pf_8jswebkit_8JSObject___iter__, /*tp_iter*/ __pyx_pf_8jswebkit_8JSObject___next__, /*tp_iternext*/ __pyx_methods_8jswebkit_JSObject, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_8JSObject___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSObject, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct __pyx_vtabstruct_8jswebkit_JSFunction __pyx_vtable_8jswebkit_JSFunction; static PyObject *__pyx_tp_new_8jswebkit_JSFunction(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSFunction *p; PyObject *o = __pyx_tp_new_8jswebkit_JSObject(t, a, k); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSFunction *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8jswebkit_JSObject*)__pyx_vtabptr_8jswebkit_JSFunction; return o; } static struct PyMethodDef __pyx_methods_8jswebkit_JSFunction[] = { {"__call__", (PyCFunction)__pyx_pf_8jswebkit_10JSFunction___call__, METH_VARARGS|METH_KEYWORDS|METH_COEXIST, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSFunction = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSFunction = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSFunction = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSFunction = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSFunction = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSFunction", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSObject, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSFunction, /*tp_as_number*/ &__pyx_tp_as_sequence_JSFunction, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSFunction, /*tp_as_mapping*/ 0, /*tp_hash*/ __pyx_pf_8jswebkit_10JSFunction___call__, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_JSFunction, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSObject, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSObject, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8jswebkit_JSFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_10JSFunction___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static PyObject *__pyx_tp_new_8jswebkit_JSContext(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8jswebkit_JSContext *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_8jswebkit_JSContext *)o); p->ctx = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_8jswebkit_JSContext(PyObject *o) { struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; Py_XDECREF(p->ctx); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8jswebkit_JSContext(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; if (p->ctx) { e = (*v)(p->ctx, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8jswebkit_JSContext(PyObject *o) { struct __pyx_obj_8jswebkit_JSContext *p = (struct __pyx_obj_8jswebkit_JSContext *)o; PyObject* tmp; tmp = ((PyObject*)p->ctx); p->ctx = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static struct PyMethodDef __pyx_methods_8jswebkit_JSContext[] = { {"EvaluateScript", (PyCFunction)__pyx_pf_8jswebkit_9JSContext_EvaluateScript, METH_VARARGS|METH_KEYWORDS, 0}, {"getCtx", (PyCFunction)__pyx_pf_8jswebkit_9JSContext_getCtx, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_JSContext = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_JSContext = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_JSContext = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_JSContext = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_8jswebkit_JSContext = { PyVarObject_HEAD_INIT(0, 0) "jswebkit.JSContext", /*tp_name*/ sizeof(struct __pyx_obj_8jswebkit_JSContext), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8jswebkit_JSContext, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ &__pyx_tp_as_number_JSContext, /*tp_as_number*/ &__pyx_tp_as_sequence_JSContext, /*tp_as_sequence*/ &__pyx_tp_as_mapping_JSContext, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_JSContext, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8jswebkit_JSContext, /*tp_traverse*/ __pyx_tp_clear_8jswebkit_JSContext, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8jswebkit_JSContext, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_8jswebkit_9JSContext___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8jswebkit_JSContext, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ }; static struct PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; static void __pyx_init_filenames(void); /*proto*/ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "jswebkit", __pyx_mdoc, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, {&__pyx_kp_getPropertyNames, __pyx_k_getPropertyNames, sizeof(__pyx_k_getPropertyNames), 1, 1, 1}, {&__pyx_kp___getattr__, __pyx_k___getattr__, sizeof(__pyx_k___getattr__), 1, 1, 1}, {&__pyx_kp___setattr__, __pyx_k___setattr__, sizeof(__pyx_k___setattr__), 1, 1, 1}, {&__pyx_kp___getitem__, __pyx_k___getitem__, sizeof(__pyx_k___getitem__), 1, 1, 1}, {&__pyx_kp___setitem__, __pyx_k___setitem__, sizeof(__pyx_k___setitem__), 1, 1, 1}, {&__pyx_kp___del__, __pyx_k___del__, sizeof(__pyx_k___del__), 1, 1, 1}, {&__pyx_kp___iter__, __pyx_k___iter__, sizeof(__pyx_k___iter__), 1, 1, 1}, {&__pyx_kp___next__, __pyx_k___next__, sizeof(__pyx_k___next__), 1, 1, 1}, {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, {&__pyx_kp___len__, __pyx_k___len__, sizeof(__pyx_k___len__), 1, 1, 1}, {&__pyx_kp___call__, __pyx_k___call__, sizeof(__pyx_k___call__), 1, 1, 1}, {&__pyx_kp_EvaluateScript, __pyx_k_EvaluateScript, sizeof(__pyx_k_EvaluateScript), 1, 1, 1}, {&__pyx_kp_getCtx, __pyx_k_getCtx, sizeof(__pyx_k_getCtx), 1, 1, 1}, {&__pyx_kp_self, __pyx_k_self, sizeof(__pyx_k_self), 1, 1, 1}, {&__pyx_kp_name, __pyx_k_name, sizeof(__pyx_k_name), 1, 1, 1}, {&__pyx_kp_message, __pyx_k_message, sizeof(__pyx_k_message), 1, 1, 1}, {&__pyx_kp_value, __pyx_k_value, sizeof(__pyx_k_value), 1, 1, 1}, {&__pyx_kp_key, __pyx_k_key, sizeof(__pyx_k_key), 1, 1, 1}, {&__pyx_kp_thisObj, __pyx_k_thisObj, sizeof(__pyx_k_thisObj), 1, 1, 1}, {&__pyx_kp_ctx, __pyx_k_ctx, sizeof(__pyx_k_ctx), 1, 1, 1}, {&__pyx_kp_script, __pyx_k_script, sizeof(__pyx_k_script), 1, 1, 1}, {&__pyx_kp_thisObject, __pyx_k_thisObject, sizeof(__pyx_k_thisObject), 1, 1, 1}, {&__pyx_kp_sourceURL, __pyx_k_sourceURL, sizeof(__pyx_k_sourceURL), 1, 1, 1}, {&__pyx_kp_startingLineNumber, __pyx_k_startingLineNumber, sizeof(__pyx_k_startingLineNumber), 1, 1, 1}, {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1}, {&__pyx_kp_types, __pyx_k_types, sizeof(__pyx_k_types), 1, 1, 1}, {&__pyx_kp_JSException, __pyx_k_JSException, sizeof(__pyx_k_JSException), 0, 1, 1}, {&__pyx_kp_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 1, 1, 1}, {&__pyx_kp___str__, __pyx_k___str__, sizeof(__pyx_k___str__), 1, 1, 1}, {&__pyx_kp_mess, __pyx_k_mess, sizeof(__pyx_k_mess), 1, 1, 1}, {&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1}, {&__pyx_kp_NoneType, __pyx_k_NoneType, sizeof(__pyx_k_NoneType), 1, 1, 1}, {&__pyx_kp_BooleanType, __pyx_k_BooleanType, sizeof(__pyx_k_BooleanType), 1, 1, 1}, {&__pyx_kp_IntType, __pyx_k_IntType, sizeof(__pyx_k_IntType), 1, 1, 1}, {&__pyx_kp_FloatType, __pyx_k_FloatType, sizeof(__pyx_k_FloatType), 1, 1, 1}, {&__pyx_kp_StringTypes, __pyx_k_StringTypes, sizeof(__pyx_k_StringTypes), 1, 1, 1}, {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, {&__pyx_kp_fromkeys, __pyx_k_fromkeys, sizeof(__pyx_k_fromkeys), 1, 1, 1}, {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, {&__pyx_kp_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 1, 1, 1}, {&__pyx_kp_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 1, 1, 1}, {&__pyx_kp_length, __pyx_k_length, sizeof(__pyx_k_length), 1, 1, 1}, {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0}, {&__pyx_kp_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 1, 1, 1}, {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_kp_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_kp_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_kp_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_kp_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initjswebkit(void); /*proto*/ PyMODINIT_FUNC initjswebkit(void) #else PyMODINIT_FUNC PyInit_jswebkit(void); /*proto*/ PyMODINIT_FUNC PyInit_jswebkit(void) #endif { PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Library function declarations ---*/ __pyx_init_filenames(); /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("jswebkit", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_8jswebkit_JSObject = &__pyx_vtable_8jswebkit_JSObject; *(void(**)(void))&__pyx_vtable_8jswebkit_JSObject.setup = (void(*)(void))__pyx_f_8jswebkit_8JSObject_setup; if (PyType_Ready(&__pyx_type_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_8jswebkit_JSObject.tp_dict, __pyx_vtabptr_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSObject", (PyObject *)&__pyx_type_8jswebkit_JSObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSObject = &__pyx_type_8jswebkit_JSObject; __pyx_vtabptr_8jswebkit_JSFunction = &__pyx_vtable_8jswebkit_JSFunction; __pyx_vtable_8jswebkit_JSFunction.__pyx_base = *__pyx_vtabptr_8jswebkit_JSObject; __pyx_type_8jswebkit_JSFunction.tp_base = __pyx_ptype_8jswebkit_JSObject; if (PyType_Ready(&__pyx_type_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_8jswebkit_JSFunction.tp_dict, __pyx_vtabptr_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSFunction", (PyObject *)&__pyx_type_8jswebkit_JSFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSFunction = &__pyx_type_8jswebkit_JSFunction; if (PyType_Ready(&__pyx_type_8jswebkit_JSContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttrString(__pyx_m, "JSContext", (PyObject *)&__pyx_type_8jswebkit_JSContext) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8jswebkit_JSContext = &__pyx_type_8jswebkit_JSContext; /*--- Type import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":24 * binascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n') * """ * import sys # <<<<<<<<<<<<<< * import types * cdef : */ __pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":25 * """ * import sys * import types # <<<<<<<<<<<<<< * cdef : * ctypedef unsigned short bool */ __pyx_1 = __Pyx_Import(__pyx_kp_types, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_kp_types, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /* "/home/huahua/ppa/webkit/pyjswebkit/python-jswebkit-0.0.1/jswebkit.pyx":78 * return None * * class JSException(Exception): # <<<<<<<<<<<<<< * def __init__(self,name,message): * self.name = name */ __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_2, 0, __pyx_builtin_Exception); __pyx_3 = __Pyx_CreateClass(((PyObject *)__pyx_2), ((PyObject *)__pyx_1), __pyx_kp_JSException, "jswebkit"); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; /* "/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 */ __pyx_2 = PyCFunction_New(&__pyx_mdef_8jswebkit_11JSException___init__, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (PyObject_SetAttr(__pyx_3, __pyx_kp___init__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; /* "/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) * */ __pyx_2 = PyCFunction_New(&__pyx_mdef_8jswebkit_11JSException___str__, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (PyObject_SetAttr(__pyx_3, __pyx_kp___str__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_4); __pyx_4 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_kp_JSException, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; /* "/var/lib/python-support/python2.6/Cython/Includes/python_object.pxd":1 * cdef extern from "Python.h": # <<<<<<<<<<<<<< * ctypedef void PyObject * ctypedef void PyTypeObject */ #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif __pyx_L1_error:; Py_XDECREF(__pyx_1); Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); __Pyx_AddTraceback("jswebkit"); #if PY_MAJOR_VERSION >= 3 return NULL; #endif } static const char *__pyx_filenames[] = { "jswebkit.pyx", }; /* Runtime support code */ static void __pyx_init_filenames(void) { __pyx_f = __pyx_filenames; } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } 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) { Py_ssize_t num_expected; const char *number, *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, #if PY_VERSION_HEX < 0x02050000 "%s() takes %s %d positional argument%s (%d given)", #else "%s() takes %s %zd positional argument%s (%zd given)", #endif func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { name = argnames; while (*name && (**name != key)) name++; if (*name) { if (name < first_kw_arg) goto arg_passed_twice; values[name-argnames] = value; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && strcmp(PyString_AS_STRING(**name), PyString_AS_STRING(key)) == 0) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && strcmp(PyString_AS_STRING(**name), PyString_AS_STRING(key)) == 0) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *__import__ = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; module = PyObject_CallFunction(__import__, "OOOO", name, global_dict, empty_dict, list); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); Py_XDECREF(empty_dict); return module; } static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static PyObject *__Pyx_CreateClass( PyObject *bases, PyObject *dict, PyObject *name, char *modname) { PyObject *py_modname; PyObject *result = 0; #if PY_MAJOR_VERSION < 3 py_modname = PyString_FromString(modname); #else py_modname = PyUnicode_FromString(modname); #endif if (!py_modname) goto bad; if (PyDict_SetItemString(dict, "__module__", py_modname) < 0) goto bad; #if PY_MAJOR_VERSION < 3 result = PyClass_New(bases, dict, name); #else result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL); #endif bad: Py_XDECREF(py_modname); return result; } static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (obj == Py_None || PyObject_TypeCheck(obj, type)) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); __Pyx_ErrFetch(type, value, tb); PyErr_NormalizeException(type, value, tb); if (PyErr_Occurred()) goto bad; Py_INCREF(*type); Py_INCREF(*value); Py_INCREF(*tb); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (XDECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); return 0; bad: Py_XDECREF(*type); Py_XDECREF(*value); Py_XDECREF(*tb); return -1; } static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { PyObject *item; if (!(item = PyIter_Next(iter))) { if (!PyErr_Occurred()) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d values to unpack", (int)index); #else "need more than %zd values to unpack", index); #endif } } return item; } static int __Pyx_EndUnpack(PyObject *iter) { PyObject *item; if ((item = PyIter_Next(iter))) { Py_DECREF(item); PyErr_SetString(PyExc_ValueError, "too many values to unpack"); return -1; } else if (!PyErr_Occurred()) return 0; else return -1; } static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { PyObject *pycobj = 0; int result; pycobj = PyCObject_FromVoidPtr(vtable, 0); if (!pycobj) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) goto bad; result = 0; goto done; bad: result = -1; done: Py_XDECREF(pycobj); return result; } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; #if PY_MAJOR_VERSION < 3 empty_string = PyString_FromStringAndSize("", 0); #else empty_string = PyBytes_FromStringAndSize("", 0); #endif if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ empty_string, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ empty_string /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode && (!t->is_identifier)) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_identifier || (t->is_unicode && t->intern)) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->is_unicode) { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if (x == Py_False) return 0; else return PyObject_IsTrue(x); } static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { return PyInt_AS_LONG(x); } else if (PyLong_CheckExact(x)) { return PyLong_AsLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { if (PyInt_CheckExact(x)) { long val = PyInt_AS_LONG(x); if (unlikely(val < 0)) { PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); return (unsigned PY_LONG_LONG)-1; } return val; } else if (PyLong_CheckExact(x)) { return PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { if (sizeof(unsigned char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned char val = (unsigned char)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); return (unsigned char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { if (sizeof(unsigned short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); unsigned short val = (unsigned short)long_val; if (unlikely((val != long_val) || (long_val < 0))) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); return (unsigned short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE char __pyx_PyInt_char(PyObject* x) { if (sizeof(char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); char val = (char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); return (char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE short __pyx_PyInt_short(PyObject* x) { if (sizeof(short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); short val = (short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); return (short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE int __pyx_PyInt_int(PyObject* x) { if (sizeof(int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); int val = (int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long __pyx_PyInt_long(PyObject* x) { if (sizeof(long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long val = (long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { if (sizeof(signed char) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed char val = (signed char)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); return (signed char)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { if (sizeof(signed short) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed short val = (signed short)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); return (signed short)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { if (sizeof(signed int) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed int val = (signed int)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); return (signed int)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { if (sizeof(signed long) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); signed long val = (signed long)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); return (signed long)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } static INLINE long double __pyx_PyInt_long_double(PyObject* x) { if (sizeof(long double) < sizeof(long)) { long long_val = __pyx_PyInt_AsLong(x); long double val = (long double)long_val; if (unlikely((val != long_val) )) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); return (long double)-1; } return val; } else { return __pyx_PyInt_AsLong(x); } } python-jswebkit-0.0.3/jswebkit.pyx0000644000175000017500000002140411452073143015720 0ustar aronaron""" Copyright (C) 2009 john paul janecek, Free Beer (MIT) Licensing Copyright (C) 2010 Jiahua Huang , MIT Licensing for this file Comment by john paul janecek: ------------------ version 0.0003 Applied the patches supplied by MonkeeSage Thanx :) This fixes the ucs2/ucs4 bug which I had earlier Also MonkeeSage fixed other things, he make call function nicer and fixed lists so the work properly Also fixed his patch so it works with both ucs2/ucs4 python Fixed the setup.py so that it can use pkg-config instead version 0.0002 I need a versioning system lol cython wrapper for JSContextRef in pywebkitgtk you need cython to make it So you can call Javascript functions etc from python Made by john paul janecek Free Beer copyright, do what the heck you want with it, just give me credit Also do not blame me if your things blow up if you need to contact me, i might answer back :) I am lazy when it comes to making fixes unless I actually am using library myself :) my email import binascii binascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n') ------------------ """ import sys import types cdef : ctypedef unsigned short bool include "stdlib.pyi" include "python.pyi" include "jsbase.pyi" include "jsstringref.pyi" include "jsvalueref.pyi" include "jsobjectref.pyi" cdef object jsValueToPython(JSContextRef ctx,JSValueRef jsValue): cdef JSStringRef jsStr cdef int jsType = JSValueGetType(ctx,jsValue) cdef JSObject jsObject cdef JSFunction jsFunction cdef object result cdef int isFunction cdef bool bResult cdef size_t strlen if jsType == kJSTypeUndefined or jsType == kJSTypeNull : JSValueUnprotect(ctx,jsValue) return None elif jsType == kJSTypeBoolean : bResult = JSValueToBoolean(ctx,jsValue) JSValueUnprotect(ctx,jsValue) if bResult > 0 : return True else : return False elif jsType == kJSTypeNumber: result = JSValueToNumber(ctx,jsValue,NULL) JSValueUnprotect(ctx,jsValue) return result elif jsType == kJSTypeString : jsStr = JSValueToStringCopy(ctx,jsValue,NULL) strlen = JSStringGetLength(jsStr) strlen *= 2 result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsStr), strlen, NULL, 0) JSStringRelease(jsStr) JSValueUnprotect(ctx,jsValue) return result else : if JSObjectIsFunction(ctx,jsValue) > 0 : jsFunction = JSFunction() jsFunction.setup(ctx,jsValue) return jsFunction else : jsObject = JSObject() jsObject.setup(ctx,jsValue) return jsObject return None class JSException(Exception): def __init__(self,name,message): self.name = name self.mess = message def __str__(self): 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) cdef object JSStringRefToPython(JSStringRef jsString) : cdef size_t strlen = JSStringGetLength(jsString) strlen *= 2 result = PyUnicode_DecodeUTF16(JSStringGetCharactersPtr(jsString), strlen, NULL, 0) return result cdef JSStringRef PythonToJSString(object pyStr) : """result has to be released""" pyStr = unicode(pyStr).encode("utf-8") cdef JSStringRef jsStr = JSStringCreateWithUTF8CString(PyString_AsString(pyStr)) return jsStr cdef JSValueRef PythonTojsValue(JSContextRef ctx,object pyValue): if isinstance(pyValue,types.NoneType): return JSValueMakeNull(ctx) elif isinstance(pyValue,types.BooleanType): return JSValueMakeBoolean(ctx,pyValue) elif isinstance(pyValue,(types.IntType,types.FloatType)) : return JSValueMakeNumber(ctx,pyValue) elif isinstance(pyValue,types.StringTypes) : return JSValueMakeString(ctx,PythonToJSString(pyValue)) elif isinstance(pyValue,JSObject): return (pyValue).jsObject else : raise ValueError cdef class JSObject: cdef JSContextRef ctx cdef JSObjectRef jsObject cdef object propertyNames cdef int index def __init__(self) : self.ctx = NULL self.jsObject = NULL self.index = 0 cdef setup(self,JSContextRef ctx,JSObjectRef jsObject): self.ctx = ctx self.jsObject = jsObject self.propertyNames = dict.fromkeys(self.getPropertyNames(),True) def getPropertyNames(self): cdef JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(self.ctx,self.jsObject) names = [] for i in range(JSPropertyNameArrayGetCount(nameArray)): names.append(JSStringRefToPython(JSPropertyNameArrayGetNameAtIndex(nameArray,i))) JSPropertyNameArrayRelease(nameArray) return names def __getattr__(self,name): cdef JSStringRef jsStr cdef JSValueRef jsException try : self.propertyNames[name] jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string result = jsValueToPython(self.ctx,JSObjectGetProperty(self.ctx,self.jsObject,jsStr,NULL)) JSStringRelease(jsStr) return result except KeyError : raise AttributeError,name def __setattr__(self,name,value): cdef JSStringRef jsStr self.propertyNames[name] = True jsStr = JSStringCreateWithUTF8CString(name) #has to be a UTF8 string JSObjectSetProperty(self.ctx,self.jsObject,jsStr,PythonTojsValue(self.ctx,value),kJSPropertyAttributeNone,NULL) JSStringRelease(jsStr) def __getitem__(self,key) : cdef JSValueRef jsValueRef cdef JSValueRef jsException = NULL jsValueRef = JSObjectGetPropertyAtIndex(self.ctx,self.jsObject,key,&jsException) if jsException != NULL : raise makeException(self.ctx,jsException) return jsValueToPython(self.ctx,jsValueRef) def __setitem__(self,key,value): cdef JSValueRef jsValue = PythonTojsValue(self.ctx,value) cdef JSValueRef jsException = NULL JSObjectSetPropertyAtIndex(self.ctx, self.jsObject, key, jsValue, &jsException) if jsException != NULL : raise makeException(self.ctx,jsException) def __del__(self): JSValueUnprotect(self.ctx,self.jsObject) # these are container methods, so that lists behave correctly def __iter__(self): return self def __next__(self): # 2.6 and 3.0 now use __next__ if self.index < self.length: value = self[self.index] self.index += 1 return value else: self.index = 0 raise StopIteration def next(self): # wrapper for backwards compatibility return self.__next__() def __len__(self): length = len(self.getPropertyNames()) if hasattr(self, "length"): length += int(self.length) return length cdef class JSFunction(JSObject): def __init__(self) : JSObject.__init__(self) def __call__(self,thisObj,*args): cdef JSValueRef *jsArgs cdef JSValueRef result cdef JSObjectRef jsThisObject cdef JSValueRef jsError = NULL if len(args) : jsArgs = malloc(len(args) * sizeof(JSValueRef)) else : jsArgs = NULL for i,arg in enumerate(args) : jsArgs[i] = PythonTojsValue(self.ctx,arg) if thisObj : jsThisObject = (thisObj).jsObject else : jsThisObject = NULL result = JSObjectCallAsFunction(self.ctx,self.jsObject,jsThisObject,len(args),jsArgs,&jsError) free(jsArgs) if jsError!=NULL : raise makeException(self.ctx,jsError) return jsValueToPython(self.ctx,result) cdef class JSContext: cdef JSContextRef jsCtx cdef object ctx def __init__(self,ctx): self.ctx = ctx self.jsCtx = PyCObject_AsVoidPtr(ctx) def EvaluateScript(self,script,thisObject = None ,sourceURL = None,startingLineNumber = 1): script = unicode(script).encode("utf-8") cdef JSStringRef jsScript = JSStringCreateWithUTF8CString(PyString_AsString(script)) cdef JSValueRef jsException = NULL cdef JSValueRef jsValue = JSEvaluateScript(self.jsCtx,jsScript,NULL,NULL,startingLineNumber,&jsException) JSValueProtect(self.jsCtx,jsValue) JSStringRelease(jsScript) if jsException!=NULL : raise makeException(self.jsCtx,jsException) return jsValueToPython(self.jsCtx,jsValue) def getCtx(self): return self.ctx python-jswebkit-0.0.3/jsobjectref.pyi0000644000175000017500000000360011452073143016355 0ustar aronaroncdef extern from "JavaScriptCore/JSObjectRef.h": enum : kJSPropertyAttributeNone,kJSPropertyAttributeReadOnly, kJSPropertyAttributeDontEnum,kJSPropertyAttributeDontDelete ctypedef unsigned JSPropertyAttributes bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) void JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) void* JSObjectGetPrivate(JSObjectRef object) bool JSObjectSetPrivate(JSObjectRef object, void* data) bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object) JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,JSValueRef arguments[], JSValueRef* exception) JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object) JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object) JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array) JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index) void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName)python-jswebkit-0.0.3/setup.py0000644000175000017500000000374311454037431015056 0ustar aronaron""" setup file for cython wrapper for JSContextRef in pywebkitgtk Copyright (C) 2009 john paul janecek, Free Beer (MIT) Licensing Copyright (C) 2010 Aron Xu , MIT Licensing for this file Comment by john paul janecek: ------------------ setup file for cython wrapper for JSContextRef in pywebkitgtk you need cython to make it So you can call Javascript functions etc from python Made by john paul janecek Free Beer copyright, do what the heck you want with it, just give me credit Also do not blame me if your things blow up if you need to contact me, i might answer back :) I am lazy when it comes to making fixes unless I actually am using library myself :) my email import binascii binascii.a2b_base64('anBqYW5lY2VrQGdtYWlsLmNvbQ==\n') ------------------ """ from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import subprocess pkgconfig = subprocess.Popen("pkg-config --cflags webkit-1.0", stdout=subprocess.PIPE, shell=True) pkgconfig.wait() extra_compile_args = pkgconfig.stdout.read().split() pkgconfig = subprocess.Popen("pkg-config --libs webkit-1.0", stdout=subprocess.PIPE, shell=True) pkgconfig.wait() extra_link_args = pkgconfig.stdout.read().split() setup( name='python-jswebkit', version='0.0.3', description='WebKit/JavaScriptCore Python bindings', long_description ="""It's a cython wrapper for JSContextRef in pywebkitgtk that way it can call JS functions etc""", author='Jiahua Huang', author_email='jhuangjiahua@gmail.com', license='LGPL-3', url="http://code.google.com/p/gwrite", download_url="http://code.google.com/p/gwrite", cmdclass = {'build_ext': build_ext}, ext_modules = [Extension("jswebkit", ["jswebkit.pyx"], extra_compile_args = extra_compile_args, extra_link_args = extra_link_args )] )