1852: #line 2155 "mxTools.pak" 1853: static 1854: PyNumberMethods mxNotGiven_TypeAsNumber = { 1855: 1856: /* These slots are not NULL-checked, so we must provide dummy functions */ 1857: notimplemented2, /*nb_add*/ 1858: notimplemented2, /*nb_subtract*/ 1859: notimplemented2, /*nb_multiply*/ 1860: notimplemented2, /*nb_divide*/ 1861: notimplemented2, /*nb_remainder*/ 1862: notimplemented2, /*nb_divmod*/ 1863: notimplemented3, /*nb_power*/ 1864: notimplemented1, /*nb_negative*/ 1865: notimplemented1, /*nb_positive*/ 1866: 1867: /* Everything below this line EXCEPT nb_nonzero (!) is NULL checked */ 1868: (unaryfunc)0, /*nb_absolute*/ 1869: mxNotGiven_NonZero, /*nb_nonzero*/ 1870: (unaryfunc)0, /*nb_invert*/ 1871: (binaryfunc)0, /*nb_lshift*/ 1872: (binaryfunc)0, /*nb_rshift*/ 1873: (binaryfunc)0, /*nb_and*/ 1874: (binaryfunc)0, /*nb_xor*/ 1875: (binaryfunc)0, /*nb_or*/ 1876: (coercion)0, /*nb_coerce*/ 1877: (unaryfunc)0, /*nb_int*/ 1878: (unaryfunc)0, /*nb_long*/ 1879: (unaryfunc)0, /*nb_float*/ 1880: (unaryfunc)0, /*nb_oct*/ 1881: (unaryfunc)0, /*nb_hex*/ 1882: }; 1883: 1884: static PyTypeObject mxNotGiven_Type = { 1885: PyObject_HEAD_INIT(0) /* init at startup ! */ 1886: 0, /*ob_size*/ 1887: "NotGiven", /*tp_name*/ 1888: sizeof(mxNotGivenObject), /*tp_basicsize*/ 1889: 0, /*tp_itemsize*/ 1890: 0, /*tp_dealloc; object always stays alive */ 1891: 0, /*tp_print*/ 1892: 0, /*tp_getattr*/ 1893: 0, /*tp_setattr*/ 1894: 0, /*tp_compare*/ 1895: mxNotGiven_Repr, /*tp_repr*/ 1896: &mxNotGiven_TypeAsNumber, /*tp_as_number*/ 1897: 0, /*tp_as_sequence*/ 1898: 0, /*tp_as_mapping*/ 1899: 0, /*tp_hash */ 1900: }; 1901: 1902: /* --- module init --------------------------------------------------------- */ 1903: 1904: /* Python Method Table */ 1905: 1906: static 1907: PyMethodDef Module_methods[] = 1908: { 1909: Py_MethodListEntry("trange",mxTools_trange), 1910: Py_MethodListEntrySingleArg("trange_len",mxTools_indices), 1911: Py_MethodListEntrySingleArg("indices",mxTools_indices), 1912: Py_MethodListEntrySingleArg("range_len",mxTools_range_len), 1913: Py_MethodListEntry("irange",mxTools_irange), 1914: Py_MethodListEntry("ifilter",mxTools_ifilter), 1915: Py_MethodListEntry("get",mxTools_get), 1916: Py_MethodListEntry("extract",mxTools_extract), 1917: Py_MethodListEntry("mget",mxTools_extract), 1918: Py_MethodListEntry("mgetattr",mxTools_findattr), 1919: Py_MethodListEntry("findattr",mxTools_findattr), 1920: Py_MethodListEntry("attrlist",mxTools_attrlist), 1921: Py_MethodListEntry("mapply",mxTools_mapply), 1922: Py_MethodListEntry("method_mapply",mxTools_method_mapply), 1923: Py_MethodListEntry("count",mxTools_count), 1924: Py_MethodListEntry("exists",mxTools_exists), 1925: Py_MethodListEntry("forall",mxTools_forall), 1926: Py_MethodListEntry("index",mxTools_index), 1927: Py_MethodListEntry("napply",mxTools_napply), 1928: Py_MethodListEntrySingleArg("sizeof",mxTools_sizeof), 1929: Py_MethodListEntrySingleArg("dict",mxTools_dict), 1930: Py_MethodListEntrySingleArg("invdict",mxTools_invdict), 1931: Py_MethodListEntry("setdict",mxTools_setdict), 1932: Py_MethodListEntrySingleArg("reverse",mxTools_reverse), 1933: Py_MethodListEntrySingleArg("tuples",mxTools_tuples), 1934: Py_MethodListEntrySingleArg("lists",mxTools_lists), 1935: Py_MethodListEntry("acquire",mxTools_acquire), 1936: Py_MethodListEntry("verbosity",mxTools_verbosity), 1937: Py_MethodListEntry("optimization",mxTools_optimization), 1938: #ifdef INCLUDE_FUNSTUFF 1939: Py_MethodListEntrySingleArg("malloc",mxTools_malloc), 1940: Py_MethodListEntry("caching_eval",mxTools_caching_eval), 1941: #endif 1942: {NULL,NULL} /* end of list */ 1943: }; 1944: 1945: /* create PyMethodObjects and register them in the module's dict */ 1946: MX_EXPORT(void) 1947: init_mxTools(void) 1948: { 1949: PyObject *module, *moddict; 1950: 1951: /* Init type objects */ 1952: PyType_Init(mxNotGiven_Type); 1953: 1954: /* create module */ 1955: module = Py_InitModule4(MXTOOLS_MODULE, /* Module name */ 1956: Module_methods, /* Method list */ 1957: Module_docstring, /* Module doc-string */ 1958: (PyObject *)NULL, /* always pass this as *self */ 1959: PYTHON_API_VERSION); /* API Version */ 1960: if (!module) 1961: goto onError; 1962: 1963: /* Create NotGiven singleton */ 1964: mxNotGiven = PyObject_NEW(mxNotGivenObject,&mxNotGiven_Type); 1965: if (!mxNotGiven) 1966: goto onError; 1967: 1968: /* Add some constants to the module's dict */ 1969: moddict = PyModule_GetDict(module); 1970: insstr(moddict,"__version__",VERSION); 1971: PyDict_SetItemString(moddict, 1972: "NotGiven", 1973: mxNotGiven); 1974: 1975: /* Errors */ 1976: if (!(mxTools_Error = insexc(moddict,"Error"))) 1977: goto onError; 1978: 1979: onError: 1980: /* Check for errors and report them */ 1981: if (PyErr_Occurred()) 1982: Py_ReportModuleInitError(MXTOOLS_MODULE); 1983: return; 1984: } 1985: