annotate undefined.c @ 14:9edcdb4ab12d

added an init_standard_classes() method to context objects.
author Atul Varma <varmaa@toolness.com>
date Sun, 28 Jun 2009 18:28:35 -0700
parents 29eaa1fceff1
children bc4263c6ae82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
1 #include "undefined.h"
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
2
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
3 // TODO: We should make this behave as much like JavaScript's
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
4 // "undefined" value as possible; e.g., its string value should
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
5 // be "undefined", the singleton should be falsy, etc.
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
6 PyTypeObject PYM_undefinedType = {
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
7 PyObject_HEAD_INIT(NULL)
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
8 0, /*ob_size*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
9 "pymonkey.undefined", /*tp_name*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
10 sizeof(PYM_undefinedObject), /*tp_basicsize*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
11 0, /*tp_itemsize*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
12 0, /*tp_dealloc*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
13 0, /*tp_print*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
14 0, /*tp_getattr*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
15 0, /*tp_setattr*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
16 0, /*tp_compare*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
17 0, /*tp_repr*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
18 0, /*tp_as_number*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
19 0, /*tp_as_sequence*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
20 0, /*tp_as_mapping*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
21 0, /*tp_hash */
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
22 0, /*tp_call*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
23 0, /*tp_str*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
24 0, /*tp_getattro*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
25 0, /*tp_setattro*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
26 0, /*tp_as_buffer*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
27 Py_TPFLAGS_DEFAULT, /*tp_flags*/
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
28 /* tp_doc */
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
29 "Pythonic equivalent of JavaScript's 'undefined' value",
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
30 };
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
31
29eaa1fceff1 Moved definition of undefined type into a separate module.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
32 PyObject *PYM_undefined = (PyObject *) &PYM_undefinedType;