[Zope-Checkins] CVS: Zope2 - ISO_8859_1_Splitter.c:1.1.2.1 Makefile.pre.in:1.1.2.1 Setup:1.1.2.1 config.c:1.1.2.1 __init__.py:1.1.2.2

andreas@digicool.com andreas@digicool.com
Mon, 14 May 2001 16:12:48 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes/TextIndex/Splitter
In directory korak.digicool.com:/tmp/cvs-serv26766

Modified Files:
      Tag: ajung-dropin-registry
	__init__.py 
Added Files:
      Tag: ajung-dropin-registry
	ISO_8859_1_Splitter.c Makefile.pre.in Setup config.c 
Log Message:
added



--- Added File ISO_8859_1_Splitter.c in package Zope2 ---
/*****************************************************************************
  
  Zope Public License (ZPL) Version 1.0
  -------------------------------------
  
  Copyright (c) Digital Creations.  All rights reserved.
  
  This license has been certified as Open Source(tm).
  
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met:
  
  1. Redistributions in source code must retain the above copyright
     notice, this list of conditions, and the following disclaimer.
  
  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions, and the following disclaimer in
     the documentation and/or other materials provided with the
     distribution.
  
  3. Digital Creations requests that attribution be given to Zope
     in any manner possible. Zope includes a "Powered by Zope"
     button that is installed by default. While it is not a license
     violation to remove this button, it is requested that the
     attribution remain. A significant investment has been put
     into Zope, and this effort will continue if the Zope community
     continues to grow. This is one way to assure that growth.
  
  4. All advertising materials and documentation mentioning
     features derived from or use of this software must display
     the following acknowledgement:
  
       "This product includes software developed by Digital Creations
       for use in the Z Object Publishing Environment
       (http://www.zope.org/)."
  
     In the event that the product being advertised includes an
     intact Zope distribution (with copyright and license included)
     then this clause is waived.
  
  5. Names associated with Zope or Digital Creations must not be used to
     endorse or promote products derived from this software without
     prior written permission from Digital Creations.
  
  6. Modified redistributions of any form whatsoever must retain
     the following acknowledgment:
  
       "This product includes software developed by Digital Creations
       for use in the Z Object Publishing Environment
       (http://www.zope.org/)."
  
     Intact (re-)distributions of any official Zope release do not
     require an external acknowledgement.
  
  7. Modifications are encouraged but must be packaged separately as
     patches to official Zope releases.  Distributions that do not
     clearly separate the patches from the original work must be clearly
     labeled as unofficial distributions.  Modifications which do not
     carry the name Zope may be packaged in any form, as long as they
     conform to all of the clauses above.
  
  
  Disclaimer
  
    THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
    EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    SUCH DAMAGE.
  
  
  This software consists of contributions made by Digital Creations and
  many individuals on behalf of Digital Creations.  Specific
  attributions are listed in the accompanying credits file.
  
 ****************************************************************************/
#include "Python.h"
#include <ctype.h>

#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
#define UNLESS_ASSIGN(V,E) ASSIGN(V,E) UNLESS(V)

#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ"
#define LOWERCASE "abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöùúûüý"
#define DIGITSETC "0123456789-ßµ"

static PyObject *next_word();

static unsigned char letdig[256];
static unsigned char trtolower[256];


typedef struct 
{
    PyObject_HEAD
    PyObject *text, *synstop;
    char *here, *end;
    int index;
} Splitter;

//-------------------------------------------------------


static int myisalnum(int c)
{
	return letdig[(unsigned char)c];
}

static int mytolower(int c)
{
	return trtolower[(unsigned char)c];
}

static int myisspace(int c)
{
	if (myisalnum(c)) return 0;
	return isspace(c);
}

