00001 // ugh. all this just for proper bool(hocobject) 00002 // there has to be a better way to get working __nonzero__ 00003 // but putting it into hocobj_methods did not work. 00004 static PyNumberMethods hocobj_as_number = { 00005 0, /* nb_add */ 00006 0, /* nb_subtract */ 00007 0, /* nb_multiply */ 00008 0, /* nb_divide */ 00009 0, /* nb_remainder */ 00010 0, /* nb_divmod */ 00011 0, /* nb_power */ 00012 0, /* nb_negative */ 00013 0, /* nb_positive */ 00014 0, /* nb_absolute */ 00015 (inquiry)hocobj_nonzero, /* nb_nonzero */ 00016 0, /* nb_invert */ 00017 0, /* nb_lshift */ 00018 0, /* nb_rshift */ 00019 0, /* nb_and */ 00020 0, /* nb_xor */ 00021 0, /* nb_or */ 00022 0, /* nb_coerce */ 00023 0, /* nb_int */ 00024 0, /* nb_long */ 00025 0, /* nb_float */ 00026 0, /* nb_oct */ 00027 0, /* nb_hex */ 00028 0, /* nb_inplace_add */ 00029 0, /* nb_inplace_subtract */ 00030 0, /* nb_inplace_multiply */ 00031 0, /* nb_inplace_divide */ 00032 0, /* nb_inplace_remainder */ 00033 0, /* nb_inplace_power */ 00034 0, /* nb_inplace_lshift */ 00035 0, /* nb_inplace_rshift */ 00036 0, /* nb_inplace_and */ 00037 0, /* nb_inplace_xor */ 00038 0, /* nb_inplace_or */ 00039 0, /* nb_floor_divide */ 00040 0, /* nb_true_divide */ 00041 0, /* nb_inplace_floor_divide */ 00042 0, /* nb_inplace_true_divide */ 00043 #if PYTHON_API_VERSION > 1012 00044 0, /* nb_index */ 00045 #endif 00046 }; 00047 00048 static PyTypeObject nrnpy_HocObjectType = { 00049 PyObject_HEAD_INIT(NULL) 00050 0, /*ob_size*/ 00051 "hoc.HocObject", /*tp_name*/ 00052 sizeof(PyHocObject), /*tp_basicsize*/ 00053 0, /*tp_itemsize*/ 00054 (destructor)hocobj_dealloc, /*tp_dealloc*/ 00055 0, /*tp_print*/ 00056 0, /*tp_getattr*/ 00057 0, /*tp_setattr*/ 00058 0, /*tp_compare*/ 00059 0, /*tp_repr*/ 00060 &hocobj_as_number, /*tp_as_number*/ 00061 &hocobj_seqmeth, /*tp_as_sequence*/ 00062 0, /*tp_as_mapping*/ 00063 0, /*tp_hash */ 00064 (ternaryfunc)hocobj_call, /*tp_call*/ 00065 0, /*tp_str*/ 00066 hocobj_getattro, /*tp_getattro*/ 00067 hocobj_setattro, /*tp_setattro*/ 00068 0, /*tp_as_buffer*/ 00069 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ 00070 hocobj_docstring, /* tp_doc */ 00071 0, /* tp_traverse */ 00072 0, /* tp_clear */ 00073 0, /* tp_richcompare */ 00074 0, /* tp_weaklistoffset */ 00075 &hocobj_iter, /* tp_iter */ 00076 &hocobj_iternext, /* tp_iternext */ 00077 hocobj_methods, /* tp_methods */ 00078 0,//hocobj_members, /* tp_members */ 00079 0, /* tp_getset */ 00080 0, /* tp_base */ 00081 0, /* tp_dict */ 00082 0, /* tp_descr_get */ 00083 0, /* tp_descr_set */ 00084 0, /* tp_dictoffset */ 00085 (initproc)hocobj_init, /* tp_init */ 00086 0, /* tp_alloc */ 00087 hocobj_new, /* tp_new */ 00088 };