From 241912063ce7dce0e24be7ff700ab67a18829605 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Wed, 4 Jan 2012 09:12:23 +0100 Subject: [PATCH] _os -> _mw --- Makefile | 2 +- _os_helper.cpp => _mw_helper.cpp | 88 ++++++++++++++++---------------- _os_helper.pyx => _mw_helper.pyx | 0 setup.py | 2 +- 4 files changed, 46 insertions(+), 46 deletions(-) rename _os_helper.cpp => _mw_helper.cpp (95%) rename _os_helper.pyx => _mw_helper.pyx (100%) diff --git a/Makefile b/Makefile index a58eb3d..1bcf991 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ %.cpp: %.pyx cython --cplus $< -o $@ -all: _os_helper.cpp +all: _mw_helper.cpp python setup.py build_ext --inplace clean: diff --git a/_os_helper.cpp b/_mw_helper.cpp similarity index 95% rename from _os_helper.cpp rename to _mw_helper.cpp index 56f5373..818129a 100644 --- a/_os_helper.cpp +++ b/_mw_helper.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1 on Wed Jan 4 09:06:01 2012 */ +/* Generated by Cython 0.15.1 on Wed Jan 4 09:11:32 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -230,8 +230,8 @@ #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___os_helper -#define __PYX_HAVE_API___os_helper +#define __PYX_HAVE___mw_helper +#define __PYX_HAVE_API___mw_helper #include #include "stdint.h" #ifdef _OPENMP @@ -316,7 +316,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "_os_helper.pyx", + "_mw_helper.pyx", }; /*--- Type declarations ---*/ @@ -410,30 +410,30 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'libc.stdint' */ -/* Module declarations from '_os_helper' */ +/* Module declarations from '_mw_helper' */ __PYX_EXTERN_C DL_IMPORT(void) _frontmost_process(char *, int32_t); /*proto*/ __PYX_EXTERN_C DL_IMPORT(void) _display_resolutions(std::vector > *); /*proto*/ -#define __Pyx_MODULE_NAME "_os_helper" -int __pyx_module_is_main__os_helper = 0; +#define __Pyx_MODULE_NAME "_mw_helper" +int __pyx_module_is_main__mw_helper = 0; -/* Implementation of '_os_helper' */ +/* Implementation of '_mw_helper' */ static PyObject *__pyx_builtin_xrange; static char __pyx_k__range[] = "range"; static char __pyx_k__xrange[] = "xrange"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k___os_helper[] = "_os_helper"; +static char __pyx_k___mw_helper[] = "_mw_helper"; static char __pyx_k__get_resolutions[] = "get_resolutions"; static char __pyx_k__frontmost_process[] = "frontmost_process"; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___os_helper; +static PyObject *__pyx_n_s___mw_helper; static PyObject *__pyx_n_s__frontmost_process; static PyObject *__pyx_n_s__get_resolutions; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__xrange; -/* "_os_helper.pyx":8 +/* "_mw_helper.pyx":8 * void _display_resolutions(vector[vector[int32_t]]*) * * def frontmost_process(): # <<<<<<<<<<<<<< @@ -441,10 +441,10 @@ static PyObject *__pyx_n_s__xrange; * cdef char buffer[256] */ -static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_10_os_helper_frontmost_process[] = "Return the name of the application that owns the frontmost window"; -static PyMethodDef __pyx_mdef_10_os_helper_frontmost_process = {__Pyx_NAMESTR("frontmost_process"), (PyCFunction)__pyx_pf_10_os_helper_frontmost_process, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10_os_helper_frontmost_process)}; -static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_10_mw_helper_frontmost_process(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_10_mw_helper_frontmost_process[] = "Return the name of the application that owns the frontmost window"; +static PyMethodDef __pyx_mdef_10_mw_helper_frontmost_process = {__Pyx_NAMESTR("frontmost_process"), (PyCFunction)__pyx_pf_10_mw_helper_frontmost_process, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10_mw_helper_frontmost_process)}; +static PyObject *__pyx_pf_10_mw_helper_frontmost_process(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { char __pyx_v_buffer[256]; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -455,7 +455,7 @@ static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, C __Pyx_RefNannySetupContext("frontmost_process"); __pyx_self = __pyx_self; - /* "_os_helper.pyx":11 + /* "_mw_helper.pyx":11 * """Return the name of the application that owns the frontmost window""" * cdef char buffer[256] * _frontmost_process(buffer, 256) # <<<<<<<<<<<<<< @@ -464,7 +464,7 @@ static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, C */ _frontmost_process(__pyx_v_buffer, 256); - /* "_os_helper.pyx":12 + /* "_mw_helper.pyx":12 * cdef char buffer[256] * _frontmost_process(buffer, 256) * return buffer # <<<<<<<<<<<<<< @@ -482,7 +482,7 @@ static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, C goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_os_helper.frontmost_process", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_mw_helper.frontmost_process", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -490,7 +490,7 @@ static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, C return __pyx_r; } -/* "_os_helper.pyx":14 +/* "_mw_helper.pyx":14 * return buffer * * def get_resolutions(): # <<<<<<<<<<<<<< @@ -498,9 +498,9 @@ static PyObject *__pyx_pf_10_os_helper_frontmost_process(PyObject *__pyx_self, C * cdef int32_t x,y,i */ -static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10_os_helper_1get_resolutions = {__Pyx_NAMESTR("get_resolutions"), (PyCFunction)__pyx_pf_10_os_helper_1get_resolutions, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_10_mw_helper_1get_resolutions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_10_mw_helper_1get_resolutions = {__Pyx_NAMESTR("get_resolutions"), (PyCFunction)__pyx_pf_10_mw_helper_1get_resolutions, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_10_mw_helper_1get_resolutions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { std::vector > __pyx_v_resolutions; int32_t __pyx_v_i; PyObject *__pyx_v_rv = NULL; @@ -518,7 +518,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY __Pyx_RefNannySetupContext("get_resolutions"); __pyx_self = __pyx_self; - /* "_os_helper.pyx":18 + /* "_mw_helper.pyx":18 * cdef int32_t x,y,i * * rv = [] # <<<<<<<<<<<<<< @@ -530,7 +530,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY __pyx_v_rv = __pyx_t_1; __pyx_t_1 = 0; - /* "_os_helper.pyx":19 + /* "_mw_helper.pyx":19 * * rv = [] * _display_resolutions(&resolutions) # <<<<<<<<<<<<<< @@ -539,7 +539,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY */ _display_resolutions((&__pyx_v_resolutions)); - /* "_os_helper.pyx":20 + /* "_mw_helper.pyx":20 * rv = [] * _display_resolutions(&resolutions) * for i in xrange(resolutions.size()): # <<<<<<<<<<<<<< @@ -550,7 +550,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "_os_helper.pyx":21 + /* "_mw_helper.pyx":21 * _display_resolutions(&resolutions) * for i in xrange(resolutions.size()): * rv.append( [resolutions[i][0], resolutions[i][1]] ) # <<<<<<<<<<<<<< @@ -576,7 +576,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; } - /* "_os_helper.pyx":22 + /* "_mw_helper.pyx":22 * for i in xrange(resolutions.size()): * rv.append( [resolutions[i][0], resolutions[i][1]] ) * return rv # <<<<<<<<<<<<<< @@ -594,7 +594,7 @@ static PyObject *__pyx_pf_10_os_helper_1get_resolutions(PyObject *__pyx_self, CY __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_os_helper.get_resolutions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("_mw_helper.get_resolutions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rv); @@ -610,7 +610,7 @@ static PyMethodDef __pyx_methods[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("_os_helper"), + __Pyx_NAMESTR("_mw_helper"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -624,7 +624,7 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___os_helper, __pyx_k___os_helper, sizeof(__pyx_k___os_helper), 0, 0, 1, 1}, + {&__pyx_n_s___mw_helper, __pyx_k___mw_helper, sizeof(__pyx_k___mw_helper), 0, 0, 1, 1}, {&__pyx_n_s__frontmost_process, __pyx_k__frontmost_process, sizeof(__pyx_k__frontmost_process), 0, 0, 1, 1}, {&__pyx_n_s__get_resolutions, __pyx_k__get_resolutions, sizeof(__pyx_k__get_resolutions), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, @@ -657,11 +657,11 @@ static int __Pyx_InitGlobals(void) { } #if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC init_os_helper(void); /*proto*/ -PyMODINIT_FUNC init_os_helper(void) +PyMODINIT_FUNC init_mw_helper(void); /*proto*/ +PyMODINIT_FUNC init_mw_helper(void) #else -PyMODINIT_FUNC PyInit__os_helper(void); /*proto*/ -PyMODINIT_FUNC PyInit__os_helper(void) +PyMODINIT_FUNC PyInit__mw_helper(void); /*proto*/ +PyMODINIT_FUNC PyInit__mw_helper(void) #endif { PyObject *__pyx_t_1 = NULL; @@ -675,7 +675,7 @@ PyMODINIT_FUNC PyInit__os_helper(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__os_helper(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__mw_helper(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -691,7 +691,7 @@ PyMODINIT_FUNC PyInit__os_helper(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_os_helper"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_mw_helper"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -704,7 +704,7 @@ PyMODINIT_FUNC PyInit__os_helper(void) if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main__os_helper) { + if (__pyx_module_is_main__mw_helper) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -720,31 +720,31 @@ PyMODINIT_FUNC PyInit__os_helper(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "_os_helper.pyx":8 + /* "_mw_helper.pyx":8 * void _display_resolutions(vector[vector[int32_t]]*) * * def frontmost_process(): # <<<<<<<<<<<<<< * """Return the name of the application that owns the frontmost window""" * cdef char buffer[256] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10_os_helper_frontmost_process, NULL, __pyx_n_s___os_helper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10_mw_helper_frontmost_process, NULL, __pyx_n_s___mw_helper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__frontmost_process, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_os_helper.pyx":14 + /* "_mw_helper.pyx":14 * return buffer * * def get_resolutions(): # <<<<<<<<<<<<<< * cdef vector[vector[int32_t]] resolutions * cdef int32_t x,y,i */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10_os_helper_1get_resolutions, NULL, __pyx_n_s___os_helper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10_mw_helper_1get_resolutions, NULL, __pyx_n_s___mw_helper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_resolutions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_os_helper.pyx":1 + /* "_mw_helper.pyx":1 * from libcpp.vector cimport vector # <<<<<<<<<<<<<< * from libc.stdint cimport * * @@ -757,10 +757,10 @@ PyMODINIT_FUNC PyInit__os_helper(void) __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { - __Pyx_AddTraceback("init _os_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init _mw_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _os_helper"); + PyErr_SetString(PyExc_ImportError, "init _mw_helper"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); diff --git a/_os_helper.pyx b/_mw_helper.pyx similarity index 100% rename from _os_helper.pyx rename to _mw_helper.pyx diff --git a/setup.py b/setup.py index 14c8044..b042d69 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ extra_setup_args = {} os_helper = Extension("_mw_helper", - ["_os_helper.cpp", "_os_interface.cpp"], + ["_mw_helper.cpp", "_os_interface.cpp"], extra_link_args = ["-framework Carbon", "-framework ApplicationServices"], language="c++", )