static void initSplitterTrtabs()
{
	int i;
	static initialized=0;

	if (initialized) return;
	initialized=1;
	for (i=0;i<256;i++) 
	{
		letdig[i]=0;
		trtolower[i]=i;
	}
	for (i=0;i<sizeof(UPPERCASE);i++)
	{
		trtolower[(unsigned char)UPPERCASE[i]]=LOWERCASE[i];
		letdig[(unsigned char)LOWERCASE[i]]=1;
		letdig[(unsigned char)UPPERCASE[i]]=1;
	}
	for (i=0;i<sizeof(DIGITSETC);i++)
	{
		letdig[DIGITSETC[i]]=1;
	}
}
//-------------------------------------------------------

static void
Splitter_reset(Splitter *self)
{
    self->here = PyString_AsString(self->text);
    self->index = -1;
}

static void
Splitter_dealloc(Splitter *self) 
{
    Py_XDECREF(self->text);
    Py_XDECREF(self->synstop);
    PyMem_DEL(self);
}

static int
Splitter_length(Splitter *self)
{
    PyObject *res=0;

    Splitter_reset(self);
    while(1)
      {
	UNLESS_ASSIGN(res,next_word(self,NULL,NULL)) return -1;
	UNLESS(PyString_Check(res))
	  {
	    Py_DECREF(res);
	    break;
	  }
      }
    return self->index+1;
}

static PyObject *
Splitter_concat(Splitter *self, PyObject *other)
{
    PyErr_SetString(PyExc_TypeError, "Cannot concatenate Splitters.");
    return NULL;
}

static PyObject *
Splitter_repeat(Splitter *self, long n)
{
    PyErr_SetString(PyExc_TypeError, "Cannot repeat Splitters.");
    return NULL;
}

/*
  Map an input word to an output word by applying standard
  filtering/mapping words, including synonyms/stop words.

  Input is a word.
  
  Output is:

     None -- The word is a stop word

     sometext -- A replacement for the word
 */
static PyObject *
check_synstop(Splitter *self, PyObject *word)
{
    PyObject *value;
    char *cword;
    int len;
    
    cword = PyString_AsString(word);
    len = PyString_Size(word) - 1;

    len = PyString_Size(word);
    if(len < 2)	/* Single-letter words are stop words! */
    {
      Py_INCREF(Py_None);
      return Py_None;
    }

    /*************************************************************
      Test whether a word has any letters.                       *
                                                                 */    
    for (; --len >= 0 && ! isalpha((unsigned char)cword[len]); );
    if (len < 0)
    {
        Py_INCREF(Py_None);
        return Py_None;
    }
    /*
     * If no letters, treat it as a stop word.
     *************************************************************/

    Py_INCREF(word);

    if (self->synstop == NULL) return word;

    while ((value = PyObject_GetItem(self->synstop, word)) &&
	   PyString_Check(value))
    {
        ASSIGN(word,value);
	if(len++ > 100) break;	/* Avoid infinite recurssion */
    }

    if (value == NULL)
    {
        PyErr_Clear();
        return word;
    }

    return value;		/* Which must be None! */
}
 
#define MAX_WORD 64		/* Words longer than MAX_WORD are stemmed */
   
