Mercurial > pymonkey
annotate context.c @ 12:6d95cfaa1e0b
Fixed a code typo.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 28 Jun 2009 17:43:42 -0700 |
parents | 551ba05fe6ad |
children | ca17531e8c81 |
rev | line source |
---|---|
11
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
1 #include "context.h" |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
2 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
3 static void |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
4 PYM_JSContextDealloc(PYM_JSContextObject *self) |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
5 { |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
6 if (self->cx) { |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
7 JS_DestroyContext(self->cx); |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
8 self->cx = NULL; |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
9 } |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
10 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
11 Py_DECREF(self->runtime); |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
12 self->runtime = NULL; |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
13 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
14 self->ob_type->tp_free((PyObject *) self); |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
15 } |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
16 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
17 static PyObject * |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
18 PYM_getRuntime(PYM_JSContextObject *self, PyObject *args) |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
19 { |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
20 Py_INCREF(self->runtime); |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
21 return (PyObject *) self->runtime; |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
22 } |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
23 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
24 static PyMethodDef PYM_JSContextMethods[] = { |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
25 {"get_runtime", (PyCFunction) PYM_getRuntime, METH_VARARGS, |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
26 "Get the JavaScript runtime associated with this context."}, |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
27 {NULL, NULL, 0, NULL} |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
28 }; |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
29 |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
30 PyTypeObject PYM_JSContextType = { |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
31 PyObject_HEAD_INIT(NULL) |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
32 0, /*ob_size*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
33 "pymonkey.Context", /*tp_name*/ |
12 | 34 sizeof(PYM_JSContextObject), /*tp_basicsize*/ |
11
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
35 0, /*tp_itemsize*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
36 /*tp_dealloc*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
37 (destructor) PYM_JSContextDealloc, |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
38 0, /*tp_print*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
39 0, /*tp_getattr*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
40 0, /*tp_setattr*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
41 0, /*tp_compare*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
42 0, /*tp_repr*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
43 0, /*tp_as_number*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
44 0, /*tp_as_sequence*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
45 0, /*tp_as_mapping*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
46 0, /*tp_hash */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
47 0, /*tp_call*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
48 0, /*tp_str*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
49 0, /*tp_getattro*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
50 0, /*tp_setattro*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
51 0, /*tp_as_buffer*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
52 Py_TPFLAGS_DEFAULT, /*tp_flags*/ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
53 /* tp_doc */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
54 "JavaScript Context.", |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
55 0, /* tp_traverse */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
56 0, /* tp_clear */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
57 0, /* tp_richcompare */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
58 0, /* tp_weaklistoffset */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
59 0, /* tp_iter */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
60 0, /* tp_iternext */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
61 PYM_JSContextMethods, /* tp_methods */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
62 0, /* tp_members */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
63 0, /* tp_getset */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
64 0, /* tp_base */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
65 0, /* tp_dict */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
66 0, /* tp_descr_get */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
67 0, /* tp_descr_set */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
68 0, /* tp_dictoffset */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
69 0, /* tp_init */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
70 0, /* tp_alloc */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
71 0, /* tp_new */ |
551ba05fe6ad
factored out Runtime, Context, and utils into separate files.
Atul Varma <varmaa@toolness.com>
parents:
diff
changeset
|
72 }; |