00001 static PyNumberMethods hocobj_as_number = { 00002 0, //binaryfunc nb_add; 00003 0, //binaryfunc nb_subtract; 00004 0, //binaryfunc nb_multiply; 00005 0, //binaryfunc nb_remainder; 00006 0, //binaryfunc nb_divmod; 00007 0, //ternaryfunc nb_power; 00008 0, //unaryfunc nb_negative; 00009 0, //unaryfunc nb_positive; 00010 0, //unaryfunc nb_absolute; 00011 (inquiry)hocobj_nonzero, //inquiry nb_bool; 00012 0, //unaryfunc nb_invert; 00013 0, //binaryfunc nb_lshift; 00014 0, //binaryfunc nb_rshift; 00015 0, //binaryfunc nb_and; 00016 0, //binaryfunc nb_xor; 00017 0, //binaryfunc nb_or; 00018 0, //unaryfunc nb_int; 00019 0, //void *nb_reserved; /* the slot formerly known as nb_long */ 00020 0, //unaryfunc nb_float; 00021 00022 0, //binaryfunc nb_inplace_add; 00023 0, //binaryfunc nb_inplace_subtract; 00024 0, //binaryfunc nb_inplace_multiply; 00025 0, //binaryfunc nb_inplace_remainder; 00026 0, //ternaryfunc nb_inplace_power; 00027 0, //binaryfunc nb_inplace_lshift; 00028 0, //binaryfunc nb_inplace_rshift; 00029 0, //binaryfunc nb_inplace_and; 00030 0, //binaryfunc nb_inplace_xor; 00031 0, //binaryfunc nb_inplace_or; 00032 00033 0, //binaryfunc nb_floor_divide; 00034 0, //binaryfunc nb_true_divide; 00035 0, //binaryfunc nb_inplace_floor_divide; 00036 0, //binaryfunc nb_inplace_true_divide; 00037 00038 0, //unaryfunc nb_index; 00039 }; 00040 00041 static PyTypeObject nrnpy_HocObjectType = { 00042 /* The ob_type field must be initialized in the module init function 00043 * to be portable to Windows without using C++. */ 00044 PyVarObject_HEAD_INIT(NULL, 0) 00045 "hoc.HocObject", /*tp_name*/ 00046 sizeof(PyHocObject), /*tp_basicsize*/ 00047 0, /*tp_itemsize*/ 00048 /* methods */ 00049 (destructor)hocobj_dealloc, /*tp_dealloc*/ 00050 0, /*tp_print*/ 00051 (getattrfunc)0, /*tp_getattr*/ 00052 (setattrfunc)0, /*tp_setattr*/ 00053 0, /*tp_reserved*/ 00054 0, /*tp_repr*/ 00055 &hocobj_as_number, /*tp_as_number*/ 00056 &hocobj_seqmeth, /*tp_as_sequence*/ 00057 0, /*tp_as_mapping*/ 00058 0, /*tp_hash*/ 00059 (ternaryfunc)hocobj_call, /*tp_call*/ 00060 0, /*tp_str*/ 00061 hocobj_getattro, /*tp_getattro*/ 00062 hocobj_setattro, /*tp_setattro*/ 00063 0, /*tp_as_buffer*/ 00064 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ 00065 hocobj_docstring, /*tp_doc*/ 00066 0, /*tp_traverse*/ 00067 0, /*tp_clear*/ 00068 0, /*tp_richcompare*/ 00069 0, /*tp_weaklistoffset*/ 00070 &hocobj_iter, /*tp_iter*/ 00071 &hocobj_iternext, /*tp_iternext*/ 00072 hocobj_methods, /*tp_methods*/ 00073 0, /*tp_members*/ 00074 0, /*tp_getset*/ 00075 0, /*tp_base*/ 00076 0, /*tp_dict*/ 00077 0, /*tp_descr_get*/ 00078 0, /*tp_descr_set*/ 00079 0, /*tp_dictoffset*/ 00080 (initproc)hocobj_init, /*tp_init*/ 00081 0, /*tp_alloc*/ 00082 hocobj_new, /*tp_new*/ 00083 0, /*tp_free*/ 00084 0, /*tp_is_gc*/ 00085 }; 00086 00087 static struct PyModuleDef hocmodule = { 00088 PyModuleDef_HEAD_INIT, 00089 "hoc", 00090 "HOC interaction with Python", 00091 -1, 00092 HocMethods, 00093 NULL, 00094 NULL, 00095 NULL, 00096 NULL 00097 };