static PyObject *
next_word(Splitter *self, char **startpos, char **endpos)
{
  char wbuf[MAX_WORD];
  char *end, *here, *b;
  int i = 0, c;
  PyObject *pyword, *res;

  here=self->here;
  end=self->end;
  b=wbuf;
  while (here < end)
    {
      /* skip hyphens */ 
      if ((i > 0) && (*here == '-'))
        {
	  here++;
	  while (myisspace(*here) && (here < end)) here++;
	  continue;
	}

      c=mytolower(*here);
      
      /* Check to see if this character is part of a word */
      if(myisalnum((unsigned char)c) || c=='/')
        { /* Found a word character */
	  if(startpos && i==0) *startpos=here;
	  if(i++ < MAX_WORD) *b++ = c;
        }
      else if (i != 0)
        { /* We've found the end of a word */
	  if(i >= MAX_WORD) i=MAX_WORD; /* "stem" the long word */

	  UNLESS(pyword = PyString_FromStringAndSize(wbuf, i))
            {
	      self->here=here;
	      return NULL;
	    }
	  
	  UNLESS(res = check_synstop(self, pyword))
            {
	      self->here=here;
	      Py_DECREF(pyword);
	      return NULL;
	    }
	  
	  if (res != Py_None)
            {
	      if(endpos) *endpos=here;
	      self->here=here;
	      Py_DECREF(pyword);
	      self->index++;
	      return res;
	    }

	  /* The word is a stopword, so ignore it */ 

	  Py_DECREF(res);          
	  Py_DECREF(pyword);
	  i = 0;
	  b=wbuf;
        }
      
      here++;
    }

  self->here=here;

  /* We've reached the end of the string */

  if(i >= MAX_WORD) i=MAX_WORD; /* "stem" the long word */
  if (i == 0)
    { 
      /* No words */
      self->here=here;
      Py_INCREF(Py_None);
      return Py_None;
    }
  
  UNLESS(pyword = PyString_FromStringAndSize(wbuf, i)) return NULL;
  
  if(endpos) *endpos=here;
  res = check_synstop(self, pyword);
  Py_DECREF(pyword);
  if(PyString_Check(res)) self->index++;
  return res;
}

static PyObject *
Splitter_item(Splitter *self, int i)
{
    PyObject *word = NULL;

    if (i <= self->index) Splitter_reset(self);

    while(self->index < i)
    {
        Py_XDECREF(word);

        UNLESS(word = next_word(self,NULL,NULL)) return NULL; 
        if (word == Py_None)
        {
            Py_DECREF(word);
            PyErr_SetString(PyExc_IndexError,
			    "Splitter index out of range");
            return NULL;
        }
    }

    return word;
}

static PyObject *
Splitter_slice(Splitter *self, int i, int j)
{
    PyErr_SetString(PyExc_TypeError, "Cannot slice Splitters.");
    return NULL;
}

static PySequenceMethods Splitter_as_sequence = {
    (inquiry)Splitter_length,        /*sq_length*/
    (binaryfunc)Splitter_concat,     /*sq_concat*/
    (intargfunc)Splitter_repeat,     /*sq_repeat*/
    (intargfunc)Splitter_item,       /*sq_item*/
    (intintargfunc)Splitter_slice,   /*sq_slice*/
    (intobjargproc)0,                    /*sq_ass_item*/
    (intintobjargproc)0,                 /*sq_ass_slice*/
};

static PyObject *
Splitter_pos(Splitter *self, PyObject *args)
{
    char *start, *end, *ctext;
    PyObject *res;
    int i;

    UNLESS(PyArg_Parse(args, "i", &i)) return NULL;

    if (i <= self->index) Splitter_reset(self);

    while(self->index < i)
    {
	UNLESS(res=next_word(self, &start, &end)) return NULL;
	if(PyString_Check(res))
	  {
            self->index++;
	    Py_DECREF(res);
	    continue;
	  }
	Py_DECREF(res);
	PyErr_SetString(PyExc_IndexError, "Splitter index out of range");
	return NULL;
    }

    ctext=PyString_AsString(self->text);
    return Py_BuildValue("(ii)", start - ctext, end - ctext);
}

static PyObject *
Splitter_indexes(Splitter *self, PyObject *args)
{
  PyObject *word, *r, *w=0, *index=0;
  int i=0;

  UNLESS(PyArg_ParseTuple(args,"O",&word)) return NULL;
  UNLESS(r=PyList_New(0)) return NULL;
  UNLESS(word=check_synstop(self, word)) goto err;

  Splitter_reset(self);
  while(1)
    {
      UNLESS_ASSIGN(w,next_word(self, NULL, NULL)) goto err;
      UNLESS(PyString_Check(w)) break;
      if(PyObject_Compare(word,w)==0)
	{
	  UNLESS_ASSIGN(index,PyInt_FromLong(i)) goto err;
	  if(PyList_Append(r,index) < 0) goto err;
	}
      i++;
    }
  Py_XDECREF(w);
  Py_XDECREF(index);
  return r;

err:
  Py_DECREF(r);
  Py_XDECREF(index);
  return NULL;
}

