python-pqueue-0.2.orig/0042755000175000000500000000000007105247173014004 5ustar quangosrcpython-pqueue-0.2.orig/Makefile.pre.in0100644000175000000500000001415506741346154016643 0ustar quangosrc# Universal Unix Makefile for Python extensions (for use with Autoconf) # ===================================================================== # Note that this is not the same file as that distributed with Python 1.4. # It has been slightly modified so that it can be used with scripts created # by autoconf (using some extra commands written by James Henstridge) # Also note that this file will also work with Python 1.5 or 1.5.1 # Short Instructions # ------------------ # 1. Build and install Python (1.4 or newer). # 2. run "./configure" # 3. run "make" # You should now have a shared library. # Long Instructions # ----------------- # Build *and install* the basic Python 1.4 distribution. See the # Python README for instructions. # Create a file Setup.in for your extension. This file follows the # format of the Modules/Setup.in file; see the instructions there. # The first line should just have the string # *shared* # For a simple module called "spam" on file "spammodule.c", it only needs # to contain one extra line:: # spam spammodule.c # You can build as many modules as you want in the same directory -- # just have a separate line for each of them in the Setup.in file. # # Note that when configure is run, The file Setup.in is parsed for @VARNAME@ # expressions, and after they are expanded, the output is put in the file # Setup. Every time configure is run, Setup is overwritten each time # configure is run. # Copy this file (Misc/Makefile.pre.in) to the directory containing # your extension. Also create a configure script. You may wish to use the # generic one supplied with this file. (This should be done by the one # writing the extension -- not the user). # Run "./configure". This creates Makefile # (producing Makefile.pre as intermediate files) and # config.c, incorporating the values for sys.prefix, sys.exec_prefix # and sys.version from the installed Python binary. For this to work, # the python binary must be on your path. If this fails, try # ./configure --with-python=/python # or # ./configure --with-python-version= --with-python-prefix= \ # --with-python-exec-prefix= # where is the prefix used to install Python # If you are building your extension as a shared library (your # Setup.in file starts with *shared*), run "make" or "make sharedmods" # to build the shared library files. If you are building a statically # linked Python binary (the only solution of your platform doesn't # support shared libraries, and sometimes handy if you want to # distribute or install the resulting Python binary), run "make # python". # Note: Each time you edit Makefile.pre.in or Setup.in, you must run # "./configure" before running "make". # Hint: if you want to use VPATH, you can start in an empty # subdirectory and type (where is the location of the source): # /configure --srcdir= # make # === Bootstrap variables (edited through "./configure") === # The prefix used by "make inclinstall libainstall" of core python prefix= @prefix@ # The exec_prefix used by the same exec_prefix= @exec_prefix@ # Source directory and VPATH (for VPATH builds). srcdir= @srcdir@ VPATH= @srcdir@ # === Variables that you may want to customize (rarely) === # (Static) build target TARGET= python # Add more -I and -D options here CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(LIBPL) $(DEFS) # These two variables can be set in Setup to merge extensions. # See example[23]. BASELIB= BASESETUP= # === Variables set by makesetup === MODOBJS= _MODOBJS_ MODLIBS= _MODLIBS_ # === Definitions added by makesetup === # === Variables from configure === VERSION= @VERSION@ CC= @CC@ LINKCC= @LINKCC@ SGI_ABI= @SGI_ABI@ OPT= @OPT@ LDFLAGS= @LDFLAGS@ LDLAST= @LDLAST@ DEFS= @DEFS@ LIBS= @LIBS@ LIBM= @LIBM@ LIBC= @LIBC@ RANLIB= @RANLIB@ MACHDEP= @MACHDEP@ SO= @SO@ LDSHARED= @LDSHARED@ CCSHARED= @CCSHARED@ LINKFORSHARED= @LINKFORSHARED@ @SET_CCC@ #the python executable (from configure) PYTHON = @PYTHON@ # Install Stuff INSTALL = @INSTALL@ PY_LIB_DIR = @PYTHON_LIBRARY_DIR@ PY_MOD_DIR = @PYTHON_MODULE_DIR@ # === Fixed definitions === # Shell used by make (some versions default to the login shell, which is bad) SHELL= /bin/sh # Expanded directories BINDIR= $(exec_prefix)/bin LIBDIR= $(exec_prefix)/lib MANDIR= $(prefix)/man INCLUDEDIR= $(prefix)/include SCRIPTDIR= $(prefix)/lib # Detailed destination directories BINLIBDEST= $(LIBDIR)/python$(VERSION) LIBDEST= $(SCRIPTDIR)/python$(VERSION) INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) LIBP= $(exec_prefix)/lib/python$(VERSION) LIBPL= $(LIBP)/config # === Fixed rules === # Default target. This builds shared libraries. default: sharedmods # Build shared libraries from our extension modules sharedmods: $(SHAREDMODS) # Target to build a pyc file from a py file: .py.pyc: $(PYTHON) -c "import py_compile; py_compile.compile('$<')" .SUFFIXES: .py .pyc # Target to install scripts and modules install: install-shmods install-scripts install-shmods: $(SHAREDMODS) @echo 'Installing shared modules...' @if [ -n "$(SHAREDMODS)" ]; then \ for mod in $(SHAREDMODS); do \ echo " install -m 555 $$mod $(PY_MOD_DIR)"; \ $(INSTALL) -m 555 $$mod $(PY_MOD_DIR); \ done; \ fi install-scripts: $(SCRIPTS) @if [ -n "$(SCRIPTS)" ]; then \ echo 'Installing scripts...'; \ for script in $(SCRIPTS); do \ dir=`dirname $$script`; \ if [ ! -d $(PY_LIB_DIR)/$$dir ]; then \ $(INSTALL) -d $(PY_LIB_DIR)/$$dir; \ fi; \ echo " install -m 644 $$script $(PY_LIB_DIR)/$$dir"; \ $(INSTALL) -m 644 $$script $(PY_LIB_DIR)/$$dir; \ done; \ echo "Compiling..."; \ for script in $(SCRIPTS); do \ $(PYTHON) -c "import py_compile; py_compile.compile(\"$(PY_LIB_DIR)/$$script\")"; \ done; \ fi # Handy target to remove intermediate files and backups clean: -rm -f *.o *~ # Handy target to remove everything that is easily regenerated clobber: clean -rm -f *.a tags TAGS config.c Makefile.pre python -rm -f *.so *.sl so_locations # Handy target to remove everything you don't want to distribute distclean: clobber -rm -f Makefile Setup -rm -f config.status config.log config.cache python-pqueue-0.2.orig/aclocal.m40100644000175000000500000002340206741346211015636 0ustar quangosrcdnl Macros to help with configuring Python extensions via autoconf. dnl Copyright (C) 1998, James Henstridge dnl dnl Distribute under the same rules as Autoconf itself. dnl call all the functions needed for useing the Makefile.pre.in (except for dnl PY_OUTPUT) Requires no arguments. AC_DEFUN(PY_INIT, [AC_REQUIRE([PY_PROG_PYTHON]) AC_REQUIRE([PY_PYTHON_VERSION]) AC_REQUIRE([PY_PYTHON_PREFIX]) AC_REQUIRE([PY_PYTHON_EXEC_PREFIX]) AC_REQUIRE([PY_PYTHON_MAKE_VARS]) AC_REQUIRE([PY_CHECK_INSTALL]) AC_REQUIRE([PY_LIB_DIR]) AC_REQUIRE([PY_MOD_DIR]) ]) dnl Check for location of python. AC_DEFUN(PY_PROG_PYTHON, [AC_ARG_WITH(python, [ --with-python=CMD name of python executable],,[with_python=no]) if test "x$with_python" != xno && test -x "$with_python"; then AC_MSG_CHECKING(for python) PYTHON="$with_python" AC_MSG_RESULT($PYTHON) AC_SUBST(PYTHON) else AC_PATH_PROG(PYTHON, python, python) fi]) dnl Check for python version AC_DEFUN(PY_PYTHON_VERSION, [AC_REQUIRE([PY_PROG_PYTHON]) AC_ARG_WITH(python-version, [ --with-python-version=VERSION overide guessed python version],, [with_python_version=no]) if test "x$with_python_version" != xno; then PYTHON_VERSION="$with_python_version" fi AC_MSG_CHECKING(python version) if test -z "$PYTHON_VERSION"; then AC_CACHE_VAL(py_cv_python_version, [changequote((_,_)) py_cv_python_version=`$PYTHON -c 'import sys; print sys.version[:3]'` changequote([,])]) else py_cv_python_version="$PYTHON_VERSION" fi PYTHON_VERSION="$py_cv_python_version" AC_MSG_RESULT($PYTHON_VERSION) VERSION=$PYTHON_VERSION AC_SUBST(VERSION) AC_SUBST(PYTHON_VERSION) ]) dnl Check python installation prefix AC_DEFUN(PY_PYTHON_PREFIX, [AC_REQUIRE([PY_PROG_PYTHON]) AC_ARG_WITH(python-prefix, [ --with-python-prefix=DIR override the prefix for python],, [with_python_prefix=no]) if test "x$with_python_prefix" != xno; then PYTHON_PREFIX="$with_python_prefix" fi AC_MSG_CHECKING(python installation prefix) if test -z "$PYTHON_PREFIX"; then AC_CACHE_VAL(py_cv_python_prefix, [py_cv_python_prefix=`$PYTHON -c 'import sys; print sys.prefix'`]) else py_cv_python_prefix="$PYTHON_PREFIX" fi PYTHON_PREFIX="$py_cv_python_prefix" AC_MSG_RESULT($PYTHON_PREFIX) AC_SUBST(PYTHON_PREFIX) prefix=$PYTHON_PREFIX ]) dnl Check python installation exec_prefix AC_DEFUN(PY_PYTHON_EXEC_PREFIX, [AC_REQUIRE([PY_PROG_PYTHON]) AC_ARG_WITH(python-prefix, [ --with-python-exec-prefix=DIR override the exec prefix for python],, [with_python_exec_prefix=no]) if test "x$with_python_exec_prefix" != xno; then PYTHON_EXEC_PREFIX="$with_python_exec_prefix" fi AC_MSG_CHECKING(python installation exec_prefix) if test -z "$PYTHON_EXEC_PREFIX"; then AC_CACHE_VAL(py_cv_python_exec_prefix, [py_cv_python_exec_prefix=`$PYTHON -c 'import sys; print sys.exec_prefix'`]) else py_cv_python_exec_prefix="$PYTHON_EXEC_PREFIX" fi PYTHON_EXEC_PREFIX="$py_cv_python_exec_prefix" AC_MSG_RESULT($PYTHON_EXEC_PREFIX) AC_SUBST(PYTHON_EXEC_PREFIX) exec_prefix=$PYTHON_EXEC_PREFIX ]) dnl get the relevant information from the python library Makefile AC_DEFUN(PY_PYTHON_MAKE_VARS, [AC_REQUIRE([PY_PYTHON_VERSION]) AC_REQUIRE([PY_PYTHON_EXEC_PREFIX]) AC_MSG_CHECKING(definitions in Python library makefile) AC_CACHE_VAL(py_cv_python_makefile_vars, [py_makefile="${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/config/Makefile" dnl set defaults for these variables so they work with Python 1.4 py_cv_python_makefile_LINKCC='' py_cv_python_makefile_SGI_ABI='' py_cv_python_makefile_LDLAST='' py_cv_python_makefile_SET_CCC='' changequote((_,_)) eval `sed -n \ -e '/^CC=/ s/CC=[ ]*\(.*\)/py_cv_python_makefile_CC='\''\1'\''/p' \ -e '/^OPT=/ s/OPT=[ ]*\(.*\)/py_cv_python_makefile_OPT='\''\1'\''/p' \ -e '/^LDFLAGS=/ s/LDFLAGS=[ ]*\(.*\)/py_cv_python_makefile_LDFLAGS='\''\1'\''/p' \ -e '/^DEFS=/ s/DEFS=[ ]*\(.*\)/py_cv_python_makefile_DEFS='\''\1'\''/p' \ -e '/^LIBS=/ s/LIBS=[ ]*\(.*\)/py_cv_python_makefile_LIBS='\''\1'\''/p' \ -e '/^LIBM=/ s/LIBM=[ ]*\(.*\)/py_cv_python_makefile_LIBM='\''\1'\''/p' \ -e '/^LIBC=/ s/LIBC=[ ]*\(.*\)/py_cv_python_makefile_LIBC='\''\1'\''/p' \ -e '/^RANLIB=/ s/RANLIB=[ ]*\(.*\)/py_cv_python_makefile_RANLIB='\''\1'\''/p' \ -e '/^MACHDEP=/ s/MACHDEP=[ ]*\(.*\)/py_cv_python_makefile_MACHDEP='\''\1'\''/p' \ -e '/^SO=/ s/SO=[ ]*\(.*\)/py_cv_python_makefile_SO='\''\1'\''/p' \ -e '/^LDSHARED=/ s/LDSHARED=[ ]*\(.*\)/py_cv_python_makefile_LDSHARED='\''\1'\''/p' \ -e '/^CCSHARED=/ s/CCSHARED=[ ]*\(.*\)/py_cv_python_makefile_CCSHARED='\''\1'\''/p' \ -e '/^LINKFORSHARED=/ s/LINKFORSHARED=[ ]*\(.*\)/py_cv_python_makefile_LINKFORSHARED='\''\1'\''/p' \ -e '/^prefix=/ s/prefix=[ ]*\(.*\)/py_cv_python_makefile_PREFIX='\''\1'\''/p' \ -e '/^exec_prefix=/ s/exec_prefix=[ ]*\(.*\)/py_cv_python_makefile_EXEC_PREFIX='\''\1'\''/p' \ -e '/^LINKCC=/ s/LINKCC=[ ]*\(.*\)/py_cv_python_makefile_LINKCC='\''\1'\''/p' \ -e '/^SGI_ABI=/ s/SGI_ABI=[ ]*\(.*\)/py_cv_python_makefile_SGI_ABI='\''\1'\''/p' \ -e '/^LDLAST=/ s/LDLAST=[ ]*\(.*\)/py_cv_python_makefile_LDLAST='\''\1'\''/p' \ -e '/^CCC/ s/CCC=[ ]*\(.*\)/py_cv_python_makefile_SET_CCC='\''CCC=\1'\''/p' \ $py_makefile` changequote([,]) py_cv_python_makefile_vars=found ]) CC="$py_cv_python_makefile_CC" OPT="$py_cv_python_makefile_OPT" LDFLAGS="$py_cv_python_makefile_LDFLAGS" DEFS="$py_cv_python_makefile_DEFS" LIBS="$py_cv_python_makefile_LIBS" LIBM="$py_cv_python_makefile_LIBM" LIBC="$py_cv_python_makefile_LIBC" RANLIB="$py_cv_python_makefile_RANLIB" MACHDEP="$py_cv_python_makefile_MACHDEP" SO="$py_cv_python_makefile_SO" LDSHARED="$py_cv_python_makefile_LDSHARED" CCSHARED="$py_cv_python_makefile_CCSHARED" LINKFORSHARED="$py_cv_python_makefile_LINKFORSHARED" PREFIX="$py_cv_python_makefile_PREFIX" EXEC_PREFIX="$py_cv_python_makefile_EXEC_PREFIX" LINKCC="$py_cv_python_makefile_LINKCC" SGI_ABI="$py_cv_python_makefile_SGI_ABI" LDLAST="$py_cv_python_makefile_LDLAST" SET_CCC="$py_cv_python_makefile_SET_CCC" changequote((_,_)) echo "$DEFS" | sed \ -e 's/-D\([^ =]*\)=\([^ ]*\)[ ]*/#define \1 \2\ /g' \ -e 's/-D\([^ =]*\)[ ]*/#define \1 1\ /g' >> confdefs.h changequote([,]) AC_SUBST(CC) AC_SUBST(OPT) AC_SUBST(LDFLAGS) AC_SUBST(DEFS) AC_SUBST(LIBS) AC_SUBST(LIBM) AC_SUBST(LIBC) AC_SUBST(RANLIB) AC_SUBST(MACHDEP) AC_SUBST(SO) AC_SUBST(LDSHARED) AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) AC_SUBST(PREFIX) AC_SUBST(EXEC_PREFIX) AC_SUBST(LINKCC) AC_SUBST(SGI_ABI) AC_SUBST(LDLAST) AC_SUBST(SET_CCC) AC_MSG_RESULT(done) ]) dnl Find the install program, without making the user include install-sh in dnl their package -- most systems have it, and a copy of install-sh comes dnl with newer (>=1.5) python distributions AC_DEFUN(PY_CHECK_INSTALL, [AC_REQUIRE([PY_PYTHON_VERSION]) AC_REQUIRE([PY_PYTHON_EXEC_PREFIX]) if test -x "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/install-sh"; then INSTALL="$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/install-sh" AC_SUBST(INSTALL) else AC_PATH_PROG(INSTALL, install, install) fi]) dnl find the python module library (makes sure directory is in python's search dnl path). AC_DEFUN(PY_LIB_DIR, [AC_REQUIRE([PY_PROG_PYTHON]) AC_REQUIRE([PY_PYTHON_PREFIX]) AC_REQUIRE([PY_PYTHON_VERSION]) AC_MSG_CHECKING(location of python library) AC_CACHE_VAL(py_cv_python_library_dir, dnl [py_cv_python_library_dir=`$PYTHON -c " import sys, os for dir in ('/lib/site-python', '/lib/python${PYTHON_VERSION}/site-packages', '/lib/python${PYTHON_VERSION}'): if os.path.isdir(sys.prefix+dir) and (sys.prefix+dir) in sys.path: print dir break"`]) PYTHON_LIBRARY_DIR="\$(prefix)$py_cv_python_library_dir" AC_MSG_RESULT($PYTHON_LIBRARY_DIR) AC_SUBST(PYTHON_LIBRARY_DIR) ]) dnl find the python shared modules directory (makes sure directory is in dnl python's search path) AC_DEFUN(PY_MOD_DIR, [AC_REQUIRE([PY_PROG_PYTHON]) AC_REQUIRE([PY_PYTHON_PREFIX]) AC_REQUIRE([PY_PYTHON_VERSION]) AC_MSG_CHECKING(location of python shared modules) AC_CACHE_VAL(py_cv_python_module_dir, dnl [py_cv_python_module_dir=`$PYTHON -c " import sys, os for dir in ('/lib/python${PYTHON_VERSION}/site-packages', '/lib/python${PYTHON_VERSION}/lib-dynload', '/lib/python${PYTHON_VERSION}/sharedmodules', '/lib/site-python', '/lib/python${PYTHON_VERSION}'): if os.path.isdir(sys.exec_prefix+dir) and (sys.exec_prefix+dir) in sys.path: print dir break"`]) PYTHON_MODULE_DIR="\$(exec_prefix)$py_cv_python_module_dir" AC_MSG_RESULT($PYTHON_MODULE_DIR) AC_SUBST(PYTHON_MODULE_DIR) ]) dnl make FILE from FILE.pre.in using config.status and makesetup dnl PY_OUTPUT(Makefile, Setup ..., [others]) dnl where `Makefile' is the base of the Makefile.pre.in file, the second dnl argument gives Setup.in type files (without the .in), and the third dnl argument gives extra files you want to expand @var@ macros in. AC_DEFUN(PY_OUTPUT, [AC_REQUIRE([PY_INIT]) AC_OUTPUT($2 $3 $1.pre,dnl [echo creating $1 $MAKESETUP -m $1.pre -c - $2],dnl [MAKESETUP="${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/config/makesetup" ]) ]) dnl ---------------------------------------------------------------------- dnl These functions are used similar to AC_CHECK_LIB and associates. dnl PY_CHECK_MOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) dnl Check if a module containing a given symbol is visible to python. AC_DEFUN(PY_CHECK_MOD, [AC_REQUIRE([PY_PROG_PYTHON]) py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ if $PYTHON -c 'import $1 ifelse([$2],[],,[; $1.$2])' 1>&AC_FD_CC 2>&AC_FD_CC; then eval "py_cv_mod_$py_mod_var=yes" else eval "py_cv_mod_$py_mod_var=no" fi ]) py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` if test "x$py_val" != xno; then AC_MSG_RESULT(yes) ifelse([$3], [],, [$3 ])dnl else AC_MSG_RESULT(no) ifelse([$4], [],, [$4 ])dnl fi ]) python-pqueue-0.2.orig/pqueuemodule.c0100644000175000000500000004706707034365136016674 0ustar quangosrc/* * pqueue - A priority-queue extension for Python using Fibonacci heaps. * Copyright (C) 1999 Andrew Snare * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* Note to developers :- * Fibonnaci heaps are nasty. Do _NOT_ attempt to debug this code * unless you really really know what you're doing and have a copy * of "Introduction to Algorithms" (Thomas Cormen et al) by your side. */ #include "pqueuemodule-config.h" #include #include #include #define MAXDEG (64) /* Maximum degree of any node */ /* NOTE: This allows us to handle ~ 2.3723E13 nodes */ #undef DEBUG /* Turns on debugging stuff */ struct heapnodeRec { struct heapnodeRec *p; /* Pointer to the parent */ struct heapnodeRec *child; /* Pointer to any of the children */ struct heapnodeRec *left; /* Pointer to the left sibling */ struct heapnodeRec *right; /* Pointer to the right sibling */ int degree; /* How many children we have */ int mark; /* Lost child since last made child */ PyObject *priority; /* Priority associated with node */ PyObject *data; /* Data associated with the node */ }; typedef struct heapnodeRec heapnode; struct heapnodetrampRec { heapnode *ptr; /* Trampoline pointer */ int refcount; /* Reference counter */ }; typedef struct heapnodetrampRec heapnodetramp; typedef struct { PyObject_HEAD heapnode *min; /* Pointer to current minimum */ int n; /* Number of nodes in the pq */ PyObject *dict; /* Dictionary of data */ } pqueueobject; staticforward PyTypeObject PQueuetype; /* PQueue -- some debugging routines */ #ifdef DEBUG #define LONG(x) (PyInt_AS_LONG((x)->priority)) static void display_children(child, level, parent) heapnode *child; int level; heapnode *parent; { /* This is a debugging routine. It displays a child list recursively */ if (child) { heapnode *w = child; do { PyObject* priority = PyObject_Repr(w->priority); PyObject* data = PyObject_Repr(w->data); printf("%*s%#x P(%#x) L(%#x) R(%#x) D(%d) M(%d) " "(%s, %s) %#x", level*4, "", w, w->p, w->left, w->right, w->degree, w->mark, PyString_AS_STRING(priority), PyString_AS_STRING(data), w->child); Py_DECREF(priority); Py_DECREF(data); if (w->child ) { printf(" -> \n"); display_children(w->child, level+1, w); } else printf("\n"); #ifdef DEBUG assert( w->p == parent ); #endif /* DEBUG */ w = w->right; } while (child != w); } } static void display_pqueue(self) pqueueobject *self; { /* This is a debugging routine. Attempt to display the heap as best as we can. */ printf("PQueue at %#x with %d nodes.\n", self, self->n); if (self->min != NULL) { heapnode *x; printf("Min -> %#x\n", self->min); display_children(self->min, 1, NULL); } } static int check_children(child,level) heapnode *child; int level; { heapnode *w = child; heapnode *p = child->p; int count = 0; int degree = 0; do { int result; printf("%*sNow checking: %#x-[%ld]\n", level*4, "", w,LONG(w)); /* Check the parent link is correct */ if (p != w->p) printf("%*s%#x-[%ld]'s parent-link not intact -> %#x-[%ld]\n", level*4, "", w, LONG(w), w->p, LONG(w->p)); /* Check the left link */ if (w->left->right != w) printf("%*s-L-> %#x-[%ld] -R-> %#x-[%ld]\n", level*4,"", w->left, LONG(w->left), w->left->right, LONG(w->left->right)); /* Check the right link */ if (w->right->left != w) printf("%*s-R-> %#x-[%ld] -L-> %#x-[%ld]\n", level*4,"", w->right, LONG(w->right), w->right->left, LONG(w->left->right)); /* Check the heap condition */ if (w->p != NULL) { PyObject_Cmp(w->priority, w->p->priority, &result); if (result < 0) printf("%*sHeap-condition violated: %#x-[%ld] > %#x-[%ld]\n", level*4,"", w->p,LONG(w->p), w,LONG(w)); } /* Recur to children if they're present */ if (w->child) { printf("%*s(should have %d children -> %#x-[%ld])\n", level*4, "", w->degree,w->child,LONG(w->child)); if( w->child->p != w ) printf("%*s(doesn't point back -> %#x-[%ld])\n", level*4,"",w->child->p,LONG(w->child->p)); count += check_children(w->child, level+1); } degree++; w = w->right; } while (w != child); /* Assert the degree was correct */ if( w->p == NULL ) printf("%*s(no parent, degree information unchecked)\n", level*4, ""); else if (degree != w->p->degree) printf("%*s(%d children, %d expected from parent)\n", level*4, "", degree, w->p->degree); count += degree; return count; } static void check_heap(pqp) pqueueobject *pqp; { if (pqp->min != NULL) { int count = check_children(pqp->min,0); if (count == pqp->n) printf("Hmm... %d nodes expected and accounted for.\n", pqp->n); else printf("Doh! %d nodes expected, only %d found.\n", pqp->n, count); } } #endif /* DEBUG */ /* PQueue -- C API -- Constructor */ #define is_pqueueobject(v) ((v)->ob_type == &PQueuetype) static pqueueobject * pqueue_new() { pqueueobject *pqp; pqp = PyObject_NEW(pqueueobject, &PQueuetype); if (pqp == NULL) return NULL; /* Allocate the dictionary */ pqp->dict = PyDict_New(); if (pqp->dict == NULL) return NULL; /* No minimum to start off with (and also no nodes) */ pqp->min = NULL; pqp->n = 0; return pqp; } /* PQueue methods */ static void children_dealloc(child) heapnode *child; { child->left->right = NULL; do { heapnode *x = child; if (x->child != NULL) { x->child->left->right = x->right; x->right = x->child; } Py_DECREF(x->priority); Py_DECREF(x->data); child = child->right; free(x); } while( child != NULL ); } static void pqueue_dealloc(pqp) pqueueobject *pqp; { Py_DECREF(pqp->dict); if(pqp->min != NULL) children_dealloc(pqp->min); PyMem_DEL(pqp); } static PyObject * pqueue_insert(self, args) pqueueobject *self; PyObject *args; { PyObject *priority, *data, *ptr; heapnode *x; heapnodetramp *tramp; int newmin, newdata; /* Check the parameters first */ if (!PyArg_ParseTuple(args, "OO:insert", &priority, &data)) return NULL; /* Retrieve the data if it already exists */ ptr = PyDict_GetItem(self->dict, data); if ((ptr == NULL) && (PyErr_Occurred() != NULL)) return NULL; /* Do the comparison early on to detect errors early */ Py_INCREF(priority); Py_INCREF(data); if (self->min != NULL) { if(PyObject_Cmp(self->min->priority, priority, &newmin) == -1){ PyErr_SetString(PyExc_ValueError, "unable to compare priority"); Py_DECREF(priority); Py_DECREF(data); return NULL; } } /* Then try and allocate the node */ if (NULL == (x = malloc(sizeof(heapnode)))) { PyErr_NoMemory(); Py_DECREF(priority); Py_DECREF(data); return NULL; } /* Now make the CObject and put it in the dictionary (if need be) */ if (ptr == NULL) { PyObject *cobject; tramp = malloc(sizeof(heapnodetramp)); cobject = PyCObject_FromVoidPtr(tramp, free); if ((tramp == NULL) || (cobject == NULL) || (PyDict_SetItem(self->dict, data, cobject) == -1)) { /* If things failed, clean up and go home */ Py_XDECREF(cobject); Py_DECREF(priority); Py_DECREF(data); free(x); if (tramp != NULL) free(tramp); return NULL; } Py_DECREF(cobject); /* Since PyDict_SetItem borrows */ tramp->ptr = x; tramp->refcount = 1; } else { tramp = (heapnodetramp*)PyCObject_AsVoidPtr(ptr); /* CObject already exists, increment the counter */ tramp->ptr = NULL; tramp->refcount++; } /* Initialize the node structure */ x->degree = 0; x->p = NULL; x->child = NULL; x->mark = 0; x->priority = priority; x->data = data; /* Insert the node into the root list */ if (self->min == NULL) { self->min = x->left = x->right = x; } else { x->right = self->min; x->left = self->min->left; self->min->left->right = x; self->min->left = x; if (newmin > 0) { self->min = x; } } self->n++; /* We return None to indicate success */ Py_INCREF(Py_None); return Py_None; } static PyObject * pqueue_peek(self, args) pqueueobject *self; PyObject *args; { /* Check the parameters first */ if (!PyArg_ParseTuple(args, ":peek")) return NULL; /* If empty, return an error */ if (self->min == NULL) { PyErr_SetString(PyExc_IndexError, "nothing in the queue"); return NULL; } /* Return a tuple of the current min node */ return Py_BuildValue("OO", self->min->priority, self->min->data); } static inline void consolidate(self) pqueueobject *self; { #ifdef DEBUG printf("Starting consolidate()\n"); #endif /* DEBUG */ if (self->min != NULL) { int i; heapnode *A[MAXDEG]; memset(A, 0, sizeof(heapnode*)*MAXDEG); /* We break the link to detect when we've gone through all the nodes. This can be done since we only remove nodes and never insert them. */ self->min->left->right = NULL; do { heapnode *x = self->min; int d = x->degree; /* Advance to the next one while we can */ self->min = self->min->right; #ifdef DEBUG printf("Looking at %#x-[%ld] (d=%d).\n", x, LONG(x), d); #endif /* DEBUG */ while( A[d] != NULL ) { int cmpresult; heapnode *y = A[d]; #ifdef DEBUG printf("Doh! %#x-[%ld] already has d=%d.\n", y, LONG(y), d); #endif /* DEBUG */ /* This _should_ never fail? */ PyObject_Cmp(x->priority, y->priority, &cmpresult); if (cmpresult > 0) { heapnode *t = x; x = y; y = t; #ifdef DEBUG printf("(and we're bigger)\n"); #endif /* DEBUG */ } /* Make y a child of x */ #ifdef DEBUG printf("Making %#x-[%ld] a child of %#x-[%ld].\n", y, LONG(y), x, LONG(x)); #endif /* DEBUG */ y->p = x; if (x->child == NULL) x->child = y->left = y->right = y; else { y->right = x->child; y->left = x->child->left; x->child->left->right = y; x->child->left = y; } x->degree++; /* Mark y as having been made a child */ y->mark = 0; A[d++] = NULL; } A[d] = x; #ifdef DEBUG printf("Storing %#x-[%ld] at d=%d.\n", x, LONG(x), d); #endif /* DEBUG */ } while (self->min != NULL); #ifdef DEBUG printf("Time to build the root list....\n"); #endif /* DEBUG */ for(i=0; imin == NULL) { self->min = A[i]->left = A[i]->right = A[i]; } else { int newmin; A[i]->right = self->min; A[i]->left = self->min->left; self->min->left->right = A[i]; self->min->left = A[i]; /* Check to see if we have a new min */ PyObject_Cmp(self->min->priority, A[i]->priority, &newmin); if (newmin > 0) { self->min = A[i]; } } } } } static PyObject * pqueue_pop(self, args) pqueueobject *self; PyObject *args; { PyObject *ret; heapnode *min; heapnode *child; heapnodetramp *tramp; /* Check the parameters first */ if (!PyArg_ParseTuple(args, ":pop")) return NULL; /* Enter the debugger... */ /* raise(SIGTRAP); */ #ifdef DEBUG check_heap(self); #endif /* DEBUG */ min = self->min; /* If empty, return an error */ if (min == NULL) { PyErr_SetString(PyExc_IndexError, "nothing in the queue"); return NULL; } #ifdef DEBUG printf("Removing min from the root list...\n"); #endif /* DEBUG */ /* Remove the children of the min-node and put them on root list */ child = min->child; if (child != NULL) { heapnode *c = child; /* Set each child to have no parent */ do { c->p = NULL; c = c->right; } while(c != child); /* Now put the child-list on the root list */ min->left->right = child; child->left->right = min; c = child->left; child->left = min->left; min->left = c; } /* Now pull the min-node out of the root list */ min->left->right = min->right; min->right->left = min->left; /* Check if we're the only node in the root list */ if (min == min->right) self->min = NULL; else { self->min = min->right; #ifdef DEBUG check_heap(self); #endif /* DEBUG */ consolidate(self); } self->n--; /* Reduce the refcount for the data */ tramp = PyCObject_AsVoidPtr(PyDict_GetItem(self->dict, min->data)); if (--(tramp->refcount) == 0) { PyDict_DelItem(self->dict, min->data); } /* Build the return tuple, and de-allocate the node */ ret = Py_BuildValue("OO", min->priority, min->data); Py_DECREF(min->priority); Py_DECREF(min->data); free(min); return ret; } #ifdef DEBUG static PyObject * pqueue_display(self, args) pqueueobject *self; PyObject *args; { /* Check the parameters first */ if (!PyArg_ParseTuple(args, ":display")) return NULL; display_pqueue(self); Py_INCREF(Py_None); return Py_None; } #endif /* DEBUG */ static PyMethodDef pqueue_methods[] = { {"insert", (PyCFunction)pqueue_insert, METH_VARARGS}, {"peek", (PyCFunction)pqueue_peek, METH_VARARGS}, {"pop", (PyCFunction)pqueue_pop, METH_VARARGS}, #ifdef DEBUG {"display", (PyCFunction)pqueue_display, METH_VARARGS}, #endif /* DEBUG */ {NULL, NULL} /* Sentinel */ }; static int pqueue_length(pqp) pqueueobject *pqp; { return pqp->n; } static PyObject * pqueue_subscript(pqp, key) pqueueobject *pqp; PyObject *key; { heapnode *hp; heapnodetramp *tramp; PyObject *cobject = PyDict_GetItem(pqp->dict, key); if ((cobject == NULL) || ((tramp = PyCObject_AsVoidPtr(cobject))->ptr == NULL)) { PyErr_SetObject(PyExc_KeyError, key); return NULL; } hp = tramp->ptr; Py_INCREF(hp->priority); return hp->priority; } static inline void cut(pqp, x, y) pqueueobject *pqp; heapnode *x, *y; { #ifdef DEBUG printf("Starting cut()\n"); #endif /* DEBUG */ /* Remove x from the child list of y */ if (x->right == x) /* Only child */ y->child = NULL; else { if (y->child == x) /* Is it worth doing this test? */ y->child = x->right; x->right->left = x->left; x->left->right = x->right; } y->degree--; /* Put x on the root list */ x->left = pqp->min->left; x->right = pqp->min; pqp->min->left->right = x; pqp->min->left = x; x->p = NULL; x->mark = 0; } static void cascading_cut(pqp, y) pqueueobject *pqp; heapnode *y; { heapnode *z = y->p; #ifdef DEBUG printf("Starting cascading_cut()\n"); #endif /* DEBUG */ if (z != NULL) { if (y->mark == 0) y->mark = 1; else { cut(pqp, y, z); cascading_cut(pqp, z); } } } static int decrease_key(pqp, x, priority) pqueueobject *pqp; heapnode *x; PyObject *priority; { /* Assume we've already checked that x->priority <= priority */ int result = -1; heapnode *y = x->p; #ifdef DEBUG printf("Starting decrease_key()\n"); #endif /* DEBUG */ if (y != NULL) { if ((priority != NULL) && (PyObject_Cmp(priority, y->priority, &result) == -1)) { Py_DECREF(priority); PyErr_SetString(PyExc_ValueError, "unable to compare value"); return -1; } } /* Throw away the old priority now */ Py_DECREF(x->priority); x->priority = priority; /* If we need to move the node up the tree, do it */ if ((y != NULL) && (result < 0)) { cut(pqp,x,y); cascading_cut(pqp,y); } /* If we have a new minimum, make note of it */ if (priority != NULL) PyObject_Cmp(x->priority, pqp->min->priority, &result); if (result < 0) pqp->min = x; return 0; } static inline int delete_key(pqp, x) pqueueobject *pqp; heapnode *x; { PyObject *min; /* Now do a reduce on it */ decrease_key(pqp, x, NULL); /* NULL == -infinity */ /* Now put in the Py_None for the priority */ Py_INCREF(Py_None); x->priority = Py_None; /* Now do the extract-min to remove the same element */ min = pqueue_pop(pqp, PyTuple_New(0)); if (min == NULL) return -1; /* Throw away the result */ Py_DECREF(min); return 0; } static int pqueue_ass_sub(pqp, data, priority) pqueueobject *pqp; PyObject *data, *priority; { int result; heapnode *hp; heapnodetramp *tramp; PyObject *cobject = PyDict_GetItem(pqp->dict, data); /* Check we could find the node they're referring to */ if ((cobject == NULL) || ((tramp = PyCObject_AsVoidPtr(cobject))->ptr == NULL)) { if (priority == NULL) { /* Deleting non-existent node */ PyErr_SetObject(PyExc_KeyError, data); return -1; } else { /* Setting non-existent node */ /* Turn the set into an insert() */ PyObject *ret = pqueue_insert(pqp, Py_BuildValue("OO", priority, data)); if (ret == NULL) return -1; Py_DECREF(ret); return 0; } } /* Find the node they're talking about */ hp = tramp->ptr; /* Check if we're doing a deletion */ if (priority == NULL) { return delete_key(pqp, hp); } /* Next check they're reducing the key */ if (PyObject_Cmp(priority, hp->priority, &result) == -1) { PyErr_SetString(PyExc_ValueError, "unable to compare value"); return -1; } else if (result > 0) { /* New key is greater than old. Do a delete/insert. */ int ret = delete_key(pqp, hp); if (ret != 0) return ret; else { PyObject *ret = pqueue_insert(pqp, Py_BuildValue("OO", priority, data)); if (ret == NULL) return -1; Py_DECREF(ret); return 0; } } #ifdef DEBUG check_heap(pqp); #endif /* DEBUG */ /* Take ownership of the new priority, and assign it to the node */ Py_INCREF(priority); return decrease_key(pqp, hp, priority); } static PyMappingMethods pqueue_as_mapping = { (inquiry)pqueue_length, /* mp_length */ (binaryfunc)pqueue_subscript, /* mp_subscript */ (objobjargproc)pqueue_ass_sub, /* mp_ass_subscript */ }; static PyObject * pqueue_getattr(pqp, name) pqueueobject *pqp; char *name; { return Py_FindMethod(pqueue_methods, (PyObject *)pqp, name); } static int pqueue_setattr(pqp, name, v) pqueueobject *pqp; char *name; PyObject *v; { PyErr_SetString(PyExc_AttributeError, "can't modify pqueue attributes"); return -1; } static char PQueuetype_Type__doc__[] = "Priority queues are used as a FIFO buffer, but with the difference that\n\ items in the queue have a priority associated with them. The item with the\n\ lowest priority is always extracted from the list first.\n"; static PyTypeObject PQueuetype = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "pqueue", /* tp_name */ sizeof(pqueueobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)pqueue_dealloc, /* tp_dealloc */ 0, /* tp_print */ (getattrfunc)pqueue_getattr, /* tp_getattr */ (setattrfunc)pqueue_setattr, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ &pqueue_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0L,0L,0L,0L, /* future expansion */ PQueuetype_Type__doc__ /* Documentation string */ }; /* PQueue -- Python API -- Constructor */ static PyObject * pqueue_PQueue(self, args) PyObject *self; PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; return (PyObject *)pqueue_new(); } static PyMethodDef PQueueMethods[] = { {"PQueue", (PyCFunction)pqueue_PQueue, METH_VARARGS}, {NULL, NULL} /* Sentinel */ }; void initpqueue() { (void) Py_InitModule("pqueue", PQueueMethods); } python-pqueue-0.2.orig/configure.in0100644000175000000500000000017606742635370016322 0ustar quangosrcAC_INIT(pqueuemodule.c) AC_CONFIG_HEADER(pqueuemodule-config.h) PY_INIT AC_C_INLINE AC_HEADER_STDC PY_OUTPUT(Makefile, Setup) python-pqueue-0.2.orig/Setup.in0100644000175000000500000000003706741347044015432 0ustar quangosrc*shared* pqueue pqueuemodule.c python-pqueue-0.2.orig/configure0100755000175000000500000013224006742635476015725 0ustar quangosrc#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --with-python=CMD name of python executable" ac_help="$ac_help --with-python-version=VERSION overide guessed python version" ac_help="$ac_help --with-python-prefix=DIR override the prefix for python" ac_help="$ac_help --with-python-exec-prefix=DIR override the exec prefix for python" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=pqueuemodule.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # Check whether --with-python or --without-python was given. if test "${with_python+set}" = set; then withval="$with_python" : else with_python=no fi if test "x$with_python" != xno && test -x "$with_python"; then echo $ac_n "checking for python""... $ac_c" 1>&6 echo "configure:547: checking for python" >&5 PYTHON="$with_python" echo "$ac_t""$PYTHON" 1>&6 else # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:555: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PYTHON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$PYTHON" in /*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_PYTHON="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON="$ac_cv_path_PYTHON" if test -n "$PYTHON"; then echo "$ac_t""$PYTHON" 1>&6 else echo "$ac_t""no" 1>&6 fi fi # Check whether --with-python-version or --without-python-version was given. if test "${with_python_version+set}" = set; then withval="$with_python_version" : else with_python_version=no fi if test "x$with_python_version" != xno; then PYTHON_VERSION="$with_python_version" fi echo $ac_n "checking python version""... $ac_c" 1>&6 echo "configure:602: checking python version" >&5 if test -z "$PYTHON_VERSION"; then if eval "test \"`echo '$''{'py_cv_python_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_cv_python_version=`$PYTHON -c 'import sys; print sys.version[:3]'` fi else py_cv_python_version="$PYTHON_VERSION" fi PYTHON_VERSION="$py_cv_python_version" echo "$ac_t""$PYTHON_VERSION" 1>&6 VERSION=$PYTHON_VERSION # Check whether --with-python-prefix or --without-python-prefix was given. if test "${with_python_prefix+set}" = set; then withval="$with_python_prefix" : else with_python_prefix=no fi if test "x$with_python_prefix" != xno; then PYTHON_PREFIX="$with_python_prefix" fi echo $ac_n "checking python installation prefix""... $ac_c" 1>&6 echo "configure:634: checking python installation prefix" >&5 if test -z "$PYTHON_PREFIX"; then if eval "test \"`echo '$''{'py_cv_python_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_cv_python_prefix=`$PYTHON -c 'import sys; print sys.prefix'` fi else py_cv_python_prefix="$PYTHON_PREFIX" fi PYTHON_PREFIX="$py_cv_python_prefix" echo "$ac_t""$PYTHON_PREFIX" 1>&6 prefix=$PYTHON_PREFIX # Check whether --with-python-prefix or --without-python-prefix was given. if test "${with_python_prefix+set}" = set; then withval="$with_python_prefix" : else with_python_exec_prefix=no fi if test "x$with_python_exec_prefix" != xno; then PYTHON_EXEC_PREFIX="$with_python_exec_prefix" fi echo $ac_n "checking python installation exec_prefix""... $ac_c" 1>&6 echo "configure:663: checking python installation exec_prefix" >&5 if test -z "$PYTHON_EXEC_PREFIX"; then if eval "test \"`echo '$''{'py_cv_python_exec_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_cv_python_exec_prefix=`$PYTHON -c 'import sys; print sys.exec_prefix'` fi else py_cv_python_exec_prefix="$PYTHON_EXEC_PREFIX" fi PYTHON_EXEC_PREFIX="$py_cv_python_exec_prefix" echo "$ac_t""$PYTHON_EXEC_PREFIX" 1>&6 exec_prefix=$PYTHON_EXEC_PREFIX echo $ac_n "checking definitions in Python library makefile""... $ac_c" 1>&6 echo "configure:682: checking definitions in Python library makefile" >&5 if eval "test \"`echo '$''{'py_cv_python_makefile_vars'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_makefile="${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/config/Makefile" py_cv_python_makefile_LINKCC='' py_cv_python_makefile_SGI_ABI='' py_cv_python_makefile_LDLAST='' py_cv_python_makefile_SET_CCC='' eval `sed -n \ -e '/^CC=/ s/CC=[ ]*\(.*\)/py_cv_python_makefile_CC='\''\1'\''/p' \ -e '/^OPT=/ s/OPT=[ ]*\(.*\)/py_cv_python_makefile_OPT='\''\1'\''/p' \ -e '/^LDFLAGS=/ s/LDFLAGS=[ ]*\(.*\)/py_cv_python_makefile_LDFLAGS='\''\1'\''/p' \ -e '/^DEFS=/ s/DEFS=[ ]*\(.*\)/py_cv_python_makefile_DEFS='\''\1'\''/p' \ -e '/^LIBS=/ s/LIBS=[ ]*\(.*\)/py_cv_python_makefile_LIBS='\''\1'\''/p' \ -e '/^LIBM=/ s/LIBM=[ ]*\(.*\)/py_cv_python_makefile_LIBM='\''\1'\''/p' \ -e '/^LIBC=/ s/LIBC=[ ]*\(.*\)/py_cv_python_makefile_LIBC='\''\1'\''/p' \ -e '/^RANLIB=/ s/RANLIB=[ ]*\(.*\)/py_cv_python_makefile_RANLIB='\''\1'\''/p' \ -e '/^MACHDEP=/ s/MACHDEP=[ ]*\(.*\)/py_cv_python_makefile_MACHDEP='\''\1'\''/p' \ -e '/^SO=/ s/SO=[ ]*\(.*\)/py_cv_python_makefile_SO='\''\1'\''/p' \ -e '/^LDSHARED=/ s/LDSHARED=[ ]*\(.*\)/py_cv_python_makefile_LDSHARED='\''\1'\''/p' \ -e '/^CCSHARED=/ s/CCSHARED=[ ]*\(.*\)/py_cv_python_makefile_CCSHARED='\''\1'\''/p' \ -e '/^LINKFORSHARED=/ s/LINKFORSHARED=[ ]*\(.*\)/py_cv_python_makefile_LINKFORSHARED='\''\1'\''/p' \ -e '/^prefix=/ s/prefix=[ ]*\(.*\)/py_cv_python_makefile_PREFIX='\''\1'\''/p' \ -e '/^exec_prefix=/ s/exec_prefix=[ ]*\(.*\)/py_cv_python_makefile_EXEC_PREFIX='\''\1'\''/p' \ -e '/^LINKCC=/ s/LINKCC=[ ]*\(.*\)/py_cv_python_makefile_LINKCC='\''\1'\''/p' \ -e '/^SGI_ABI=/ s/SGI_ABI=[ ]*\(.*\)/py_cv_python_makefile_SGI_ABI='\''\1'\''/p' \ -e '/^LDLAST=/ s/LDLAST=[ ]*\(.*\)/py_cv_python_makefile_LDLAST='\''\1'\''/p' \ -e '/^CCC/ s/CCC=[ ]*\(.*\)/py_cv_python_makefile_SET_CCC='\''CCC=\1'\''/p' \ $py_makefile` py_cv_python_makefile_vars=found fi CC="$py_cv_python_makefile_CC" OPT="$py_cv_python_makefile_OPT" LDFLAGS="$py_cv_python_makefile_LDFLAGS" DEFS="$py_cv_python_makefile_DEFS" LIBS="$py_cv_python_makefile_LIBS" LIBM="$py_cv_python_makefile_LIBM" LIBC="$py_cv_python_makefile_LIBC" RANLIB="$py_cv_python_makefile_RANLIB" MACHDEP="$py_cv_python_makefile_MACHDEP" SO="$py_cv_python_makefile_SO" LDSHARED="$py_cv_python_makefile_LDSHARED" CCSHARED="$py_cv_python_makefile_CCSHARED" LINKFORSHARED="$py_cv_python_makefile_LINKFORSHARED" PREFIX="$py_cv_python_makefile_PREFIX" EXEC_PREFIX="$py_cv_python_makefile_EXEC_PREFIX" LINKCC="$py_cv_python_makefile_LINKCC" SGI_ABI="$py_cv_python_makefile_SGI_ABI" LDLAST="$py_cv_python_makefile_LDLAST" SET_CCC="$py_cv_python_makefile_SET_CCC" echo "$DEFS" | sed \ -e 's/-D\([^ =]*\)=\([^ ]*\)[ ]*/#define \1 \2\ /g' \ -e 's/-D\([^ =]*\)[ ]*/#define \1 1\ /g' >> confdefs.h echo "$ac_t""done" 1>&6 if test -x "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/install-sh"; then INSTALL="$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/install-sh" else # Extract the first word of "install", so it can be a program name with args. set dummy install; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:774: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_INSTALL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$INSTALL" in /*) ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_INSTALL="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_INSTALL" && ac_cv_path_INSTALL="install" ;; esac fi INSTALL="$ac_cv_path_INSTALL" if test -n "$INSTALL"; then echo "$ac_t""$INSTALL" 1>&6 else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking location of python library""... $ac_c" 1>&6 echo "configure:812: checking location of python library" >&5 if eval "test \"`echo '$''{'py_cv_python_library_dir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_cv_python_library_dir=`$PYTHON -c " import sys, os for dir in ('/lib/site-python', '/lib/python${PYTHON_VERSION}/site-packages', '/lib/python${PYTHON_VERSION}'): if os.path.isdir(sys.prefix+dir) and (sys.prefix+dir) in sys.path: print dir break"` fi PYTHON_LIBRARY_DIR="\$(prefix)$py_cv_python_library_dir" echo "$ac_t""$PYTHON_LIBRARY_DIR" 1>&6 echo $ac_n "checking location of python shared modules""... $ac_c" 1>&6 echo "configure:833: checking location of python shared modules" >&5 if eval "test \"`echo '$''{'py_cv_python_module_dir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else py_cv_python_module_dir=`$PYTHON -c " import sys, os for dir in ('/lib/python${PYTHON_VERSION}/site-packages', '/lib/python${PYTHON_VERSION}/lib-dynload', '/lib/python${PYTHON_VERSION}/sharedmodules', '/lib/site-python', '/lib/python${PYTHON_VERSION}'): if os.path.isdir(sys.exec_prefix+dir) and (sys.exec_prefix+dir) in sys.path: print dir break"` fi PYTHON_MODULE_DIR="\$(exec_prefix)$py_cv_python_module_dir" echo "$ac_t""$PYTHON_MODULE_DIR" 1>&6 echo $ac_n "checking for inline""... $ac_c" 1>&6 echo "configure:863: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done fi echo "$ac_t""$ac_cv_c_inline" 1>&6 case "$ac_cv_c_inline" in inline | yes) ;; no) cat >> confdefs.h <<\EOF #define inline EOF ;; *) cat >> confdefs.h <&6 echo "configure:903: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:983: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir trap 'rm -fr `echo "Setup Makefile.pre pqueuemodule-config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@PYTHON@%$PYTHON%g s%@VERSION@%$VERSION%g s%@PYTHON_VERSION@%$PYTHON_VERSION%g s%@PYTHON_PREFIX@%$PYTHON_PREFIX%g s%@PYTHON_EXEC_PREFIX@%$PYTHON_EXEC_PREFIX%g s%@CC@%$CC%g s%@OPT@%$OPT%g s%@LIBM@%$LIBM%g s%@LIBC@%$LIBC%g s%@RANLIB@%$RANLIB%g s%@MACHDEP@%$MACHDEP%g s%@SO@%$SO%g s%@LDSHARED@%$LDSHARED%g s%@CCSHARED@%$CCSHARED%g s%@LINKFORSHARED@%$LINKFORSHARED%g s%@PREFIX@%$PREFIX%g s%@EXEC_PREFIX@%$EXEC_PREFIX%g s%@LINKCC@%$LINKCC%g s%@SGI_ABI@%$SGI_ABI%g s%@LDLAST@%$LDLAST%g s%@SET_CCC@%$SET_CCC%g s%@INSTALL@%$INSTALL%g s%@PYTHON_LIBRARY_DIR@%$PYTHON_LIBRARY_DIR%g s%@PYTHON_MODULE_DIR@%$PYTHON_MODULE_DIR%g s%@CPP@%$CPP%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF echo creating Makefile $MAKESETUP -m Makefile.pre -c - Setup exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 python-pqueue-0.2.orig/COPYING0100644000175000000500000006126106741350106015034 0ustar quangosrc GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! python-pqueue-0.2.orig/config.h0100644000175000000500000000007006742635472015423 0ustar quangosrc/* config.h. Generated automatically by configure. */ python-pqueue-0.2.orig/benchmark.py0100755000175000000500000000717506743062175016324 0ustar quangosrc#!/usr/bin/env python """ Tests the PQueue implementation a little bit. """ import pqueue import pq3 from time import clock import whrandom benchdefault = 100000 def generatetestset(num=benchdefault): print "Generating", num, "random (priority, data) pairs....", start = clock() testset = [] for x in xrange(num): testset.append((whrandom.randint(0,num),x,)) stop = clock() print "done --", stop-start, "seconds." return testset def testinsert(pq, testset): print "Inserting into the priority queue....", insert = 0 for priority,data in testset: start = clock() pq.insert(priority, data) stop = clock() insert = insert + stop-start print "done --", insert, "seconds." return def testextract(pq, testset, reduceset=None): if reduceset: print "Reducing/extracting from the queue....", else: print "Extracting from the priority queue....", extract = 0 reduce = 0 reducecount = 0 copyt = testset[:] out = [] maxtest = len(testset)-1 for x in testset: start = clock() try: out.append(pq.pop()) except IndexError: break stop = clock() extract = extract + stop-start if reduceset: index = whrandom.randint(0,maxtest) data = copyt[index][1] try: newpriority = pq[data] / 2 except KeyError: continue reducecount = reducecount + 1 copyt[index] = (newpriority,data) start = clock() pq[data] = newpriority stop = clock() reduce = reduce + stop-start if reduceset: print "done *", reducecount, "--", reduce, "/", extract, "seconds." else: print "done --", extract, "seconds." print "Checking the results....", copyt.sort() if reduceset: out.sort() if copyt == out: print "hrm... data probably ok." else: print "doh... it looks screwed." else: f = lambda x:x[0] if map(f,copyt) == map(f,out): print "oooh... looking good...", if copyt == out: print "and stable!" else: print "unstable...", out.sort() if copyt == out: print "but data ok." else: print "and data buggered." else: print "doh... they look screwed:" def testpq(pq,nums,reduce=None): testinsert(pq,nums) testextract(pq,nums) if reduce: testinsert(pq,nums) testextract(pq,nums,reduce) def main(argv): benchsize = benchdefault if len(argv) > 1: import string try: benchsize = string.atoi(argv[1]) except ValueError: benchsize = benchdefault p = pqueue.PQueue() testset = generatetestset(benchsize) print "-"*20 print "Testing pqueue.PQueue:" testpq(p,testset,1) p = pq3.PQ0() # Kludge the PQ0 class to use the same method names p.insert = p.addelt p.pop = p.popsmallest print "-"*20 print "Testing pq3.PQ0:" testpq(p,testset) p = pq3.PQueue() # Kludge the PQ0 class to use the same method names p.insert = p.addelt p.pop = p.popsmallest print "-"*20 print "Testing pq3.PQueue:" testpq(p,testset) p = pq3.PQEquivBig() # Kludge the PQ0 class to use the same method names p.insert = p.addelt p.pop = p.popsmallest print "-"*20 print "Testing pq3.PQEquivBig:" testpq(p,testset) if __name__ == "__main__": import sys main(sys.argv) # End. python-pqueue-0.2.orig/pqueuemodule-config.h.in0100644000175000000500000000034706742633652020545 0ustar quangosrc/* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS python-pqueue-0.2.orig/pq3.py0100644000175000000500000001556006742277763015101 0ustar quangosrc """ classical priority queue it supports an arbitrary comparison function and is good for arbitrary length queues. Based on pq2.py, optimized (about 3-4x faster). """ from bisect import insort class PQ0: """priority queue using insertion sorting (bisect) This seems to be the fastest way, unless you want to use a different comparison metric, or unless the set grows *very* large. """ def __init__(self, comparison = cmp): if comparison!=cmp: raise ValueError, "only cmp comparison supported for PQ0" self.data = [] def empty(self): return len(self.data)==0 def addelt(self, priority, elt): item = (priority, elt) insort(self.data, item) def largestp(self): return self.data[-1] def poplargest(self): data = self.data item = data[-1] del data[-1] return item def popsmallest(self): data = self.data item = data[0] del data[0] return item class PQueue: """basic priority queue, using classical heap structure""" def __init__(self, comparison = cmp): self.cmp = comparison self.data = [None] * 8 # presize for 8 elements # first element is always empty, first used is 1, no data yet self.free = 1 def empty(self): """empty test""" return self.free == 1 def addelt(self, priority, elt): """add element by decreasing priority""" index = self.free try: self.data[ index ] = (priority, elt) except IndexError: # self.data is too small, double its size length = len( self.data ) newdata = [ None ] * (2 * length) # store the old values newdata[:length] = self.data self.data = newdata # now there ought to be room! self.data[ index ] = (priority, elt) self.free = index + 1 return self._checkposition(index) def popsmallest(self): """get/pop element with smallest priority""" if self.free < 2: raise IndexError, "priority queue is empty" smallest = self.data[1] self._removeentry(1) return smallest def _removeentry(self, index): """internal: remove an entry""" # restructure the "tree" if other elements remain free = self.free data = self.data last = free - 1 if last > index: data[index] = data[last] data[last] = None self.free = last self._checkposition(index) else: data[index] = None self.free = last def smallestp(self): """get (priority, element) for smallest priority""" return self.data[1] # make sure a position has contents larger than parents, # and smaller than children, and if not, do a swap # and check the new position recursively... # def _checkposition(self, index): data = self.data comparison = self.cmp thisitem = data[index] thispriority = thisitem[0] free = self.free if index>=2: # check parent, possibly bubble up parent = index/2 parentitem = data[parent] parentpriority = parentitem[0] if comparison(parentpriority, thispriority)>0: while 1: data[parent] = thisitem data[index] = parentitem index = parent if index<2: return index parent = index/2 parentitem = data[parent] parentpriority = parentitem[0] if comparison(parentpriority, thispriority)<=0: return index # otherwise, check children # find the highest priority child: while 1: thechild = index*2 if thechild>=free: return index childitem = data[thechild] childpriority = childitem[0] otherchild = thechild+1 if otherchild python-pqueue-0.2.orig/benchmark.pyc0100644000175000000500000000531506742275326016461 0ustar quangosrcN z7csdZkZkZklkZ dZ edZdZdZ 2dZ 6dZ He djoIk Z Je e indS( s/ Tests the PQueue implementation a little bit. i@ cs  dG|GdGt}g}x5t|dr"}|itid|q9Wt}dG||GdGH|SdS(Ns Generatingsrandom numbers....isdone --sseconds.( snumsclocksstartsnumberssxrangesxsappendswhrandomsrandintsstop(snumsstartsnumberssxsstops benchmark.pysgeneratenumbers s     csmdGt}x2|dr%}|i|tt}q"WdG||GdGHdSdS(Ns%Inserting into the priority queue....isdone --sseconds.(sclocksstartsnumssxspqsinsertsNonesstop(spqsnumssstartsxsstops benchmark.pys testinserts  cs dG!t}"g}#xM#doB$y%|i|idWn&tj o &PnXq%W't}(dG||GdGH*dG+|},|i -||jo .dGHn 0dGHdS( Ns&Extracting from the priority queue....iisdone --sseconds.sChecking the results....soooh... they look good.sdoh... they look screwed.( sclocksstartsoutsappendspqspops IndexErrorsstopsnumsscopynssort(spqsnumssstartsoutsstopscopyns benchmark.pys testextracts"       cs'23t||4t||dS(N(s testinsertspqsnumss testextract(spqsnumss benchmark.pystestpq2scs67t|djoF8k}9y:|i|d}Wn;tj o ;nXn<ti}=t |}>dGH?t ||At i }C|i|_D|i|_EdGHFt ||dS(NisTesting pqueue.PQueue:sTesting pq3.PQ0:(slensargvsstringsatois benchsizes ValueErrorspqueuesPQueuespsgeneratenumberssnumsstestpqspq3sPQ0saddeltsinserts poplargestspop(sargvsstrings benchsizespsnumss benchmark.pysmain6s  s__main__N(s__doc__spqueuespq3stimesclockswhrandoms benchsizesgeneratenumberss testinserts testextractstestpqsmains__name__ssyssargv(s benchmark.pys?s          python-pqueue-0.2.orig/benchmark.gif0100644000175000000500000012053306742511544016426 0ustar quangosrcGIF89a@@@@@@ `@` 0`@@@@``````@```` ``` @@ @` ```@ ```@@@``` @@ @```@@`p !, H*\ P` aaaaa!@@````@@@!aaaaaa@@`@@`@!aaaa a!b"c#d$e%f&f`def`a`fd`ad`a@d`bd``@@`@@`@@`@@`@@`@@`@@```@@@b@@` a``@@`@@`@a@@```@@!a`@@@`@a@@`@@`@`@@@````@``@@```@@!``@@`@@aa@@`@@`@@`@@`@@@ ` `@ ` a!b"c#d$e%ffa@@@``@@`@`@@`@@@@a@@`@@``a``b@a@@````@`@`a`@@````@@``aa ` @ @@ @@ @@ @@ @ @ @@@@@` @ @ @@@@@ @@@````` @ @@@`@ @ a!b"c#d$e%f&a`` @@@ ``@@@`@@@@`@`@``@@@@`@`@@@@ @``@``@`@@@` @``@ @ @ @`` @@@@ @@ ``@@@`` ` @@@ @@@ `@@@````@``@ a!b"c#d$e%fa`@@a`@@a`@@@@`@@a@ab``b@``@a``@`ab@aa``@aaa`@a`@`@@a`@@c `@@@ @ @ @ @@@@ @ @`` @`` @ @@ @` a!b"c#d$e%ffa`@@a`@`@`@@@@`@@@a```a``c``@@a``@`@@`a@aa``@aa``@@a@@@ `@@ ``@@ @`@@@@````@@@````@`@`````@`@` a!b"c#d$e%f&a@@@`@@```@@``@``@@@@a``@@@b@@`ca@@@a@@`@@`@@`@@b@aa@@`@@`a@@a@ab@@``@@@@@@@@@@ `@@``@@@`@@`@@```@@```@`@@`@`@@`@@```@@ a!b"c#d$e%f&gbcb(((((((((((((((((`@@hf a!b"c#d$e%f&g'h(i)j*k+l,m-n.o/p0q1r2s3t4u5v6w7x8y9ea:::::zb@`@:::::!@ABCDEFGHIJKLMNOPQCABCDEFGHIJKLMNIE@ABCÀDDDDBAA@A@ABCDEEEEEEEBÀEEŀŀĀEEEEEE"&* ,,..,.... ,...,,...$,.... ,.... ,.... ,.... ,.... ,.... ,.... ,,..,.... ,...,,....,....H@p1QQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP``qqqqqqqqqqqq` `qqqq0`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`@p1Qq1 221 22222222222222222222222q````p`` r`` Rqp 21 221 22222222222222222222222r`p``p r rq 22R@p00@p1Qq2Rr3Ssr`p``p``p@p``@p`p@p``@q`p```p```p``@p``@p````p`p``@p``s1 SSSSSSS r`p``````````@ppp`p`@p``p``p``@p@pPp`p`p``@ppp@pp@p 0PPPPPPPPPPPPPPpРPp```@p`p``p@P```P@ppp`p`p@p``p@P`@pp`pp`p`p``p@pP1q0@p1Qq2Rr3Ss@rp`p``p`p`p`q`p`pp@pppp`p`p``p2 @rp```@p``p@p``q`p`pp``@Pp`pp@p`p`p`p``p@p q0@p1Qq2Rr3Sss`rp```p``@p```p``@p`` q``@p`p@p```p``@pp``p```p``@p`p@2 SSSSSSS`Ѡs3@0@p1Q0`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP``qqqqqqqqqqq1`1`qqqq0@p1Qq2Rr3SsSѠS`2 SѠ32 3`s@P@pPpP0@p1Q0`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP`qqqqQP ````q1``q`qqqQ`Q1`qqqq0`qqqqQP`qqqqQP`qqqqQP`qqqqQP@p1QQP`qqqqQP`qqqqQP````@@`@`@``@`@`qq`q1`qqqq0@p1Qq2Rr3Ss````````@`@``@@pP@p 0@p1Qq2Rr3Ss @``@P`P@ppPPP```pp0@p1Q0@p1Qq2Rr3Ss ````````2 SSSSSSS @@@p`@@`@@````P00PPPPPPPP @          8HXhxH 8HXhx)9IYiy9h Y0XP0X XPXYЩX 9h Y0XP0XP0XX0XPP0XPP0XPP XPP XPPP0XP@XPP XPP Y 8HXhxH 8HXhx)9IYiy9h Y0XP0XP0XX0XP XP0XP0XPP X X`X0X0XPP XpX 8HXhxX 8HPXXXXXXXXXXHPXXXXXXXXXX((PXXXXXXXXXX((PXXXXXXXXXX((PXXXXXXXXXX((PXXXXXXXXXX((PXXXXXXXXXX((PXXXXXXXXXX(( hPXXXXXXXXPPPPP PP P (((P P P XP X (P 8X08X0X0XP0X08888P 8HXhx(8       hhXPX0XP0XP0X0X@X XPX`X`X0X0XP0XxX 8HXhx88 8HXhx)9IYiy `)YPXPP XPX0X0XP0XPPX`X X0X0X0XP0XX)  `)Y`XPP@XXPP X0X XPP0XPP XpXP XPP PPP X P 8HHXPXXXXX(PXXXXXXXXXXH 8HXhx)9IYiyi)XyYY9 `ɩYY9 `ɩYi9 8HXhx)9IYiyiəYy9h i```0h``@hh ( 8(h@HHHH8h@(h@HHHHHP@HHHHHHH8 8HXhxH 8HXhx)9IYiyi i0h`0h h`hhpi9X9 i h0h`0h`0hphPh0h```` h``0h``0h`` hh`````````` 8HX@HHHHHHHH 8HXhxH((((((((((((h h0h`0h`0hph```0h`0h@h` hPh`0h h`h0h0h`` hph 8HXhxh 8HPXXXXXXXXXXH 8HXhx)9IYiyi)i``` h0h`0hphph@h@h`h`````h`h0h0h`0hX  ( 8 8HXhx)9IYiyi)iPh0h`0hphph@h@hPh0h``h`h0h0h`0hpX0əh9iPh`` h`h`h`0h h`Ph h`````````` 8P@HHHHHHHH8 8HXhx8(8(8(8(8(8(h0(xh`h``@hh (`` ` 8h`` h``0``0h``0h`` h0h08X 8HXhxHx 0p ((   (    `  8HXhxhxXX(  ( 8HXhxPp 8HXhx)9IYiyiiɉYPpyhɉY00pyhyY0 a!b⢠⢠⢡bbab"a⢠⢠⢠⢠⢠⢠⢡""@ABBBBBBBBBBBBBBBBBB@ABCDĀ@ABCDEFGHIJKLIƒŃƒNNNNNNNNNNNNNNB@@AƒBƒBBAB@ABB@ABCDEFGHIJKLIǃƒÃAAAA@AAA@@ABCDEEEEEEEECEEEECEEEECEEEECEEEECEEEECEEEEDDÃÃÃEEEC@ABCDE€EAEAEAEAEAEAEBDÃE@@ABCDEEEE@ABCDEFGHIJKLHƒÃăÃNNNNNNNNNNNNNNA@@ABCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC@ABCDEFGHIJKLMHɃNNNNNNNNNNNNNNNNIENNNNNNNNNNNNNNNNNNHENNNNA !#%')+-/1357 48       !#%')+-/1357 28. 818989999999999999                       !#%')+-/1357        8'8989999999999995    !#%')+-/1357       "&* ,.... ,..", $",........,.... ,...."&*.26:>BFJNRVZ^bfjn.prrrJpr prprrrrrrrrrrrrbprrrNpr prprrrrrrrrrrrrb`&$$$ &$$& &&$$$&$$$ &$     *TPB $ 8HXhx8h(p00(0(pXhX8(8(8(8(8(8(8h(p00`    8H000 0P0  8HXhx8 8HXhx)9IYiyh00 0000@000 00 `00 p 8HXhx 8HPXXXXXXXXXXH 8HXhx)9IYiyh 0P00000000000 0 ( 80(X000 8HXhx( 8HXhx)9IYiyyhP0P000@ 00@00@ P`PX00099 h0)pP ( 00 00008880000(08 P000 8HXhx(x(x(x(x(x(x(hh(p`  (  0000 88 0 0 @8P0 0 8HXhx( 8HXhx)9IYiyih90Xə99iyIXə99i Yɩ9 a!b⢠"a"@"a⢠⢠⢠⢠⢠⢠"  aB!Baa! ࠠ!!!! a!ba"a a!b"c#d$e%fA  ' ¢¡¥''c'`''''''''''''gA      B   a!b`bb a!b"c#d$e%f榠        ¡  B B  ! a !@@aaaaaaaaaa!a@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa@aaaaaAaaa! B   `    a!b`bb⡀⡀⡀⡀⡀⡀"bB B     ¡B `   a!b`bb a!b"c#d$e%f&BB    ¢ B`    d'`''''''''''''      ࠂ     a!b``@@a@b a!b"c#d$e%f¢& b&ec``@bf&c`d@`a a!b⢠b⢠a`b@``!`  @ ` a!bb@`a a!b"c#d$e%ff&ded@`a&fdec``@bfb`#A@@ABCDEAEAEAEAEAEAEBEDEAEEEEE@ABCDEFGHIJKLMKMȂM̀€MKMȂM̀€JMȂ̀€AAAAAAL@ABCBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDCDDDDDDDDDDDDDDDD@ "&* ,*,.. ,.... ,.,. ,....B "&* ,.... ,.... ,.... ,.... ,.... ,.... ,&,.. ,.... ,.,. ,...*" @@@,...."&*.26:>BFJNRVZ^bfjFlnnn:lnn @@@lnlnnnnnnnnnnnnBlnnn:lnn lnlnnnnnnnnnnnnBlnnn6lnn" lnln ln ln "&* ,.... ,.... ,,.. ,.... ,.,.& ,..." ,....,.... ,.... ,.... ,.... ,.... ,.... ,,.. ,.... ,.  """""  """""""&*.26:>BFJNRVZ^bfj:lnnn6lnb"0lnlnnnnnnnnnnnn6lnnn6ln^" 4lnlnnnnnnnnnnnn6lnnn2lnZ" <lnln ln ln ln ln$,4BFJNRVZ^bfJhjjjh6" hjjhjhjjjjjjjjjjjjhjjjh2" hjjhjhjjjjjjjjjjjjhjjjh*" hjj&hjhj hj hj "&* ,.... ,... ,.... ,... ( ,. " ,.& ,.... ,....,.... ,.... ,.... ,.... ,.... ,... ,.... ,..., ,."" """""" """""""&*.26:>BFJNRVZ^bf>hjjjh" hjj>hjhjjjjjjjjjjjjhjjjh" hjjFhjhjjjjjjjjjjjjhjjjh" hjjNhjhj hj hj hj$ 8HXhx((Hh(((XH(H((H((((((((((8h(((XH(((h @         -(@p1Q0@p1Qq2Rr3@SSSs ASSS0@S0@SSSSSSSSSSS@SSSsASSS1@S0@SSSSSSSSSSS@SSSSASSSS1@S0@SP@SP@SP@S a!b""⢠b"⢠⢠"a⢠⢠⢠⢠⢠b⢠bb"⢠EI """&*.26:>BFJNRVZ^bfhjjj L" hjjj:J "&*.26:>BFJNRVZ^bfhjjj H" hjjj:*((Hh dhjjjjjjjjjjjBhjjj D" hjjj6*((Jh dhj hj hj hj hj h2H hj  "  *(  "   *(("&*.26:>BFJNRVZ^bfhjjj8" hjjj2*(0h "&*.26:>BFJNRVZ^bfhjjj4" hjjj2*(8h hhjjjjjjjjjjj6hjjj4"hjjj.*((@hhhj hj hj hj hj h"X hj \0" L hj$ 8HXhx8Hh     (hh( hXHX( (XH 8 8HXhH 8HXhx)9IYiyyi9X٨piiIX٨ii9Xɨ)y( 8HXhx((((((((h8(((XX(((8H 8 8HXhHpxxxxxxx pxxxxxxx pxxxxxxx pxxxxxxx pxxxxxxx pxxx(hpxxX(pxxxxxxx pxHXppxxx pxxxxxxx pxxpxxxHpxxx@pxxH 8HXhx)9IYiyIi)X`9i)XP)i)X@ y 8HXhx((((((((((hhh(((8X0H((((HH@((((((((H @ABCCCCCACBCACBAA@AB@ABCDEFGHIJKLHLALDLˀLÀLHCL̀LCAA@@@AAAAAAAAAAAAAAAAAAAAAAAAAAA@AA@ABCÀÀAAAAADCBADAĀD€ÀAD "&* ,.... ,.... ,. ,.* ,....  ,... ,.... *(,....,.." "&*.26:>BFJNRVZ^b6dff^" dfff*(df"dB "&*.26:>BFJNRVZ^b2dffZ" dfff*(df*df&dfffffffffff2dffR" dfff*((df2df&df df df df df Td* df df d^*( "&* ,....,.... ,.... ,.... ,.... ,.... ,&,.. ,.... ,...* ,...((($ ,.... ,."&*.26:>BFJNRVZ^b&dffF" dffb*(dfRd"ddfffffffffff&dff>" dff^*(dfZd"ddfffffffffff"dff:" dffV*((dfbd"ddf$,4BFJNRVZL" \^P*((\^^^^^^^^N\^6\^^^^^^^^^^H" \^P*(\^^^^^^^^Z\^6\^^^^^^^^^^ D" \^H*((\^^^^^^^^^"&*,.... ,.... ,.... ,.... ,.," , ,..,*( ,.... ,.... ,.... ,.... ,....,.... ,.... ,.... ,.... ,*"    *(     "&*.26:>BFJNRVV<"XZ"@*((XZZZZZZZZZJXZ>XZZZZZZZZZZ&8" XZ<*(XZZZZZZZZZVXZ>XZZZZZZZZZZ"4" XZ"8*((XZZZZZZZZZZ"&*,.... ,.... ,.... ,.... ,, ,. ,., *(, ,.... ,.... ,.... ,.... ,....,.... ,.... ,.... ,.... "  ((    "&*.26:>BFJNRVB(" XZ&,*((XZZZZZZZZZZ"XZ>XZZZZZZZZZZ$" XZ*(*((XZZZZZZZZZZ.XZ>XZZZZZZZZZZ " XZ. *((XZZZZZZZZZZr(@p1Q0`qqqqQP`qqqqQP`qqqqQP`qqqqQP`aqqQP`PAAaqP`qqqqQP`qqqqQP`qqqqQP`qqqqQ0`qqqq0`qqqqQP`qqqqQP`qqqqQP`qqqqQP@pPPpPAAPPPPPPPP00@p1Qq2RrrѠҲPA 1ҲҀҲ`PAr01Ғ`ұ`PAҲP a!b"a⢠⢠⢠⢠ ""@A⢡⢠⢠⢠`"a⢠⢠⢠⢠  a!bbA"⡀⡀aD@"b a!b"c#d$ecAebBDB@ec%$ce!` @D@ a!b` "a a!b"c#d$ee#` ` a!b"a⢠⢠⢠⢠⢢`⢠⢠⢠"!` aa@aaaaaaaaaa!a@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa AaaaaaaaaaaBaaaaaaaaa@aaaaaaaaaa@aaaaaaaaaa a!bb"` aaaaa a!b"c#d$$AeeBAeeeeeeeeeee%!` aaa!@@a` a!b"c#d$e$Ae墂BAAeeeeeeeeeee`BBBBb@ee@a@b@eeeeeeeee# Aee@AAeeeeeeeeeeeeBBBBc@%e@``a@e@e@e#@            )("&* ,.... ,.... ,.."&$$$,,.... ,....,.................." (,.."*( ,...................& "&*."0222.02222222222222222" (022*( 022222222222222222&"&*.24666466666666666666*" ,466(( 4666666666666666&&"&*.246664666 4666 4666 46" 04 4.*(($4 4666 4666 4666 4& """""" """""" """""" """""" """""" """   "*((  " """""" """""" """""" & " $&&&&&$&&&&&"&*.26:>BFJN&" 8P:*((,PRRRRRRRRR&"&*.26.8:::8::::::::::::: 88:*((08:::::::::::::& "&*.26:<>>:<>>>>>>>>>>>>" <<>(((4<>>>>>>>>>>>>&$$$<>>>>>>"<>>:<>>2 <>>2 <>>2 <" << (*(8<: <>>2 <>>2 <>>JL$,4 to continue." # End. python-pqueue-0.2.orig/pqueuemodule-config.h0100644000175000000500000000046506742635500020133 0ustar quangosrc/* pqueuemodule-config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define as __inline if that's what the C compiler calls it. */ /* #undef inline */ /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 python-pqueue-0.2.orig/README0100644000175000000500000001005307105247173014656 0ustar quangosrcPQueue Extension Module for Python - 0.2 ========================================= This C extension implements a priority-queue object using a fibonacci heap as the underlying data structure. This data structure supports the following operations with the given amortized time-complexity: - insert: O(1) - find-min: O(1) - extract-min: O(lg N) - decrease-key: O(1) - increase-key: O(lg N) (== delete, insert) - delete: O(lg N) (== decrease-key, extract-min) This asymptotic behaviour compares favourably to more traditional structures such as binomial heaps, at the cost of slightly higher constant overheads. This is the second release of this extension -- the first release was very stable with the exception of one glaring bug which has now been fixed. Thanks must go to James Henstridge for providing such a nice autoconf system for extension modules, and to Aaron Waters for providing the PyModules FAQ resource and his pq3.py module (a slightly modified version of which is included in this distribution for benchmarking purposes). - Andrew Snare Compiling and Installing ======================== Compiling should be as simple as: 1) Unpacking the distribution (hopefully complete if you are reading this); 2) % ./configure 3) % make Installing should be as simple as: 4) # make install Using the PQueue Extension ========================== The priority-queue object (PQueue) is made available using something like: >>> from pqueue import PQueue A priority-queue can then be instantiated using something like: >>> pq = PQueue() The constructor takes no arguments and runs in O(1) amortized time. PQueue methods are: PQueue.insert(priority,data): Inserts into the queue with an associated priority of . Both items can be any python object, with the following restrictions: - must be comparable to all other priorities inserted. - must be hashable. If the data is not unique (and has been previously attached to an element in the queue) then the mapping interface described below is not available for . This call runs in O(1) amortized time. PQueue.peek(): Returns a (priority,data) tuple containing the element in the queue with the lowest priority, but does not remove the element from the queue. These should be considered immutable (even if they are not so). This call runs in O(1) amortized time. PQueue.pop(): Returns a (priority,data) tuple containing the element in the queue with the lowest priority, and extracts it from the queue. This call runs in O(lg N) amortized time. In addition, PQueue objects support a mapping interface such that: len(pq): Returns the number of elements currently in the queue. This call runs in O(1) amortized time. pq[data] Returns the priority associated with , assuming it has already been inserted in the queue (otherwise KeyError is raised). This call runs in O(1) amortized time. pq[data] = priority Allows the priority associated with to be reduced. If is greater than the current priority associated with , ValueError is raised. This call runs in O(1) amortized time if the new priority is less than or equal to the current priority. If the new priority is greater than the current one, a delete/insert is done which means the call runs in O(lg N) amortized time. del pq[data] Deletes the element associated with from the queue. This call runs in O(lg N) amortized time. Feedback regarding this interface is most welcome. Bugs ==== There may be bugs lurking in this release although the package has been fairly extensively tested. Unfortunately the complexity of the underlying data structures makes it very difficult to test the module fully. If anomolies are noticed, I'd appreciate a note (including how to reproduce the anomoly) since debugging this beast will be rather difficult. Contacting the Author ===================== The author of this package can be reached at: Andrew Snare