Mercurial > pymonkey
changeset 21:fc04e5f1c675
Changed object constructor to take a context instead of a runtime.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 28 Jun 2009 20:40:18 -0700 |
parents | abede8af8cf5 |
children | 988a8998c75f |
files | context.c object.c object.h utils.c utils.h |
diffstat | 5 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/context.c Sun Jun 28 20:19:39 2009 -0700 +++ b/context.c Sun Jun 28 20:40:18 2009 -0700 @@ -34,7 +34,7 @@ // If this fails, we don't need to worry about cleaning up // obj because it'll get cleaned up at the next GC. - return (PyObject *) PYM_newJSObject(self->runtime, obj); + return (PyObject *) PYM_newJSObject(self, obj); } static PyObject * @@ -75,7 +75,7 @@ } PyMem_Free(string); - return PYM_jsvalToPyObject(self->runtime, val); + return PYM_jsvalToPyObject(self, val); } static PyObject * @@ -118,7 +118,7 @@ return NULL; } - PyObject *pyRval = PYM_jsvalToPyObject(self->runtime, rval); + PyObject *pyRval = PYM_jsvalToPyObject(self, rval); JS_EndRequest(self->cx);
--- a/object.c Sun Jun 28 20:19:39 2009 -0700 +++ b/object.c Sun Jun 28 20:40:18 2009 -0700 @@ -1,4 +1,5 @@ #include "object.h" +#include "runtime.h" JSClass PYM_JS_ObjectClass = { "PymonkeyObject", JSCLASS_GLOBAL_FLAGS, @@ -66,14 +67,14 @@ 0, /* tp_new */ }; -PYM_JSObject *PYM_newJSObject(PYM_JSRuntimeObject *runtime, +PYM_JSObject *PYM_newJSObject(PYM_JSContextObject *context, JSObject *obj) { PYM_JSObject *object = PyObject_New(PYM_JSObject, &PYM_JSObjectType); if (object == NULL) return NULL; - object->runtime = runtime; + object->runtime = context->runtime; Py_INCREF(object->runtime); object->obj = obj;
--- a/object.h Sun Jun 28 20:19:39 2009 -0700 +++ b/object.h Sun Jun 28 20:40:18 2009 -0700 @@ -1,7 +1,7 @@ #ifndef PYM_OBJECT_H #define PYM_OBJECT_H -#include "runtime.h" +#include "context.h" #include <jsapi.h> #include <Python/Python.h> @@ -17,6 +17,6 @@ extern PyTypeObject PYM_JSObjectType; extern PYM_JSObject * -PYM_newJSObject(PYM_JSRuntimeObject *runtime, JSObject *obj); +PYM_newJSObject(PYM_JSContextObject *context, JSObject *obj); #endif
--- a/utils.c Sun Jun 28 20:19:39 2009 -0700 +++ b/utils.c Sun Jun 28 20:40:18 2009 -0700 @@ -5,7 +5,7 @@ PyObject *PYM_error; PyObject * -PYM_jsvalToPyObject(PYM_JSRuntimeObject *runtime, +PYM_jsvalToPyObject(PYM_JSContextObject *context, jsval value) { if (JSVAL_IS_INT(value)) return PyInt_FromLong(JSVAL_TO_INT(value)); @@ -41,7 +41,7 @@ } if (JSVAL_IS_OBJECT(value)) - return (PyObject *) PYM_newJSObject(runtime, JSVAL_TO_OBJECT(value)); + return (PyObject *) PYM_newJSObject(context, JSVAL_TO_OBJECT(value)); // TODO: Support more types. PyErr_SetString(PyExc_NotImplementedError,
--- a/utils.h Sun Jun 28 20:19:39 2009 -0700 +++ b/utils.h Sun Jun 28 20:40:18 2009 -0700 @@ -1,7 +1,7 @@ #ifndef PYM_UTILS_H #define PYM_UTILS_H -#include "runtime.h" +#include "context.h" #include <jsapi.h> #include <Python/Python.h> @@ -9,6 +9,6 @@ extern PyObject *PYM_error; extern PyObject * -PYM_jsvalToPyObject(PYM_JSRuntimeObject *runtime, jsval value); +PYM_jsvalToPyObject(PYM_JSContextObject *context, jsval value); #endif