static struct PyMethodDef Splitter_methods[] = {
    { "pos", (PyCFunction)Splitter_pos, 0,
      "pos(index) -- Return the starting and ending position of a token" },
    { "indexes", (PyCFunction)Splitter_indexes, METH_VARARGS,
      "indexes(word) -- Return al list of the indexes of word in the sequence",
    },
    { NULL, NULL }		/* sentinel */
};

static PyObject *
Splitter_getattr(Splitter *self, char *name) 
{
    return Py_FindMethod(Splitter_methods, (PyObject *)self, name);
}

static char SplitterType__doc__[] = "";

static PyTypeObject SplitterType = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /*ob_size*/
    "Splitter",                    /*tp_name*/
    sizeof(Splitter),              /*tp_basicsize*/
    0,                                 /*tp_itemsize*/
    /* methods */
    (destructor)Splitter_dealloc,  /*tp_dealloc*/
    (printfunc)0,                      /*tp_print*/
    (getattrfunc)Splitter_getattr, /*tp_getattr*/
    (setattrfunc)0,                    /*tp_setattr*/
    (cmpfunc)0,                        /*tp_compare*/
    (reprfunc)0,                       /*tp_repr*/
    0,                                 /*tp_as_number*/
    &Splitter_as_sequence,         /*tp_as_sequence*/
    0,                                 /*tp_as_mapping*/
    (hashfunc)0,                       /*tp_hash*/
    (ternaryfunc)0,                    /*tp_call*/
    (reprfunc)0,                       /*tp_str*/

    /* Space for future expansion */
    0L,0L,0L,0L,
    SplitterType__doc__ /* Documentation string */
};

static PyObject *
get_Splitter(PyObject *modinfo, PyObject *args)
{
    Splitter *self;
    PyObject *doc, *synstop = NULL;

    UNLESS(PyArg_ParseTuple(args,"O|O",&doc,&synstop)) return NULL;

    UNLESS(self = PyObject_NEW(Splitter, &SplitterType)) return NULL;

    if(synstop)
      {
	self->synstop=synstop;
	Py_INCREF(synstop);
      }
    else self->synstop=NULL;

    UNLESS(self->text = PyObject_Str(doc)) goto err;
    UNLESS(self->here=PyString_AsString(self->text)) goto err;
    self->end = self->here + PyString_Size(self->text);
    self->index = -1;
    return (PyObject*)self;
err:
    Py_DECREF(self);
    return NULL;
}

static struct PyMethodDef Splitter_module_methods[] = {
    { "Splitter", (PyCFunction)get_Splitter, METH_VARARGS,
      "Splitter(doc[,synstop]) -- Return a word splitter" },
    { NULL, NULL }
};

static char Splitter_module_documentation[] = 
"Parse source strings into sequences of words\n"
"\n"
"for use in an inverted index\n"
"\n"
"$Id: ISO_8859_1_Splitter.c,v 1.1.2.1 2001/05/14 20:12:48 andreas Exp $\n"
;


void
initSplitter() 
{
  PyObject *m, *d;
  char *rev="$Revision: 1.1.2.1 $";
  
  /* Create the module and add the functions */
  initSplitterTrtabs();
  m = Py_InitModule4("Splitter", Splitter_module_methods,
                     Splitter_module_documentation,
                     (PyObject*)NULL,PYTHON_API_VERSION);
  
  /* Add some symbolic constants to the module */
  d = PyModule_GetDict(m);
  PyDict_SetItemString(d, "__version__",
		       PyString_FromStringAndSize(rev+11,strlen(rev+11)-2));

  if (PyErr_Occurred()) Py_FatalError("can't initialize module Splitter");
  printf("%s",Splitter_module_documentation);
}


