]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Modules/puremodule.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Modules / puremodule.c
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Modules/puremodule.c b/AppPkg/Applications/Python/Python-2.7.2/Modules/puremodule.c
deleted file mode 100644 (file)
index 0f5d809..0000000
+++ /dev/null
@@ -1,992 +0,0 @@
-/* This module exports the C API to such Pure Software Inc. (tm) (now\r
- * called Pure Atria Corporation) products as Purify (tm) and Quantify\r
- * (tm).  Other packages could be added, but I didn't have those products\r
- * and thus lack the API documentation.\r
- *\r
- * Currently supported: Quantify 2.x, Purify 3.x\r
- *\r
- * You need to decide which products you want to incorporate into the\r
- * module when you compile this file.  The way to do this is to edit\r
- * <Python>/Modules/Setup to pass the appropriate flags to the compiler.\r
- * -DWITH_PURIFY compiles in the Purify support, and -DWITH_QUANTIFY\r
- * compiles in the Quantify support.  -DWITH_ALL_PURE compiles in both.\r
- * You can also build a Purify'd or Quantify'd interpreter by passing in\r
- * the LINKCC variable to make.  E.g. if you want to build a Purify'd\r
- * interpreter and are using gcc, build Python with this command:\r
- *\r
- * make LINKCC='purify gcc'\r
- *\r
- * It would be nice (and probably easy) to provide this file as a shared\r
- * library, however since it doesn't appear that Pure gives us shared\r
- * libraries of the stubs, it doesn't really matter.  For now, you have to\r
- * link this file in statically.\r
- *\r
- * Major bogosity.  The purify.h header file exports purify_exit(), but\r
- * guess what?  It is not defined in the libpurify_stubs.a file!  I tried\r
- * to fake one here, hoping the Pure linker would Do The Right Thing when\r
- * instrumented for Purify, but it doesn't seem to, so I don't export\r
- * purify_exit() to the Python layer.  In Python you should raise a\r
- * SystemExit exception anyway.\r
- *\r
- * The actual purify.h and quantify.h files which embody the APIs are\r
- * copyrighted by Pure Software, Inc. and are only attainable through them.\r
- * This module assumes you have legally installed licenses of their\r
- * software.  Contact them on the Web via <http://www.pureatria.com/>\r
- *\r
- * Author: Barry Warsaw <bwarsaw@python.org>\r
- *                      <bwarsaw@cnri.reston.va.us>\r
- */\r
-\r
-#include "Python.h"\r
-\r
-#if defined(WITH_PURIFY) || defined(WITH_ALL_PURE)\r
-#    include <purify.h>\r
-#    define HAS_PURIFY_EXIT 0                /* See note at top of file */\r
-#    define PURE_PURIFY_VERSION 3            /* not provided by purify.h */\r
-#endif\r
-#if defined(WITH_QUANTIFY) || defined(WITH_ALL_PURE)\r
-#    include <quantify.h>\r
-#    define PURE_QUANTIFY_VERSION 2          /* not provided by quantify.h */\r
-#endif\r
-#if defined(PURIFY_H) || defined(QUANTIFY_H)\r
-#    define COMMON_PURE_FUNCTIONS\r
-#endif /* PURIFY_H || QUANTIFY_H */\r
-\r
-typedef int (*VoidArgFunc)(void);\r
-typedef int (*StringArgFunc)(char*);\r
-typedef int (*PrintfishFunc)(const char*, ...);\r
-typedef int (*StringIntArgFunc)(const char*, int);\r
-\r
-\r
-\r
-static PyObject*\r
-call_voidarg_function(VoidArgFunc func, PyObject *self, PyObject *args)\r
-{\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, ""))\r
-        return NULL;\r
-\r
-    status = func();\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-call_stringarg_function(StringArgFunc func, PyObject *self, PyObject *args)\r
-{\r
-    int status;\r
-    char* stringarg;\r
-\r
-    if (!PyArg_ParseTuple(args, "s", &stringarg))\r
-        return NULL;\r
-\r
-    status = func(stringarg);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-call_stringorint_function(StringArgFunc func, PyObject *self, PyObject *args)\r
-{\r
-    int status;\r
-    int intarg;\r
-    char* stringarg;\r
-\r
-    /* according to the quantify.h file, the argument to\r
-     * quantify_*_recording_system_call can be an integer or a string,\r
-     * but the functions are prototyped as taking a single char*\r
-     * argument. Yikes!\r
-     */\r
-    if (PyArg_ParseTuple(args, "i", &intarg))\r
-        /* func is prototyped as int(*)(char*)\r
-         * better shut up the compiler\r
-         */\r
-        status = func((char*)intarg);\r
-\r
-    else {\r
-        PyErr_Clear();\r
-        if (!PyArg_ParseTuple(args, "s", &stringarg))\r
-            return NULL;\r
-        else\r
-            status = func(stringarg);\r
-    }\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-call_printfish_function(PrintfishFunc func, PyObject *self, PyObject *args)\r
-{\r
-    /* we support the printf() style vararg functions by requiring the\r
-     * formatting be done in Python.  At the C level we pass just a string\r
-     * to the printf() style function.\r
-     */\r
-    int status;\r
-    char* argstring;\r
-\r
-    if (!PyArg_ParseTuple(args, "s", &argstring))\r
-        return NULL;\r
-\r
-    status = func("%s", argstring);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-call_intasaddr_function(StringArgFunc func, PyObject *self, PyObject *args)\r
-{\r
-    long memrep;\r
-    int id;\r
-\r
-    if (!PyArg_ParseTuple(args, "l", &memrep))\r
-        return NULL;\r
-\r
-    id = func((char*)memrep);\r
-    return Py_BuildValue("i", id);\r
-}\r
-\r
-static PyObject*\r
-call_stringandint_function(StringIntArgFunc func, PyObject *self,\r
-                           PyObject *args)\r
-{\r
-    long srcrep;\r
-    int size;\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, "li", &srcrep, &size))\r
-        return NULL;\r
-\r
-    status = func((char*)srcrep, size);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-\r
-\r
-/* functions common to all products\r
- *\r
- * N.B. These printf() style functions are a bit of a kludge.  Since the\r
- * API doesn't provide vprintf versions of them, we can't call them\r
- * directly.  They don't support all the standard printf % modifiers\r
- * anyway.  The way to use these is to use Python's % string operator to do\r
- * the formatting.  By the time these functions get the thing to print,\r
- * it's already a string, and they just use "%s" as the format string.\r
- */\r
-\r
-#ifdef COMMON_PURE_FUNCTIONS\r
-\r
-static PyObject*\r
-pure_pure_logfile_printf(PyObject* self, PyObject* args)\r
-{\r
-    return call_printfish_function(pure_logfile_printf, self, args);\r
-}\r
-\r
-static PyObject*\r
-pure_pure_printf(PyObject* self, PyObject* args)\r
-{\r
-    return call_printfish_function(pure_printf, self, args);\r
-}\r
-\r
-static PyObject*\r
-pure_pure_printf_with_banner(PyObject* self, PyObject* args)\r
-{\r
-    return call_printfish_function(pure_printf_with_banner, self, args);\r
-}\r
-\r
-\r
-#endif /* COMMON_PURE_FUNCTIONS */\r
-\r
-\r
-\r
-/* Purify functions\r
- *\r
- * N.B. There are some interfaces described in the purify.h file that are\r
- * not described in the manual.\r
- *\r
- * Unsigned longs purify_report_{address,number,type,result} are not\r
- * accessible from the Python layer since they seem mostly useful when\r
- * purify_stop_here() is called by the (C) debugger.  The same is true of\r
- * the purify_stop_here_internal() function so it isn't exported either.\r
- * And purify_stop_here() should never be called directly.\r
- *\r
- * The header file says purify_{new,all,clear_new}_reports() are obsolete\r
- * so they aren't exported.\r
- *\r
- * None of the custom dynamic loader functions are exported.\r
- *\r
- * purify_unsafe_memcpy() isn't exported.\r
- *\r
- * purify_{start,size}_of_block() aren't exported.\r
- *\r
- * The manual that I have says that the prototype for the second argument\r
- * to purify_map_pool is:\r
- *\r
- *    void (*fn)(char*)\r
- *\r
- * but the purify.h file declares it as:\r
- *\r
- *    void (*fn)(char*, int, void*)\r
- *\r
- * and does not explain what the other arguments are for.  I support the\r
- * latter but I don't know if I do it right or usefully.\r
- *\r
- * The header file says that purify_describe() returns a char* which is the\r
- * pointer passed to it.  The manual says it returns an int, but I believe\r
- * that is a typo.\r
- */\r
-#ifdef PURIFY_H\r
-\r
-static PyObject*\r
-pure_purify_all_inuse(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_all_inuse, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_all_leaks(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_all_leaks, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_new_inuse(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_new_inuse, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_new_leaks(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_new_leaks, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_clear_inuse(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_clear_inuse, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_clear_leaks(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_clear_leaks, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_all_fds_inuse(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_all_fds_inuse, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_new_fds_inuse(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_new_fds_inuse, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_printf_with_call_chain(PyObject *self, PyObject *args)\r
-{\r
-    return call_printfish_function(purify_printf_with_call_chain,\r
-                                   self, args);\r
-}\r
-static PyObject*\r
-pure_purify_set_pool_id(PyObject *self, PyObject *args)\r
-{\r
-    long memrep;\r
-    int id;\r
-\r
-    if (!PyArg_ParseTuple(args, "li:purify_set_pool_id", &memrep, &id))\r
-        return NULL;\r
-\r
-    purify_set_pool_id((char*)memrep, id);\r
-    Py_INCREF(Py_None);\r
-    return Py_None;\r
-}\r
-static PyObject*\r
-pure_purify_get_pool_id(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_get_pool_id, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_set_user_data(PyObject *self, PyObject *args)\r
-{\r
-    long memrep;\r
-    long datarep;\r
-\r
-    if (!PyArg_ParseTuple(args, "ll:purify_set_user_data", &memrep, &datarep))\r
-        return NULL;\r
-\r
-    purify_set_user_data((char*)memrep, (void*)datarep);\r
-    Py_INCREF(Py_None);\r
-    return Py_None;\r
-}\r
-static PyObject*\r
-pure_purify_get_user_data(PyObject *self, PyObject *args)\r
-{\r
-    /* can't use call_intasaddr_function() since purify_get_user_data()\r
-     * returns a void*\r
-     */\r
-    long memrep;\r
-    void* data;\r
-\r
-    if (!PyArg_ParseTuple(args, "l:purify_get_user_data", &memrep))\r
-        return NULL;\r
-\r
-    data = purify_get_user_data((char*)memrep);\r
-    return Py_BuildValue("l", (long)data);\r
-}\r
-\r
-\r
-/* this global variable is shared by both mapping functions:\r
- * pure_purify_map_pool() and pure_purify_map_pool_id().  Since they cache\r
- * this variable it should be safe in the face of recursion or cross\r
- * calling.\r
- *\r
- * Further note that the prototype for the callback function is wrong in\r
- * the Purify manual.  The manual says the function takes a single char*,\r
- * but the header file says it takes an additional int and void*.  I have\r
- * no idea what these are for!\r
- */\r
-static PyObject* MapCallable = NULL;\r
-\r
-static void\r
-map_pool_callback(char* mem, int user_size, void *user_aux_data)\r
-{\r
-    long memrep = (long)mem;\r
-    long user_aux_data_rep = (long)user_aux_data;\r
-    PyObject* result;\r
-    PyObject* memobj = Py_BuildValue("lil", memrep, user_size,\r
-                                     user_aux_data_rep);\r
-\r
-    if (memobj == NULL)\r
-        return;\r
-\r
-    result = PyEval_CallObject(MapCallable, memobj);\r
-    Py_DECREF(result);\r
-    Py_DECREF(memobj);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_map_pool(PyObject *self, PyObject *args)\r
-{\r
-    /* cache global variable in case of recursion */\r
-    PyObject* saved_callable = MapCallable;\r
-    PyObject* arg_callable;\r
-    int id;\r
-\r
-    if (!PyArg_ParseTuple(args, "iO:purify_map_pool", &id, &arg_callable))\r
-        return NULL;\r
-\r
-    if (!PyCallable_Check(arg_callable)) {\r
-        PyErr_SetString(PyExc_TypeError,\r
-                        "Second argument must be callable");\r
-        return NULL;\r
-    }\r
-    MapCallable = arg_callable;\r
-    purify_map_pool(id, map_pool_callback);\r
-    MapCallable = saved_callable;\r
-\r
-    Py_INCREF(Py_None);\r
-    return Py_None;\r
-}\r
-\r
-static void\r
-PurifyMapPoolIdCallback(int id)\r
-{\r
-    PyObject* result;\r
-    PyObject* intobj = Py_BuildValue("i", id);\r
-\r
-    if (intobj == NULL)\r
-        return;\r
-\r
-    result = PyEval_CallObject(MapCallable, intobj);\r
-    Py_DECREF(result);\r
-    Py_DECREF(intobj);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_map_pool_id(PyObject *self, PyObject *args)\r
-{\r
-    /* cache global variable in case of recursion */\r
-    PyObject* saved_callable = MapCallable;\r
-    PyObject* arg_callable;\r
-\r
-    if (!PyArg_ParseTuple(args, "O:purify_map_pool_id", &arg_callable))\r
-        return NULL;\r
-\r
-    if (!PyCallable_Check(arg_callable)) {\r
-        PyErr_SetString(PyExc_TypeError, "Argument must be callable.");\r
-        return NULL;\r
-    }\r
-\r
-    MapCallable = arg_callable;\r
-    purify_map_pool_id(PurifyMapPoolIdCallback);\r
-    MapCallable = saved_callable;\r
-\r
-    Py_INCREF(Py_None);\r
-    return Py_None;\r
-}\r
-\r
-\r
-\r
-static PyObject*\r
-pure_purify_new_messages(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_new_messages, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_all_messages(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_all_messages, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_clear_messages(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_clear_messages, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_clear_new_messages(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_clear_new_messages, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_start_batch(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_start_batch, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_start_batch_show_first(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_start_batch_show_first,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_purify_stop_batch(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_stop_batch, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_name_thread(PyObject *self, PyObject *args)\r
-{\r
-    /* can't strictly use call_stringarg_function since\r
-     * purify_name_thread takes a const char*, not a char*\r
-     */\r
-    int status;\r
-    char* stringarg;\r
-\r
-    if (!PyArg_ParseTuple(args, "s:purify_name_thread", &stringarg))\r
-        return NULL;\r
-\r
-    status = purify_name_thread(stringarg);\r
-    return Py_BuildValue("i", status);\r
-}\r
-static PyObject*\r
-pure_purify_watch(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_1(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_1, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_2(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_2, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_4(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_4, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_8(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_8, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_w_1(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_w_1, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_w_2(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_w_2, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_w_4(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_w_4, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_w_8(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_w_8, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_r_1(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_r_1, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_r_2(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_r_2, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_r_4(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_r_4, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_r_8(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_r_8, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_rw_1(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_rw_1, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_rw_2(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_rw_2, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_rw_4(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_rw_4, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_watch_rw_8(PyObject *self, PyObject *args)\r
-{\r
-    return call_intasaddr_function(purify_watch_rw_8, self, args);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_watch_n(PyObject *self, PyObject *args)\r
-{\r
-    long addrrep;\r
-    unsigned int size;\r
-    char* type;\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, "lis:purify_watch_n", &addrrep, &size, &type))\r
-        return NULL;\r
-\r
-    status = purify_watch_n((char*)addrrep, size, type);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_watch_info(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_watch_info, self, args);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_watch_remove(PyObject *self, PyObject *args)\r
-{\r
-    int watchno;\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, "i:purify_watch_remove", &watchno))\r
-        return NULL;\r
-\r
-    status = purify_watch_remove(watchno);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_watch_remove_all(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_watch_remove_all, self, args);\r
-}\r
-static PyObject*\r
-pure_purify_describe(PyObject *self, PyObject *args)\r
-{\r
-    long addrrep;\r
-    char* rtn;\r
-\r
-    if (!PyArg_ParseTuple(args, "l:purify_describe", &addrrep))\r
-        return NULL;\r
-\r
-    rtn = purify_describe((char*)addrrep);\r
-    return Py_BuildValue("l", (long)rtn);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_what_colors(PyObject *self, PyObject *args)\r
-{\r
-    long addrrep;\r
-    unsigned int size;\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, "li:purify_what_colors", &addrrep, &size))\r
-        return NULL;\r
-\r
-    status = purify_what_colors((char*)addrrep, size);\r
-    return Py_BuildValue("i", status);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_is_running(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(purify_is_running, self, args);\r
-}\r
-\r
-static PyObject*\r
-pure_purify_assert_is_readable(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringandint_function(purify_assert_is_readable,\r
-                                      self, args);\r
-}\r
-static PyObject*\r
-pure_purify_assert_is_writable(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringandint_function(purify_assert_is_writable,\r
-                                      self, args);\r
-}\r
-\r
-#if HAS_PURIFY_EXIT\r
-\r
-/* I wish I could include this, but I can't.  See the notes at the top of\r
- * the file.\r
- */\r
-\r
-static PyObject*\r
-pure_purify_exit(PyObject *self, PyObject *args)\r
-{\r
-    int status;\r
-\r
-    if (!PyArg_ParseTuple(args, "i:purify_exit", &status))\r
-        return NULL;\r
-\r
-    /* purify_exit doesn't always act like exit(). See the manual */\r
-    purify_exit(status);\r
-    Py_INCREF(Py_None);\r
-    return Py_None;\r
-}\r
-#endif /* HAS_PURIFY_EXIT */\r
-\r
-#endif /* PURIFY_H */\r
-\r
-\r
-\r
-/* Quantify functions\r
- *\r
- * N.B. Some of these functions are only described in the quantify.h file,\r
- * not in the version of the hardcopy manual that I had.  If you're not\r
- * sure what some of these do, check the header file, it is documented\r
- * fairly well.\r
- *\r
- * None of the custom dynamic loader functions are exported.\r
- *\r
- */\r
-#ifdef QUANTIFY_H\r
-\r
-static PyObject*\r
-pure_quantify_is_running(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_is_running, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_help(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_help, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_print_recording_state(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_print_recording_state,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_start_recording_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_start_recording_data,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_stop_recording_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_stop_recording_data, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_is_recording_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_is_recording_data, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_start_recording_system_calls(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_start_recording_system_calls,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_stop_recording_system_calls(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_stop_recording_system_calls,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_is_recording_system_calls(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_is_recording_system_calls,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_start_recording_system_call(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringorint_function(quantify_start_recording_system_call,\r
-                                       self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_stop_recording_system_call(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringorint_function(quantify_stop_recording_system_call,\r
-                                     self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_is_recording_system_call(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringorint_function(quantify_is_recording_system_call,\r
-                                     self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_start_recording_dynamic_library_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_start_recording_dynamic_library_data,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_stop_recording_dynamic_library_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_stop_recording_dynamic_library_data,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_is_recording_dynamic_library_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_is_recording_dynamic_library_data,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_start_recording_register_window_traps(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_start_recording_register_window_traps,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_stop_recording_register_window_traps(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_stop_recording_register_window_traps,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_is_recording_register_window_traps(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(\r
-        quantify_is_recording_register_window_traps,\r
-        self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_disable_recording_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_disable_recording_data,\r
-                                 self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_clear_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_clear_data, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_save_data(PyObject *self, PyObject *args)\r
-{\r
-    return call_voidarg_function(quantify_save_data, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_save_data_to_file(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringarg_function(quantify_save_data_to_file, self, args);\r
-}\r
-static PyObject*\r
-pure_quantify_add_annotation(PyObject *self, PyObject *args)\r
-{\r
-    return call_stringarg_function(quantify_add_annotation, self, args);\r
-}\r
-\r
-#endif /* QUANTIFY_H */\r
-\r
-\r
-\r
-/* external interface\r
- */\r
-static struct PyMethodDef\r
-pure_methods[] = {\r
-#ifdef COMMON_PURE_FUNCTIONS\r
-    {"pure_logfile_printf",            pure_pure_logfile_printf,            METH_VARARGS},\r
-    {"pure_printf",                    pure_pure_printf,                    METH_VARARGS},\r
-    {"pure_printf_with_banner",        pure_pure_printf_with_banner,        METH_VARARGS},\r
-#endif /* COMMON_PURE_FUNCTIONS */\r
-#ifdef PURIFY_H\r
-    {"purify_all_inuse",               pure_purify_all_inuse,               METH_VARARGS},\r
-    {"purify_all_leaks",               pure_purify_all_leaks,               METH_VARARGS},\r
-    {"purify_new_inuse",               pure_purify_new_inuse,               METH_VARARGS},\r
-    {"purify_new_leaks",               pure_purify_new_leaks,               METH_VARARGS},\r
-    {"purify_clear_inuse",             pure_purify_clear_inuse,             METH_VARARGS},\r
-    {"purify_clear_leaks",             pure_purify_clear_leaks,             METH_VARARGS},\r
-    {"purify_all_fds_inuse",           pure_purify_all_fds_inuse,           METH_VARARGS},\r
-    {"purify_new_fds_inuse",           pure_purify_new_fds_inuse,           METH_VARARGS},\r
-    /* see purify.h */\r
-    {"purify_logfile_printf",          pure_pure_logfile_printf,            METH_VARARGS},\r
-    {"purify_printf",                  pure_pure_printf,                    METH_VARARGS},\r
-    {"purify_printf_with_banner",      pure_pure_printf_with_banner,        METH_VARARGS},\r
-    /**/\r
-    {"purify_printf_with_call_chain",  pure_purify_printf_with_call_chain,  METH_VARARGS},\r
-    {"purify_set_pool_id",             pure_purify_set_pool_id,             METH_VARARGS},\r
-    {"purify_get_pool_id",             pure_purify_get_pool_id,             METH_VARARGS},\r
-    {"purify_set_user_data",           pure_purify_set_user_data,           METH_VARARGS},\r
-    {"purify_get_user_data",           pure_purify_get_user_data,           METH_VARARGS},\r
-    {"purify_map_pool",                pure_purify_map_pool,                METH_VARARGS},\r
-    {"purify_map_pool_id",             pure_purify_map_pool_id,             METH_VARARGS},\r
-    {"purify_new_messages",            pure_purify_new_messages,            METH_VARARGS},\r
-    {"purify_all_messages",            pure_purify_all_messages,            METH_VARARGS},\r
-    {"purify_clear_messages",          pure_purify_clear_messages,          METH_VARARGS},\r
-    {"purify_clear_new_messages",      pure_purify_clear_new_messages,      METH_VARARGS},\r
-    {"purify_start_batch",             pure_purify_start_batch,             METH_VARARGS},\r
-    {"purify_start_batch_show_first",  pure_purify_start_batch_show_first,  METH_VARARGS},\r
-    {"purify_stop_batch",              pure_purify_stop_batch,              METH_VARARGS},\r
-    {"purify_name_thread",             pure_purify_name_thread,             METH_VARARGS},\r
-    {"purify_watch",                   pure_purify_watch,                   METH_VARARGS},\r
-    {"purify_watch_1",                 pure_purify_watch_1,                 METH_VARARGS},\r
-    {"purify_watch_2",                 pure_purify_watch_2,                 METH_VARARGS},\r
-    {"purify_watch_4",                 pure_purify_watch_4,                 METH_VARARGS},\r
-    {"purify_watch_8",                 pure_purify_watch_8,                 METH_VARARGS},\r
-    {"purify_watch_w_1",               pure_purify_watch_w_1,               METH_VARARGS},\r
-    {"purify_watch_w_2",               pure_purify_watch_w_2,               METH_VARARGS},\r
-    {"purify_watch_w_4",               pure_purify_watch_w_4,               METH_VARARGS},\r
-    {"purify_watch_w_8",               pure_purify_watch_w_8,               METH_VARARGS},\r
-    {"purify_watch_r_1",               pure_purify_watch_r_1,               METH_VARARGS},\r
-    {"purify_watch_r_2",               pure_purify_watch_r_2,               METH_VARARGS},\r
-    {"purify_watch_r_4",               pure_purify_watch_r_4,               METH_VARARGS},\r
-    {"purify_watch_r_8",               pure_purify_watch_r_8,               METH_VARARGS},\r
-    {"purify_watch_rw_1",              pure_purify_watch_rw_1,              METH_VARARGS},\r
-    {"purify_watch_rw_2",              pure_purify_watch_rw_2,              METH_VARARGS},\r
-    {"purify_watch_rw_4",              pure_purify_watch_rw_4,              METH_VARARGS},\r
-    {"purify_watch_rw_8",              pure_purify_watch_rw_8,              METH_VARARGS},\r
-    {"purify_watch_n",                 pure_purify_watch_n,                 METH_VARARGS},\r
-    {"purify_watch_info",              pure_purify_watch_info,              METH_VARARGS},\r
-    {"purify_watch_remove",            pure_purify_watch_remove,            METH_VARARGS},\r
-    {"purify_watch_remove_all",        pure_purify_watch_remove_all,        METH_VARARGS},\r
-    {"purify_describe",                pure_purify_describe,                METH_VARARGS},\r
-    {"purify_what_colors",             pure_purify_what_colors,             METH_VARARGS},\r
-    {"purify_is_running",              pure_purify_is_running,              METH_VARARGS},\r
-    {"purify_assert_is_readable",      pure_purify_assert_is_readable,      METH_VARARGS},\r
-    {"purify_assert_is_writable",      pure_purify_assert_is_writable,      METH_VARARGS},\r
-#if HAS_PURIFY_EXIT\r
-    /* I wish I could include this, but I can't.  See the notes at the\r
-     * top of the file.\r
-     */\r
-    {"purify_exit",                    pure_purify_exit,                    METH_VARARGS},\r
-#endif /* HAS_PURIFY_EXIT */\r
-#endif /* PURIFY_H */\r
-#ifdef QUANTIFY_H\r
-    {"quantify_is_running",            pure_quantify_is_running,            METH_VARARGS},\r
-    {"quantify_help",                  pure_quantify_help,                  METH_VARARGS},\r
-    {"quantify_print_recording_state", pure_quantify_print_recording_state, METH_VARARGS},\r
-    {"quantify_start_recording_data",  pure_quantify_start_recording_data,  METH_VARARGS},\r
-    {"quantify_stop_recording_data",   pure_quantify_stop_recording_data,   METH_VARARGS},\r
-    {"quantify_is_recording_data",     pure_quantify_is_recording_data,  METH_VARARGS},\r
-    {"quantify_start_recording_system_calls",\r
-     pure_quantify_start_recording_system_calls, METH_VARARGS},\r
-    {"quantify_stop_recording_system_calls",\r
-     pure_quantify_stop_recording_system_calls, METH_VARARGS},\r
-    {"quantify_is_recording_system_calls",\r
-     pure_quantify_is_recording_system_calls, METH_VARARGS},\r
-    {"quantify_start_recording_system_call",\r
-     pure_quantify_start_recording_system_call, METH_VARARGS},\r
-    {"quantify_stop_recording_system_call",\r
-     pure_quantify_stop_recording_system_call, METH_VARARGS},\r
-    {"quantify_is_recording_system_call",\r
-     pure_quantify_is_recording_system_call, METH_VARARGS},\r
-    {"quantify_start_recording_dynamic_library_data",\r
-     pure_quantify_start_recording_dynamic_library_data, METH_VARARGS},\r
-    {"quantify_stop_recording_dynamic_library_data",\r
-     pure_quantify_stop_recording_dynamic_library_data, METH_VARARGS},\r
-    {"quantify_is_recording_dynamic_library_data",\r
-     pure_quantify_is_recording_dynamic_library_data, METH_VARARGS},\r
-    {"quantify_start_recording_register_window_traps",\r
-     pure_quantify_start_recording_register_window_traps, METH_VARARGS},\r
-    {"quantify_stop_recording_register_window_traps",\r
-     pure_quantify_stop_recording_register_window_traps, METH_VARARGS},\r
-    {"quantify_is_recording_register_window_traps",\r
-     pure_quantify_is_recording_register_window_traps, METH_VARARGS},\r
-    {"quantify_disable_recording_data",\r
-     pure_quantify_disable_recording_data, METH_VARARGS},\r
-    {"quantify_clear_data",        pure_quantify_clear_data,        METH_VARARGS},\r
-    {"quantify_save_data",         pure_quantify_save_data,         METH_VARARGS},\r
-    {"quantify_save_data_to_file", pure_quantify_save_data_to_file, METH_VARARGS},\r
-    {"quantify_add_annotation",    pure_quantify_add_annotation,    METH_VARARGS},\r
-#endif /* QUANTIFY_H */\r
-    {NULL,  NULL}                            /* sentinel */\r
-};\r
-\r
-\r
-\r
-static void\r
-ins(d, name, val)\r
-    PyObject *d;\r
-    char* name;\r
-    long val;\r
-{\r
-    PyObject *v = PyInt_FromLong(val);\r
-    if (v) {\r
-        (void)PyDict_SetItemString(d, name, v);\r
-        Py_DECREF(v);\r
-    }\r
-}\r
-\r
-\r
-void\r
-initpure()\r
-{\r
-    PyObject *m, *d;\r
-\r
-    if (PyErr_WarnPy3k("the pure module has been removed in "\r
-                       "Python 3.0", 2) < 0)\r
-        return;\r
-\r
-    m = Py_InitModule("pure", pure_methods);\r
-    if (m == NULL)\r
-        return;\r
-    d = PyModule_GetDict(m);\r
-\r
-    /* this is bogus because we should be able to find this information\r
-     * out from the header files.  Pure's current versions don't\r
-     * include this information!\r
-     */\r
-#ifdef PURE_PURIFY_VERSION\r
-    ins(d, "PURIFY_VERSION", PURE_PURIFY_VERSION);\r
-#else\r
-    PyDict_SetItemString(d, "PURIFY_VERSION", Py_None);\r
-#endif\r
-\r
-    /* these aren't terribly useful because purify_exit() isn't\r
-     * exported correctly.  See the note at the top of the file.\r
-     */\r
-#ifdef PURIFY_EXIT_ERRORS\r
-    ins(d, "PURIFY_EXIT_ERRORS", PURIFY_EXIT_ERRORS);\r
-#endif\r
-#ifdef PURIFY_EXIT_LEAKS\r
-    ins(d, "PURIFY_EXIT_LEAKS",  PURIFY_EXIT_LEAKS);\r
-#endif\r
-#ifdef PURIFY_EXIT_PLEAKS\r
-    ins(d, "PURIFY_EXIT_PLEAKS", PURIFY_EXIT_PLEAKS);\r
-#endif\r
-\r
-\r
-#ifdef PURE_QUANTIFY_VERSION\r
-    ins(d, "QUANTIFY_VERSION", PURE_QUANTIFY_VERSION);\r
-#else\r
-    PyDict_SetItemString(d, "QUANTIFY_VERSION", Py_None);\r
-#endif\r
-}\r