--- Added File Makefile.pre.in in package Zope2 ---
# Universal Unix Makefile for Python extensions
# =============================================

# Short Instructions
# ------------------

# 1. Build and install Python (1.5 or newer).
# 2. "make -f Makefile.pre.in boot"
# 3. "make"
# You should now have a shared library.

# Long Instructions
# -----------------

# Build *and install* the basic Python 1.5 distribution.  See the
# Python README for instructions.  (This version of Makefile.pre.in
# only withs with Python 1.5, alpha 3 or newer.)

# Create a file Setup.in for your extension.  This file follows the
# format of the Modules/Setup.dist file; see the instructions there.
# For a simple module called "spam" on file "spammodule.c", it can
# contain a single 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.

# If you want to build your extension as a shared library, insert a
# line containing just the string
#   *shared*
# at the top of your Setup.in file.

# Note that the build process copies Setup.in to Setup, and then works
# with Setup.  It doesn't overwrite Setup when Setup.in is changed, so
# while you're in the process of debugging your Setup.in file, you may
# want to edit Setup instead, and copy it back to Setup.in later.
# (All this is done so you can distribute your extension easily and
# someone else can select the modules they actually want to build by
# commenting out lines in the Setup file, without editing the
# original.  Editing Setup is also used to specify nonstandard
# locations for include or library files.)

# Copy this file (Misc/Makefile.pre.in) to the directory containing
# your extension.

# Run "make -f Makefile.pre.in boot".  This creates Makefile
# (producing Makefile.pre and sedscript 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
#   make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
# where <prefix> is the prefix used to install Python for installdir
# (and possibly similar for exec_installdir=<exec_prefix>).

# Note: "make boot" implies "make clobber" -- it assumes that when you
# bootstrap you may have changed platforms so it removes all previous
# output files.

# 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, you must run
# "make Makefile" before running "make".

# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and say (e.g.):
#   make -f ../Makefile.pre.in boot srcdir=.. VPATH=..


# === Bootstrap variables (edited through "make boot") ===

# The prefix used by "make inclinstall libainstall" of core python
installdir=	/usr/local

# The exec_prefix used by the same
exec_installdir=$(installdir)

# Source directory and VPATH in case you want to use VPATH.
# (You will have to edit these two lines yourself -- there is no
# automatic support as the Makefile is not generated by
# config.status.)
srcdir=		.
VPATH=		.

# === Variables that you may want to customize (rarely) ===

# (Static) build target
TARGET=		python

# Installed python binary (used only by boot target)
PYTHON=		python

# Add more -I and -D options here
CFLAGS=		$(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(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 (through sedscript) ===

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@
CXX=		@CXX@

# Install prefix for architecture-independent files
prefix=		/usr/local

# Install prefix for architecture-dependent files
exec_prefix=	$(prefix)

# Uncomment the following two lines for AIX
#LINKCC= 	$(LIBPL)/makexp_aix $(LIBPL)/python.exp "" $(LIBRARY); $(PURIFY) $(CC)
#LDSHARED=	$(LIBPL)/ld_so_aix $(CC) -bI:$(LIBPL)/python.exp

# === Fixed definitions ===

# Shell used by make (some versions default to the login shell, which is bad)
SHELL=		/bin/sh

# Expanded directories
BINDIR=		$(exec_installdir)/bin
LIBDIR=		$(exec_prefix)/lib
MANDIR=		$(installdir)/man
INCLUDEDIR=	$(installdir)/include
SCRIPTDIR=	$(prefix)/lib

# Detailed destination directories
BINLIBDEST=	$(LIBDIR)/python$(VERSION)
LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
EXECINCLUDEPY=	$(exec_installdir)/include/python$(VERSION)
LIBP=		$(exec_installdir)/lib/python$(VERSION)
DESTSHARED=	$(BINLIBDEST)/site-packages

LIBPL=		$(LIBP)/config

PYTHONLIBS=	$(LIBPL)/libpython$(VERSION).a

MAKESETUP=	$(LIBPL)/makesetup
MAKEFILE=	$(LIBPL)/Makefile
CONFIGC=	$(LIBPL)/config.c
CONFIGCIN=	$(LIBPL)/config.c.in
SETUP=		$(LIBPL)/Setup.config $(LIBPL)/Setup.local $(LIBPL)/Setup

SYSLIBS=	$(LIBM) $(LIBC)

ADDOBJS=	$(LIBPL)/python.o config.o

# Portable install script (configure doesn't always guess right)
INSTALL=	$(LIBPL)/install-sh -c
# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED=	${INSTALL} -m 555

# === Fixed rules ===

# Default target.  This builds shared libraries only
default:	sharedmods

# Build everything
all:		static sharedmods

# Build shared libraries from our extension modules
sharedmods:	$(SHAREDMODS)

# Build a static Python binary containing our extension modules
static:		$(TARGET)
$(TARGET):	$(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
		 $(ADDOBJS) lib.a $(PYTHONLIBS) \
		 $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
		 -o $(TARGET) $(LDLAST)

install:	sharedmods
		if test ! -d $(DESTSHARED) ; then \
			mkdir $(DESTSHARED) ; else true ; fi
		-for i in X $(SHAREDMODS); do \
			if test $$i != X; \
			then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
			fi; \
		done

# Build the library containing our extension modules
lib.a:		$(MODOBJS)
		-rm -f lib.a
		ar cr lib.a $(MODOBJS)
		-$(RANLIB) lib.a 

# This runs makesetup *twice* to use the BASESETUP definition from Setup
config.c Makefile:	Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
		$(MAKESETUP) \
		 -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
		$(MAKE) -f Makefile do-it-again

# Internal target to run makesetup for the second time
do-it-again:
		$(MAKESETUP) \
		 -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)

# Make config.o from the config.c created by makesetup
config.o:	config.c
		$(CC) $(CFLAGS) -c config.c

# Setup is copied from Setup.in *only* if it doesn't yet exist
Setup:
		cp $(srcdir)/Setup.in Setup

# Make the intermediate Makefile.pre from Makefile.pre.in
Makefile.pre: Makefile.pre.in sedscript
		sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre

# Shortcuts to make the sed arguments on one line
P=prefix
E=exec_prefix
H=Generated automatically from Makefile.pre.in by sedscript.
L=LINKFORSHARED

# Make the sed script used to create Makefile.pre from Makefile.pre.in
sedscript:	$(MAKEFILE)
	sed -n \
	 -e '1s/.*/1i\\/p' \
	 -e '2s%.*%# $H%p' \
	 -e '/^VERSION=/s/^VERSION=[ 	]*\(.*\)/s%@VERSION[@]%\1%/p' \
	 -e '/^CC=/s/^CC=[ 	]*\(.*\)/s%@CC[@]%\1%/p' \
	 -e '/^CXX=/s/^CXX=[ 	]*\(.*\)/s%@CXX[@]%\1%/p' \
	 -e '/^LINKCC=/s/^LINKCC=[ 	]*\(.*\)/s%@LINKCC[@]%\1%/p' \
	 -e '/^OPT=/s/^OPT=[ 	]*\(.*\)/s%@OPT[@]%\1%/p' \
	 -e '/^LDFLAGS=/s/^LDFLAGS=[ 	]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
	 -e '/^LDLAST=/s/^LDLAST=[      ]*\(.*\)/s%@LDLAST[@]%\1%/p' \
	 -e '/^DEFS=/s/^DEFS=[ 	]*\(.*\)/s%@DEFS[@]%\1%/p' \
	 -e '/^LIBS=/s/^LIBS=[ 	]*\(.*\)/s%@LIBS[@]%\1%/p' \
	 -e '/^LIBM=/s/^LIBM=[ 	]*\(.*\)/s%@LIBM[@]%\1%/p' \
	 -e '/^LIBC=/s/^LIBC=[ 	]*\(.*\)/s%@LIBC[@]%\1%/p' \
	 -e '/^RANLIB=/s/^RANLIB=[ 	]*\(.*\)/s%@RANLIB[@]%\1%/p' \
	 -e '/^MACHDEP=/s/^MACHDEP=[ 	]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
	 -e '/^SO=/s/^SO=[ 	]*\(.*\)/s%@SO[@]%\1%/p' \
	 -e '/^LDSHARED=/s/^LDSHARED=[ 	]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
	 -e '/^CCSHARED=/s/^CCSHARED=[ 	]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
	 -e '/^SGI_ABI=/s/^SGI_ABI=[ 	]*\(.*\)/s%@SGI_ABI[@]%\1%/p' \
	 -e '/^$L=/s/^$L=[ 	]*\(.*\)/s%@$L[@]%\1%/p' \
	 -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
	 -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
	 $(MAKEFILE) >sedscript
	echo "/^installdir=/s%=.*%=	$(installdir)%" >>sedscript
	echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
	echo "/^srcdir=/s%=.*%=		$(srcdir)%" >>sedscript
	echo "/^VPATH=/s%=.*%=		$(VPATH)%" >>sedscript
	echo "/^LINKPATH=/s%=.*%=	$(LINKPATH)%" >>sedscript
	echo "/^BASELIB=/s%=.*%=	$(BASELIB)%" >>sedscript
	echo "/^BASESETUP=/s%=.*%=	$(BASESETUP)%" >>sedscript

# Bootstrap target
boot:	clobber
	VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
	installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
	exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
	$(MAKE) -f $(srcdir)/Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
		VERSION=$$VERSION \
		installdir=$$installdir \
		exec_installdir=$$exec_installdir \
		Makefile

# 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 $(TARGET) sedscript
		-rm -f *.so *.sl so_locations


# Handy target to remove everything you don't want to distribute
distclean:	clobber
		-rm -f Makefile Setup

--- Added File Setup in package Zope2 ---
*shared*
Splitter Splitter.c
ISO_8859_1_Splitter ISO_8859_1_Splitter.c

--- Added File config.c in package Zope2 ---
/* Generated automatically from /opt/python-2.1/lib/python2.1/config/config.c.in by makesetup. */
/* -*- C -*- ***********************************************
Copyright (c) 2000, BeOpen.com.
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
All rights reserved.

See the file "Misc/COPYRIGHT" for information on usage and
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
******************************************************************/

/* Module configuration */

/* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */

/* This file contains the table of built-in modules.
   See init_builtin() in import.c. */

#include "Python.h"


extern void initgc(void);
extern void initthread(void);
extern void initsignal(void);
extern void initposix(void);
extern void init_sre(void);

/* -- ADDMODULE MARKER 1 -- */

extern void PyMarshal_Init(void);
extern void initimp(void);

struct _inittab _PyImport_Inittab[] = {

	{"gc", initgc},
	{"thread", initthread},
	{"signal", initsignal},
	{"posix", initposix},
	{"_sre", init_sre},

/* -- ADDMODULE MARKER 2 -- */

	/* This module lives in marshal.c */
	{"marshal", PyMarshal_Init},

	/* This lives in import.c */
	{"imp", initimp},

	/* These entries are here for sys.builtin_module_names */
	{"__main__", NULL},
	{"__builtin__", NULL},
	{"sys", NULL},
	{"exceptions", init_exceptions},

	/* Sentinel */
	{0, 0}
};

--- Updated File __init__.py in package Zope2 --
--- __init__.py	2001/05/14 18:16:10	1.1.2.1
+++ __init__.py	2001/05/14 20:12:48	1.1.2.2
@@ -1 +1,6 @@
-from Splitter import *
+import os,sys
+
+availableSplitters = ["Splitter","ISO_8859_1_Splitter"]
+
+
+exec( "from %s import *" % availableSplitters[0])